[PATCH] D153963: [InstCombine] Fold add of select and zext/sext of select condition
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 28 07:19:10 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1492
+ Constant *TrueC, *FalseC;
+ if ((match(RHS, m_ZExtOrSExt(m_Value(A))) &&
+ A->getType()->getScalarSizeInBits() == 1) &&
----------------
Redundant `()`.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1496
+ m_ImmConstant(FalseC)))) {
+ if (CondVal == A) {
+ if (isa<ZExtInst>(RHS))
----------------
In this case, we don't have to require that False is a constant, right?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1502
+
+ if (match(A, m_Not(m_Specific(CondVal)))) {
+ if (isa<ZExtInst>(RHS))
----------------
And in this case, True can be non-constant.
================
Comment at: llvm/test/Transforms/InstCombine/add.ll:3066
+ ret i64 %add
+}
+
----------------
Can you please add these additional tests:
* Negative test where select and zext args are not the same.
* Multi-use test.
* Vector test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153963/new/
https://reviews.llvm.org/D153963
More information about the llvm-commits
mailing list