[PATCH] D149935: [ValueTracking] Imply poison if ValAssumePoison is identical to V
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 5 00:59:01 PDT 2023
StephenFan created this revision.
StephenFan added reviewers: nikic, goldstein.w.n.
Herald added a subscriber: hiraditya.
Herald added a project: All.
StephenFan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149935
Files:
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstCombine/signed-truncation-check.ll
Index: llvm/test/Transforms/InstCombine/signed-truncation-check.ll
===================================================================
--- llvm/test/Transforms/InstCombine/signed-truncation-check.ll
+++ llvm/test/Transforms/InstCombine/signed-truncation-check.ll
@@ -661,7 +661,7 @@
; CHECK-NEXT: call void @use32(i32 [[T4]])
; CHECK-NEXT: [[T5:%.*]] = icmp eq i32 [[T4]], [[ARG]]
; CHECK-NEXT: call void @use1(i1 [[T5]])
-; CHECK-NEXT: [[T6:%.*]] = select i1 [[T2]], i1 [[T5]], i1 false
+; CHECK-NEXT: [[T6:%.*]] = and i1 [[T2]], [[T5]]
; CHECK-NEXT: ret i1 [[T6]]
;
%t1 = trunc i32 %arg to i8
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -6509,6 +6509,11 @@
if (ValAssumedPoison == V)
return true;
+ auto *IAssumedPoison = dyn_cast<Instruction>(ValAssumedPoison);
+ auto *IV = dyn_cast<Instruction>(V);
+ if (IAssumedPoison && IV && IAssumedPoison->isIdenticalTo(IV))
+ return true;
+
const unsigned MaxDepth = 2;
if (Depth >= MaxDepth)
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149935.519761.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230505/8e31d513/attachment.bin>
More information about the llvm-commits
mailing list