summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-26 21:14:05 +0000
committerChris Lattner <sabre@nondot.org>2009-06-26 21:14:05 +0000
commitbc60c14c9743da1dae32471e3c18b80a949cc6cf (patch)
tree83db17140a6d9958f2fd280f9c4485bd4f89591f /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentea12f6ebb5d8c7c2039566938cfb14318ebc554b (diff)
downloadbcm5719-llvm-bc60c14c9743da1dae32471e3c18b80a949cc6cf.tar.gz
bcm5719-llvm-bc60c14c9743da1dae32471e3c18b80a949cc6cf.zip
fix a really subtle bug in the cross section of aliases and TLS:
the SelectionDAG::getGlobalAddress function properly looks through aliases to determine thread-localness, but then passes the GV* down to GlobalAddressSDNode::GlobalAddressSDNode which does not. Instead of passing down isTarget, just pass down the predetermined node opcode. This fixes some assertions with out of tree changes I'm working on. llvm-svn: 74325
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 200fc84fdec..0ab14731ae4 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -996,7 +996,7 @@ SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV,
if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
return SDValue(E, 0);
SDNode *N = NodeAllocator.Allocate<GlobalAddressSDNode>();
- new (N) GlobalAddressSDNode(isTargetGA, GV, VT, Offset, TargetFlags);
+ new (N) GlobalAddressSDNode(Opc, GV, VT, Offset, TargetFlags);
CSEMap.InsertNode(N, IP);
AllNodes.push_back(N);
return SDValue(N, 0);
@@ -4935,15 +4935,9 @@ HandleSDNode::~HandleSDNode() {
DropOperands();
}
-GlobalAddressSDNode::GlobalAddressSDNode(bool isTarget, const GlobalValue *GA,
+GlobalAddressSDNode::GlobalAddressSDNode(unsigned Opc, const GlobalValue *GA,
MVT VT, int64_t o, unsigned char TF)
- : SDNode(isa<GlobalVariable>(GA) &&
- cast<GlobalVariable>(GA)->isThreadLocal() ?
- // Thread Local
- (isTarget ? ISD::TargetGlobalTLSAddress : ISD::GlobalTLSAddress) :
- // Non Thread Local
- (isTarget ? ISD::TargetGlobalAddress : ISD::GlobalAddress),
- DebugLoc::getUnknownLoc(), getSDVTList(VT)),
+ : SDNode(Opc, DebugLoc::getUnknownLoc(), getSDVTList(VT)),
Offset(o), TargetFlags(TF) {
TheGlobal = const_cast<GlobalValue*>(GA);
}
OpenPOWER on IntegriCloud