[PATCH] D113510: [InstCombine] Strip offset when folding and/or of icmps
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 10 09:12:21 PST 2021
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1209-1221
+ // Look through addition of a constant offset. This allows us to interpret
+ // the V + C' < C'' range idiom into a proper range.
+ const APInt *Offset1 = nullptr, *Offset2 = nullptr;
+ if (V1 != V2) {
+ Value *X;
+ if (match(V1, m_Add(m_Value(X), m_APInt(Offset1))))
+ V1 = X;
----------------
What about the case where both of them are add's,
but we should have matched only one of them,
i.e. `y = x + C0; q = ((y + C1) < C2) | (y < C3)` ?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2467
- // (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ule (X + CA), C1)
- // iff C2 + CA == C1.
----------------
Hm, but that new code expects two add's.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113510/new/
https://reviews.llvm.org/D113510
More information about the llvm-commits
mailing list