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

Jakob Stoklund Olesen jolesen at apple.com
Thu Mar 8 10:53:09 PST 2012


The attached patch stops GVN from eliminating partially redundant compare instructions.

CodeGenPrepare sinks compares to their uses so that they can be fused with branches in isel. The phi node inserted by PRE prevents the sinking, and increases register pressure by forcing the i1 value into a general purpose register.

There is no way for CodeGenPrepare to figure this out on its own. Run the included test case through opt -O2 to see how value propagation messes with the i1 phi:

  %cmp3.pre-phi = phi i1 [ %cmp1, %if.then ], [ false, %entry ]

Owen suggested a more radical approach: Don't PRE instructions that have a single use in the same block. It solves a more general version of the same problem: PRE separates instructions that the code generator might have been able to fuse.

Thoughts?

/jakob


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Don-t-PRE-compares.patch
Type: application/octet-stream
Size: 4225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120308/9db06988/attachment.obj>


More information about the llvm-commits mailing list