forked from OSchip/llvm-project
[ValueTracking] Fix incorrect handling of canCreateUndefOrPoison
.. in isGuaranteedNotToBeUndefOrPoison. This caused early exit of isGuaranteedNotToBeUndefOrPoison, making it return imprecise result. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D84251
This commit is contained in:
parent
18581fd2c4
commit
ace0bf7490
|
@ -4824,10 +4824,7 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (canCreateUndefOrPoison(Opr))
|
||||
return false;
|
||||
|
||||
if (all_of(Opr->operands(), OpCheck))
|
||||
if (!canCreateUndefOrPoison(Opr) && all_of(Opr->operands(), OpCheck))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -381,6 +381,23 @@ EXIT:
|
|||
ret i32 %fr2
|
||||
}
|
||||
|
||||
declare i32 @any_num()
|
||||
|
||||
define i32 @brcond_call() {
|
||||
; CHECK-LABEL: @brcond_call(
|
||||
; CHECK-NEXT: [[X:%.*]] = call i32 @any_num()
|
||||
; CHECK-NEXT: switch i32 [[X]], label [[EXIT:%.*]] [
|
||||
; CHECK-NEXT: ]
|
||||
; CHECK: EXIT:
|
||||
; CHECK-NEXT: ret i32 [[X]]
|
||||
;
|
||||
%x = call i32 @any_num()
|
||||
switch i32 %x, label %EXIT []
|
||||
EXIT:
|
||||
%y = freeze i32 %x
|
||||
ret i32 %y
|
||||
}
|
||||
|
||||
define i1 @brcond_noopt(i1 %c, i1 %c2) {
|
||||
; CHECK-LABEL: @brcond_noopt(
|
||||
; CHECK-NEXT: [[F:%.*]] = freeze i1 [[C:%.*]]
|
||||
|
|
Loading…
Reference in New Issue