diff options
author | Juergen Ributzka <juergen@apple.com> | 2014-03-25 18:01:25 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2014-03-25 18:01:25 +0000 |
commit | 631c4914b267a05d58c2c868ea18001e199657fb (patch) | |
tree | 2234271c4951ffa628dddf0cc3e5d5f2665c7438 /llvm/lib | |
parent | 5eef98cf7adad848efae48ea1fdab85578e2991e (diff) | |
download | bcm5719-llvm-631c4914b267a05d58c2c868ea18001e199657fb.tar.gz bcm5719-llvm-631c4914b267a05d58c2c868ea18001e199657fb.zip |
[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.
llvm-svn: 204739
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86TargetTransformInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp index 46a1e16d4f9..80f75cd6b6a 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -798,8 +798,9 @@ unsigned X86TTI::getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, 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; |