[llvm] ValueTracking: generalize isNonEqualPHIs (PR #108820)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 04:35:40 PDT 2024


https://github.com/dtcxzyw requested changes to this pull request.

```
; bin/opt -passes=early-cse reduced.ll -S
; ModuleID = 'reduced.ll'
source_filename = "reduced.ll"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define i1 @TLSX_ValidateSupportedCurves(i1 %lnot, i32 %conv21) {
entry:
  br label %for.cond

for.cond:                                         ; preds = %for.inc, %entry
  %defSz.0 = phi i32 [ %defSz.1, %for.inc ], [ 0, %entry ]
  %nextSz.0 = phi i32 [ %nextSz.1, %for.inc ], [ 0, %entry ]
  br i1 %lnot, label %for.body, label %land.lhs.true130

for.body:                                         ; preds = %for.cond
  switch i32 %conv21, label %for.inc [
    i32 0, label %sw.epilog26
    i32 1, label %sw.epilog26
  ]

sw.epilog26:                                      ; preds = %for.body, %for.body
  br label %for.inc

for.inc:                                          ; preds = %sw.epilog26, %for.body
  %defSz.1 = phi i32 [ %defSz.0, %for.body ], [ 0, %sw.epilog26 ]
  %nextSz.1 = phi i32 [ %nextSz.0, %for.body ], [ 0, %sw.epilog26 ]
  br label %for.cond

land.lhs.true130:                                 ; preds = %for.cond
  %cmp131 = icmp eq i32 %defSz.0, %nextSz.0
  ret i1 %cmp131
}
```
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: bin/opt -passes=early-cse test.ll -S
1.      Running pass "function(early-cse<>)" on module "test.ll"
2.      Running pass "early-cse<>" on function "TLSX_ValidateSupportedCurves"
  #0 0x00007fc029e13a92 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSupport.so.20.0git+0x213a92)
  #1 0x00007fc029e1095f llvm::sys::RunSignalHandlers() (/home/dtcxzyw/WorkSpace/Projects/compilers/LLVM/llvm-build/bin/../lib/libLLVMSupport.so.20.0git+0x21095f)
  #2 0x00007fc029e10aa5 SignalHandler(int) Signals.cpp:0:0
  #3 0x00007fc029842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
  #4 0x00007fc022d29d7d isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
  #5 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
  #6 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
  #7 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
  #8 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
  #9 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
 #10 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
 #11 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
...
#250 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
#251 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
#252 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
#253 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
#254 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
#255 0x00007fc022d2a218 isKnownNonEqual(llvm::Value const*, llvm::Value const*, llvm::APInt const&, unsigned int, llvm::SimplifyQuery const&) ValueTracking.cpp:0:0
Segmentation fault (core dumped)
```


https://github.com/llvm/llvm-project/pull/108820


More information about the llvm-commits mailing list