[PATCH] D16809: [JumpThreading] See through Cast Instructions

Balaram Makam via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 12:31:14 PST 2016

bmakam added a subscriber: bmakam.

Comment at: test/Transforms/JumpThreading/basic.ll:493
@@ +492,3 @@
+	%B = phi i32 [1, %Entry], [%v1, %F1]
haicheng wrote:
> gberry wrote:
> > It seems like this change to JumpThreading would not be needed if the Merge block code had been simplified to the following:
> > 
> > ```
> > Merge:
> >   %B = phi i32 [1, %Entry], [%v1, %F1]
> >   %M = icmp eq i32 %B, 0 
> >   br i1 %M, label %T2, label %F2
> > ```
> > 
> > Are we missing this simplification, or is there something more complex going on in the code this was extracted from that prevents it from happening?
> The simplification is missing.  InstCombine can optimize it, but it is called after jumpthreading.
InstSimplify can also optimize it. Have you considered just using the simplified value if the instruction can be simplified? This frequently happens due to phi translation and I think there is an instance where we use this in DuplicateCondBranchOnPHIIntoPred



More information about the llvm-commits mailing list