[PATCH] D125438: [InstCombine] NEW Baseline tests for InstCombine optimization to merge GEP instructions with constant indices
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 12 11:50:46 PDT 2022
nikic added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/gep-canonicalize-constant-indices.ll:62
+
+; It is valid to swap if the source operand of the first GEP has multiple uses.
+define ptr @multipleUses1(ptr %p) {
----------------
huangjd wrote:
> nikic wrote:
> > Isn't this test the same as multipleUses3? The comment on multipleUses3 seems correct (not valid to swap).
> This one
> ```
> %2 = ptrtoint ptr **%p** to i64
> ```
> The expression originally evaluates to
> ```
> ((i32*) p + 1) + (i64) p
> ```
> After swapping it is
> ```
> ((i32*) p + (i64) p) + 1
> ```
> which is still equivalent
>
Oh, I see, the extra use is on %p here, not on %1.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125438/new/
https://reviews.llvm.org/D125438
More information about the llvm-commits
mailing list