aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/XCore/XCoreISelLowering.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp
index 4f4fccd..b3dd4de 100644
--- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp
+++ b/llvm/lib/Target/XCore/XCoreISelLowering.cpp
@@ -292,12 +292,10 @@ LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const
return GA;
} else {
// Ideally we would not fold in offset with an index <= 11.
- Type *Ty = PointerType::getUnqual(*DAG.getContext());
- Constant *GA = ConstantExpr::getBitCast(const_cast<GlobalValue*>(GV), Ty);
- Ty = Type::getInt32Ty(*DAG.getContext());
+ Type *Ty = Type::getInt32Ty(*DAG.getContext());
Constant *Idx = ConstantInt::get(Ty, Offset);
Constant *GAI = ConstantExpr::getGetElementPtr(
- Type::getInt8Ty(*DAG.getContext()), GA, Idx);
+ Type::getInt8Ty(*DAG.getContext()), const_cast<GlobalValue *>(GV), Idx);
SDValue CP = DAG.getConstantPool(GAI, MVT::i32);
return DAG.getLoad(getPointerTy(DAG.getDataLayout()), DL,
DAG.getEntryNode(), CP, MachinePointerInfo());