[llvm-commits] [llvm] r124526 - in /llvm/trunk: include/llvm/Transforms/Utils/ lib/CodeGen/ lib/Transforms/Scalar/ lib/Transforms/Utils/ test/CodeGen/X86/ test/Transforms/JumpThreading/ test/Transforms/SimplifyCFG/

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Feb 2 10:30:00 PST 2011


On Feb 2, 2011, at 10:17 AM, Evan Cheng wrote:

> 
> On Feb 2, 2011, at 9:17 AM, Bob Wilson wrote:
> 
>> 
>> On Jan 28, 2011, at 8:46 PM, Evan Cheng wrote:
>>> Modified: llvm/trunk/lib/CodeGen/TailDuplication.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplication.cpp?rev=124526&r1=124525&r2=124526&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/TailDuplication.cpp (original)
>>> +++ llvm/trunk/lib/CodeGen/TailDuplication.cpp Fri Jan 28 22:46:23 2011
>>> @@ -502,7 +505,7 @@
>>> }
>>> // Heuristically, don't tail-duplicate calls if it would expand code size,
>>> // as it's less likely to be worth the extra cost.
>>> -  if (InstrCount > 1 && HasCall)
>>> +  if (InstrCount > 1 && (PreRegAlloc && HasCall))
>> 
>> What is this change for?  The other tail duplication change in this patch enables the pre-RA pass to handle returns, and I understand that part of it.  This part changes the post-RA tail dup pass to be more aggressive duplicating blocks with calls, and I don't see the connection between that and the rest of your patch.  If there's a good reason for this, could you add a comment to explain?
> 
> I was looking at a test case and didn't quite understand why calls are not being duplicated. I assume the reason is that call is often a register allocation barrier. Before register allocation, there is no way to know whether the call would cause register spills around it.

After register allocation, a call still takes a long time to execute, so the relative benefit of duplicating the block is quite small.

Did this help a test case?

/jakob





More information about the llvm-commits mailing list