aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/XCore
diff options
context:
space:
mode:
authorYoungsuk Kim <youngsuk.kim@hpe.com>2023-11-13 14:14:56 -0600
committerYoungsuk Kim <youngsuk.kim@hpe.com>2023-11-13 14:33:41 -0600
commiteed067e9fb9602cac07b1b5166cd4a05b368262f (patch)
treea555c662eaa764b15f63361a1e628b641d27db29 /llvm/lib/Target/XCore
parent2c65860667e202e182264d5c6dfe4c2961542f7d (diff)
downloadllvm-eed067e9fb9602cac07b1b5166cd4a05b368262f.zip
llvm-eed067e9fb9602cac07b1b5166cd4a05b368262f.tar.gz
llvm-eed067e9fb9602cac07b1b5166cd4a05b368262f.tar.bz2
[llvm] Remove no-op ptr-to-ptr bitcasts (NFC)
Opaque ptr cleanup effort (NFC).
Diffstat (limited to 'llvm/lib/Target/XCore')
-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());