[PATCH] D120523: [ValueTracking] Simplify llvm::isPointerOffset()
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 25 00:15:21 PST 2022
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:7123
+ if (Ptr1 == Ptr2)
+ return (Offset2 - Offset1).getSExtValue();
----------------
This will cause issues if `Ptr1` and `Ptr2` are in differently-sized address spaces. I think just doing `Offset2.getSExtValue() - Offset1.getSExtValue()` would be fine here.
================
Comment at: llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll:55
+ ret void
+}
+
----------------
I think the main motivation for the additional code isn't scalable vectors, but rather cases that have a common non-constant index, like `GEP p, x, 0` and `GEP p, x, 1`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120523/new/
https://reviews.llvm.org/D120523
More information about the llvm-commits
mailing list