[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/

Evan Cheng evan.cheng at apple.com
Wed Feb 2 10:17:27 PST 2011


On Feb 2, 2011, at 9:17 AM, Bob Wilson wrote:

> 
> On Jan 28, 2011, at 8:46 PM, Evan Cheng wrote:
> 
>> Author: evancheng
>> Date: Fri Jan 28 22:46:23 2011
>> New Revision: 124526
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=124526&view=rev
>> Log:
>> Re-apply r124518 with fix. Watch out for invalidated iterator.
>> 
>> 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.

Evan



More information about the llvm-commits mailing list