[PATCH] D146622: [AggressiveInstCombine] folding load for constant global patterened arrays and structs by GEP indices

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 12:05:38 PDT 2023


rupprecht added a comment.

In D146622#4330046 <https://reviews.llvm.org/D146622#4330046>, @rupprecht wrote:

> This is causing a compiler crash, which looks like a div by zero. I'll start working on a repro, but I'd like to revert to keep trunk green.

Reverted in e08c397a88077c50dc25e71b39b9d5efbfc85a9a <https://reviews.llvm.org/rGe08c397a88077c50dc25e71b39b9d5efbfc85a9a>

The following crashes under `opt -passes=aggressive-instcombine`:

  ; ModuleID = 'repro.ll'
  source_filename = "repro.ll"
  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-linux-gnu"
  
  %struct.snork = type { i128 }
  
  @global = internal constant %struct.snork { i128 1 }
  
  define i1 @snork() {
  bb:
    %load = load i64, ptr @global, align 8
    %icmp = icmp sgt i64 %load, 0
    call void @llvm.assume(i1 %icmp)
    ret i1 false
  }
  
  ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite)
  declare void @llvm.assume(i1 noundef) #0
  
  attributes #0 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }

Halide also found this too: https://buildbot.halide-lang.org/master/#/builders/76/builds/64/steps/9/logs/stdio


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146622/new/

https://reviews.llvm.org/D146622



More information about the llvm-commits mailing list