[PATCH] D124426: [InstCombine] Remove the undef-related workaround code in visitSelectInst
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 30 04:52:23 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG40a2e35599b5: [InstCombine] Remove the undef-related workaround code in visitSelectInst (authored by aqjune).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124426/new/
https://reviews.llvm.org/D124426
Files:
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/select-cmp.ll
Index: llvm/test/Transforms/InstCombine/select-cmp.ll
===================================================================
--- llvm/test/Transforms/InstCombine/select-cmp.ll
+++ llvm/test/Transforms/InstCombine/select-cmp.ll
@@ -3,8 +3,7 @@
define i1 @f(i1 %cond, i32 %x, i32 %x2) {
; CHECK-LABEL: @f(
-; CHECK-NEXT: [[Y:%.*]] = select i1 [[COND:%.*]], i32 poison, i32 [[X:%.*]]
-; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[Y]], [[X2:%.*]]
+; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[X:%.*]], [[X2:%.*]]
; CHECK-NEXT: ret i1 [[C]]
;
%y = select i1 %cond, i32 poison, i32 %x
Index: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -2644,22 +2644,6 @@
Value *FalseVal = SI.getFalseValue();
Type *SelType = SI.getType();
- // FIXME: Remove this workaround when freeze related patches are done.
- // For select with undef operand which feeds into an equality comparison,
- // don't simplify it so loop unswitch can know the equality comparison
- // may have an undef operand. This is a workaround for PR31652 caused by
- // descrepancy about branch on undef between LoopUnswitch and GVN.
- if (match(TrueVal, m_Undef()) || match(FalseVal, m_Undef())) {
- if (llvm::any_of(SI.users(), [&](User *U) {
- ICmpInst *CI = dyn_cast<ICmpInst>(U);
- if (CI && CI->isEquality())
- return true;
- return false;
- })) {
- return nullptr;
- }
- }
-
if (Value *V = SimplifySelectInst(CondVal, TrueVal, FalseVal,
SQ.getWithInstruction(&SI)))
return replaceInstUsesWith(SI, V);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124426.426219.patch
Type: text/x-patch
Size: 1779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220430/4f886330/attachment.bin>
More information about the llvm-commits
mailing list