[PATCH] D125438: [InstCombine] NEW Baseline tests for InstCombine optimization to merge GEP instructions with constant indices

William Junda Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 11:24:32 PDT 2022


huangjd 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) {
----------------
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 



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