[PATCH] D75401: [ValueTracking] Let isGuaranteedNotToBeUndefOrPoison look into branch conditions of dominating blocks' terminators

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 19:03:23 PST 2020


aqjune marked 3 inline comments as done.
aqjune added inline comments.


================
Comment at: llvm/test/Transforms/InstSimplify/freeze.ll:58
+  ret i32 %fr
+}
----------------
jdoerfert wrote:
> @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
> }
> 
The first `use(f)` cannot be optimized `use(c)`. I added a test for this case.


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