[llvm] r204739 - [X86TTI] Make constant base pointers for getElementPtr opaque.
Juergen Ributzka
juergen at apple.com
Wed Apr 2 14:52:37 PDT 2014
Add comments and test case in r205468.
On Mar 31, 2014, at 4:13 PM, Eric Christopher <echristo at gmail.com> wrote:
> Testcase? Comment? Anything?
>
> -eric
>
> On Tue, Mar 25, 2014 at 11:01 AM, Juergen Ributzka <juergen at apple.com> wrote:
>> Author: ributzka
>> Date: Tue Mar 25 13:01:25 2014
>> New Revision: 204739
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=204739&view=rev
>> Log:
>> [X86TTI] Make constant base pointers for getElementPtr opaque.
>>
>> If getElementPtr uses a constant as base pointer, then make the constant opaque.
>> This prevents constant folding it with the offset. The offset can usually be
>> encoded in the load/store instruction itself and the base address doesn't have
>> to be rematerialized several times.
>>
>> Modified:
>> llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp
>>
>> Modified: llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=204739&r1=204738&r2=204739&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp (original)
>> +++ llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp Tue Mar 25 13:01:25 2014
>> @@ -798,8 +798,9 @@ unsigned X86TTI::getIntImmCost(unsigned
>> switch (Opcode) {
>> default: return TCC_Free;
>> case Instruction::GetElementPtr:
>> - if (Idx != 0)
>> - return TCC_Free;
>> + if (Idx == 0)
>> + return 2 * TCC_Basic;
>> + return TCC_Free;
>> case Instruction::Store:
>> ImmIdx = 0;
>> break;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list