[PATCH] D75401: [ValueTracking] Let isGuaranteedNotToBeUndefOrPoison look into branch conditions of dominating blocks' terminators
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 10:21:02 PST 2020
jdoerfert added a comment.
You might need to check if the branch "must-be-executed" from the `CtxI`. See the example.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4563
+ if (CxtI) {
+ // If V is used as a branch condition before reaching CxtI, V cannot be
----------------
Style: early exit `!CtxI`.
================
Comment at: llvm/test/Transforms/InstSimplify/freeze.ll:58
+ ret i32 %fr
+}
----------------
@sanjoy Did have a point (I think). What happens if you have:
```
declare void @use(i1 %f) willreturn nounwind
declare void @exit()
define i1 @brcond_never_reached(i1 %c, i1 %c2) {
%f = freeze i1 %c
call void @use(i1 %f)
call void exit();
call void @use(i1 %f)
br i1 %c, label %A, label %B
A:
br i1 %c2, label %A2, label %B
A2:
ret i1 %f
B:
ret i1 %f
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75401/new/
https://reviews.llvm.org/D75401
More information about the llvm-commits
mailing list