[llvm] [LIR][SCEVExpander] Restore original flags when aborting transform (PR #82362)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 13:43:24 PST 2024


nikic wrote:

@nathanchance Thanks for the report! Here's a reduced test case:
```llvm
; RUN: opt -S -passes=loop-reduce < %s
target triple = "riscv64-unknown-linux-gnu"

define void @test(ptr %p, i8 %arg, i32 %start) {
entry:
  %conv = zext i8 %arg to i32
  %shr = lshr i32 %conv, 1
  %wide.trip.count = zext nneg i32 %shr to i64
  br label %for.body

for.body:
  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
  %add810 = phi i32 [ %start, %entry ], [ %add, %for.body ]
  %idxprom2 = zext i32 %add810 to i64
  %arrayidx3 = getelementptr i8, ptr %p, i64 %idxprom2
  %v = load i8, ptr %arrayidx3, align 1
  %add = add i32 %add810, 1
  %indvars.iv.next = add i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %wide.trip.count
  br i1 %exitcond.not, label %exit, label %for.body

exit:
  ret void
}
```

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


More information about the llvm-commits mailing list