fix rdar://8453210, a crash handling a call through a GS relative load.
For now, just disable folding the load into the call.
llvm-svn: 114386
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 0e650c0..ad51541 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -403,6 +403,12 @@
LD->getExtensionType() != ISD::NON_EXTLOAD)
return false;
+ // FIXME: Calls can't fold loads through segment registers yet.
+ if (const Value *Src = LD->getSrcValue())
+ if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
+ if (PT->getAddressSpace() >= 256)
+ return false;
+
// Now let's find the callseq_start.
while (HasCallSeq && Chain.getOpcode() != ISD::CALLSEQ_START) {
if (!Chain.hasOneUse())
@@ -563,7 +569,7 @@
SDValue Address = N.getOperand(1);
if (Address.getOpcode() == X86ISD::SegmentBaseAddress &&
- !MatchSegmentBaseAddress (Address, AM))
+ !MatchSegmentBaseAddress(Address, AM))
return false;
return true;