forked from OSchip/llvm-project
[ValueTracking] update directlyImpliesPoison to look into select's condition
This is a minor update in directlyImpliesPoison and makes it look into select's condition. Splitted from https://reviews.llvm.org/D96945
This commit is contained in:
parent
cd938ab162
commit
2c16c4a43c
|
@ -4852,6 +4852,10 @@ static bool directlyImpliesPoison(const Value *ValAssumedPoison,
|
|||
return directlyImpliesPoison(ValAssumedPoison, Op, Depth + 1);
|
||||
});
|
||||
|
||||
// 'select ValAssumedPoison, _, _' is poison.
|
||||
if (const auto *SI = dyn_cast<SelectInst>(I))
|
||||
return directlyImpliesPoison(ValAssumedPoison, SI->getCondition(),
|
||||
Depth + 1);
|
||||
// V = extractvalue V0, idx
|
||||
// V2 = extractvalue V0, idx2
|
||||
// V0's elements are all poison or not. (e.g., add_with_overflow)
|
||||
|
|
|
@ -86,8 +86,7 @@ define i1 @merge_logical_and_and3(i1 %X, i1 %Y) {
|
|||
define i1 @merge_two_logical_ands3(i1 %X, i1 %Y) {
|
||||
; CHECK-LABEL: @merge_two_logical_ands3(
|
||||
; CHECK-NEXT: [[C:%.*]] = select i1 [[X:%.*]], i1 [[Y:%.*]], i1 false
|
||||
; CHECK-NEXT: [[RES:%.*]] = select i1 [[C]], i1 [[X]], i1 false
|
||||
; CHECK-NEXT: ret i1 [[RES]]
|
||||
; CHECK-NEXT: ret i1 [[C]]
|
||||
;
|
||||
%c = select i1 %X, i1 %Y, i1 false
|
||||
%res = select i1 %c, i1 %X, i1 false
|
||||
|
@ -223,8 +222,7 @@ define i1 @merge_logical_or_or3(i1 %X, i1 %Y) {
|
|||
define i1 @merge_two_logical_ors3(i1 %X, i1 %Y) {
|
||||
; CHECK-LABEL: @merge_two_logical_ors3(
|
||||
; CHECK-NEXT: [[C:%.*]] = select i1 [[X:%.*]], i1 true, i1 [[Y:%.*]]
|
||||
; CHECK-NEXT: [[RES:%.*]] = select i1 [[C]], i1 true, i1 [[X]]
|
||||
; CHECK-NEXT: ret i1 [[RES]]
|
||||
; CHECK-NEXT: ret i1 [[C]]
|
||||
;
|
||||
%c = select i1 %X, i1 true, i1 %Y
|
||||
%res = select i1 %c, i1 true, i1 %X
|
||||
|
|
Loading…
Reference in New Issue