summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-10-21 03:38:42 +0000
committerDan Gohman <gohman@apple.com>2008-10-21 03:38:42 +0000
commit269246b03434a6a2243d47d8826481f734753506 (patch)
treeb8967c9cfdd7e6e8c06764189b6d7d2de0c1eb37 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentd346dfe88109dbf6c2393ff75e7399c91ba514ed (diff)
downloadbcm5719-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.cpp2
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));
OpenPOWER on IntegriCloud