[PATCH] D134954: [InstCombine] Switch foldOpIntoPhi() to use InstSimplify

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 12:05:06 PDT 2022


nikic added a comment.

In D134954#3827686 <https://reviews.llvm.org/D134954#3827686>, @spatel wrote:

> I haven't followed the nuances of inttoptr/ptrtoint folding, but I assume those diffs are valid.

It's technically not correct, but we currently still consider inttoptr(ptrtoint) as no-op casts. There is a `disable-i2p-p2i-opt` flag to centrally disable this behavior.



================
Comment at: llvm/test/Transforms/InstCombine/recurrence.ll:7
 ; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[TMP0:%.*]] = or i64 [[A:%.*]], 15
 ; CHECK-NEXT:    br label [[LOOP:%.*]]
----------------
spatel wrote:
> This is an improvement, but it's not clear to me from the diffs or debug spew why it happened. Did you step through to look at that?
This fold gets performed by foldOpIntoPhi() now, while it was previously done by https://github.com/llvm/llvm-project/blob/586784a2e4acc70a5aedfab64723f992f83deaaa/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp#L3221-L3225. (That fold isn't redundant though, because we will only call foldOpIntoPhi() with a constant operand, at least currently.)


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

https://reviews.llvm.org/D134954



More information about the llvm-commits mailing list