Skip to content

Commit f432a00

Browse files
committed
[llvm] Remove no-op ptr-to-ptr bitcasts (NFC)
Opaque ptr cleanup effort (NFC).
1 parent 9570364 commit f432a00

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2899,11 +2899,7 @@ Error BitcodeReader::resolveGlobalAndIndirectSymbolInits() {
28992899
return error("Alias and aliasee types don't match");
29002900
GA->setAliasee(C);
29012901
} else if (auto *GI = dyn_cast<GlobalIFunc>(GV)) {
2902-
Type *ResolverFTy =
2903-
GlobalIFunc::getResolverFunctionType(GI->getValueType());
2904-
// Transparently fix up the type for compatibility with older bitcode
2905-
GI->setResolver(ConstantExpr::getBitCast(
2906-
C, ResolverFTy->getPointerTo(GI->getAddressSpace())));
2902+
GI->setResolver(C);
29072903
} else {
29082904
return error("Expected an alias or an ifunc");
29092905
}

llvm/lib/CodeGen/SjLjEHPrepare.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ Value *SjLjEHPrepare::setupFunctionContext(Function &F,
218218
Value *PersonalityFn = F.getPersonalityFn();
219219
Value *PersonalityFieldPtr = Builder.CreateConstGEP2_32(
220220
FunctionContextTy, FuncCtx, 0, 3, "pers_fn_gep");
221-
Builder.CreateStore(Builder.CreateBitCast(PersonalityFn, Builder.getPtrTy()),
222-
PersonalityFieldPtr, /*isVolatile=*/true);
221+
Builder.CreateStore(PersonalityFn, PersonalityFieldPtr, /*isVolatile=*/true);
223222

224223
// LSDA address
225224
Value *LSDA = Builder.CreateCall(LSDAAddrFn, {}, "lsda_addr");
@@ -417,8 +416,7 @@ bool SjLjEHPrepare::setupEntryBlockAndCallSites(Function &F) {
417416

418417
// Store a pointer to the function context so that the back-end will know
419418
// where to look for it.
420-
Value *FuncCtxArg = Builder.CreateBitCast(FuncCtx, Builder.getPtrTy());
421-
Builder.CreateCall(FuncCtxFn, FuncCtxArg);
419+
Builder.CreateCall(FuncCtxFn, FuncCtx);
422420

423421
// At this point, we are all set up, update the invoke instructions to mark
424422
// their call_site values.

llvm/lib/Transforms/Utils/LowerMemIntrinsics.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,11 +446,6 @@ static void createMemSetLoop(Instruction *InsertBefore, Value *DstAddr,
446446

447447
IRBuilder<> Builder(OrigBB->getTerminator());
448448

449-
// Cast pointer to the type of value getting stored
450-
unsigned dstAS = cast<PointerType>(DstAddr->getType())->getAddressSpace();
451-
DstAddr = Builder.CreateBitCast(DstAddr,
452-
PointerType::get(SetValue->getType(), dstAS));
453-
454449
Builder.CreateCondBr(
455450
Builder.CreateICmpEQ(ConstantInt::get(TypeOfCopyLen, 0), CopyLen), NewBB,
456451
LoopBB);

0 commit comments

Comments
 (0)