[llvm-commits] [PATCH] Don't PRE compares

Chris Lattner clattner at apple.com
Thu Mar 8 16:10:31 PST 2012


On Mar 8, 2012, at 3:35 PM, Jakob Stoklund Olesen wrote:

>> 
>> Makes sense to me.  Are there any cases where PRE'ing the compare could cause it to constant fold to true or false in all predecessors?  If so, then we'd like to keep PRE'ing in that case to enable jump threading.
> 
> I don't think so, but it depends on the pass ordering.
> 
> GVN's PRE will never duplicate an instruction, it will only move it if it is missing in exactly one predecessor, and available in all other predecessors. Wouldn't the compares in the other predecessors already have been constant folded if they could?

Yes, that make sense.  Ok.

-Chris

> 
> PRE only creates a new opportunity for constant folding in the predecessor the gets the new instruction.
> 
> In the present test case, the compare is constant folded by value propagation which runs after jump threading.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120308/9161044f/attachment.html>


More information about the llvm-commits mailing list