[llvm] (Draft) [SimplifyIndVar] Push more users to worklist for simplifyUsers (PR #93598)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 06:05:33 PDT 2024
================
@@ -511,6 +511,7 @@ bool SimplifyIndvar::eliminateTrunc(TruncInst *TI) {
ICmpInst *ICI = dyn_cast<ICmpInst>(U);
if (!ICI) return false;
assert(L->contains(ICI->getParent()) && "LCSSA form broken?");
+ // assert(L->contains(ICI->getParent()) && "LCSSA form broken?");
----------------
v01dXYZ wrote:
This check will break if there is an exit (or dominated) block with a use-chain `trunc-icmp` such as the following one from `Bitcode/Regression/fft/x86_17.06.19_halide_runtime.bc halide_memoization_cache_lookup`:
``` llvm
for.cond82.preheader: ; preds = %_ZNK15halide_buffer_t13size_in_bytesEv.exit
%48 = trunc i64 %indvars.iv214 to i32
%cmp83195 = icmp sgt i32 %48, 0
br i1 %cmp83195, label %for.body85.preheader, label %cleanup111
```
or such as:
``` llvm
define i1 @foo(i32 %n) {
entry:
br label %loop
loop:
%i = phi i64 [0, %entry], [%i.inc, %loop]
%i.inc = add i64 %i, 1
%i.ult.Icnt = icmp ult i64 %i, 128
br i1 %i.ult.Icnt, label %loop, label %loop.exit
loop.exit:
%i.32 = trunc i64 %i to i32
%i.32.ult.n = icmp ult i32 %i.32, %n
ret i1 %i.32.ult.n
}
```
I've got to take a closer look at the code to understand why LCSSA is required here.
https://github.com/llvm/llvm-project/pull/93598
More information about the llvm-commits
mailing list