[PATCH] D155307: [InstCombine] Allow KnownBits to be propagated
Paulo Matos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 18 04:03:33 PDT 2023
pmatos added a comment.
Landed - @nikic and @goldstein.w.n thanks for the patient and quick reviews.
================
Comment at: llvm/test/Transforms/InstCombine/2023-07-13-arm-infiniteloop.ll:62
+ ret void
+}
+
----------------
nikic wrote:
> nikic wrote:
> > pmatos wrote:
> > > nikic wrote:
> > > > pmatos wrote:
> > > > > nikic wrote:
> > > > > > Please minimize the test -- I don't see how this second function could possibly be related for example.
> > > > > I did run llvm-reduce... I wonder if llvm-reduce is not removing functions. I will take a look.
> > > > llvm-reduce should be removing functions...
> > > hummm, you're right it does. Which is why in this case the test cannot be reduced further and there's no infinite loop if I manually remove the function bpf_prog_calc_tag. However, I cannot see straightforwardly why that is.
> > I don't get an infinite loop with your current test either -- I think your current test might be against something like `-O2` rather than `-passes=instcombine`?
> >
> > Here's a test that works against just instcombine: https://gist.github.com/nikic/a2c0b936686940ae31ae2b23ec9efbcd (Not reduced)
> I wasn't able to reduce it substantially beyond that, but here's a cleaned up test case:
> ```
> declare i1 @llvm.is.constant.i32(i32)
>
> define i32 @test(i32 %arg) {
> entry:
> %zext = zext i32 %arg to i64
> %lshr1 = lshr i64 %zext, 32
> %trunc = trunc i64 %lshr1 to i32
> %cond = call i1 @llvm.is.constant.i32(i32 %trunc)
> br i1 %cond, label %else, label %if
>
> if:
> br label %exit
>
> else:
> %fshl = call i32 @llvm.fshl.i32(i32 %trunc, i32 0, i32 0)
> br label %exit
>
> exit:
> %phi = phi i32 [ %fshl, %else ], [ 0, %if ]
> %lshr2 = lshr i32 %phi, 1
> ret i32 %lshr2
> }
>
> declare i32 @llvm.fshl.i32(i32, i32, i32)
> ```
oh - sorry. Right, I was running on the command line with -O2. Your example works very well though, thanks.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155307/new/
https://reviews.llvm.org/D155307
More information about the llvm-commits
mailing list