[PATCH] D152456: SeparateConstOffsetFromGEP: Don't use SCEV
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 05:26:04 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp:1240
+ if (auto *Dom =
+ findClosestMatchingDominator({LHS, RHS}, I, DominatingAdds)) {
Instruction *NewSExt = new SExtInst(Dom, I->getType(), "", I);
----------------
I believe the previous code would also detect cases where the add operands are swapped as the same. Could add something like
```
static std::pair<Value *, Value *> createNormalizedPair(Value *A, Value *B) {
if (A < B)
return {A, B};
return {B, A};
}
```
and use it for the add case to preserve that behavior. Though the fact that it's apparently untested is not reassuring...
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152456/new/
https://reviews.llvm.org/D152456
More information about the llvm-commits
mailing list