diff options
author | Dan Gohman <gohman@apple.com> | 2008-10-21 03:38:42 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-10-21 03:38:42 +0000 |
commit | 269246b03434a6a2243d47d8826481f734753506 (patch) | |
tree | b8967c9cfdd7e6e8c06764189b6d7d2de0c1eb37 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | d346dfe88109dbf6c2393ff75e7399c91ba514ed (diff) | |
download | bcm5719-llvm-269246b03434a6a2243d47d8826481f734753506.tar.gz bcm5719-llvm-269246b03434a6a2243d47d8826481f734753506.zip |
Don't create TargetGlobalAddress nodes with offsets that don't fit
in the 32-bit signed offset field of addresses. Even though this
may be intended, some linkers refuse to relocate code where the
relocated address computation overflows.
Also, fix the sign-extension of constant offsets to use the
actual pointer size, rather than the size of the GlobalAddress
node, which may be different, for example on x86-64 where MVT::i32
is used when the address is being fit into the 32-bit displacement
field.
llvm-svn: 57885
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 2ad3da03877..7c70cd4d72d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -974,7 +974,7 @@ SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV, unsigned Opc; // Truncate (with sign-extension) the offset value to the pointer size. - unsigned BitWidth = VT.getSizeInBits(); + unsigned BitWidth = TLI.getPointerTy().getSizeInBits(); if (BitWidth < 64) Offset = (Offset << (64 - BitWidth) >> (64 - BitWidth)); |