[PATCH] D159326: [InstCombine] Add support for simplifying inverted `select` in `foldAndOrOfSelectUsingImpliedCond`; NFC
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 13 12:54:13 PDT 2023
goldstein.w.n updated this revision to Diff 556697.
goldstein.w.n added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159326/new/
https://reviews.llvm.org/D159326
Files:
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
Index: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -2658,9 +2658,8 @@
return nullptr;
}
-Instruction *InstCombinerImpl::foldAndOrOfSelectUsingImpliedCond(Value *Op,
- SelectInst &SI,
- bool IsAnd) {
+Instruction *InstCombinerImpl::foldAndOrOfSelectUsingImpliedCond(
+ Value *Op, SelectInst &SI, bool IsAnd, bool NotSICond) {
Value *CondVal = SI.getCondition();
Value *A = SI.getTrueValue();
Value *B = SI.getFalseValue();
@@ -2672,6 +2671,9 @@
if (!Res)
return nullptr;
+ if (NotSICond)
+ *Res = !*Res;
+
Value *Zero = Constant::getNullValue(A->getType());
Value *One = Constant::getAllOnesValue(A->getType());
Index: llvm/lib/Transforms/InstCombine/InstCombineInternal.h
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -411,7 +411,8 @@
// or i1 Op, SI / select i1 Op, i1 true, i1 SI (if IsAnd = false)
// into simplier select instruction using isImpliedCondition.
Instruction *foldAndOrOfSelectUsingImpliedCond(Value *Op, SelectInst &SI,
- bool IsAnd);
+ bool IsAnd,
+ bool NotSICond = false);
Instruction *hoistFNegAboveFMulFDiv(Value *FNegOp, Instruction &FMFSource);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159326.556697.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230913/3e279f6f/attachment.bin>
More information about the llvm-commits
mailing list