Skip to content

Commit 3f22570

Browse files
committed
[llvm][InstrProfiling] Remove ptr-to-ptr bitcasts (NFC)
Opaque ptr cleanup effort (NFC).
1 parent 7d1a9e8 commit 3f22570

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -670,15 +670,11 @@ void InstrProfiling::lowerValueProfileInst(InstrProfValueProfileInst *Ind) {
670670
SmallVector<OperandBundleDef, 1> OpBundles;
671671
Ind->getOperandBundlesAsDefs(OpBundles);
672672
if (!IsMemOpSize) {
673-
Value *Args[3] = {Ind->getTargetValue(),
674-
Builder.CreateBitCast(DataVar, Builder.getPtrTy()),
675-
Builder.getInt32(Index)};
673+
Value *Args[3] = {Ind->getTargetValue(), DataVar, Builder.getInt32(Index)};
676674
Call = Builder.CreateCall(getOrInsertValueProfilingCall(*M, *TLI), Args,
677675
OpBundles);
678676
} else {
679-
Value *Args[3] = {Ind->getTargetValue(),
680-
Builder.CreateBitCast(DataVar, Builder.getPtrTy()),
681-
Builder.getInt32(Index)};
677+
Value *Args[3] = {Ind->getTargetValue(), DataVar, Builder.getInt32(Index)};
682678
Call = Builder.CreateCall(
683679
getOrInsertValueProfilingCall(*M, *TLI, ValueProfilingCallType::MemOp),
684680
Args, OpBundles);
@@ -1484,10 +1480,10 @@ void InstrProfiling::emitRegistration() {
14841480
IRBuilder<> IRB(BasicBlock::Create(M->getContext(), "", RegisterF));
14851481
for (Value *Data : CompilerUsedVars)
14861482
if (!isa<Function>(Data))
1487-
IRB.CreateCall(RuntimeRegisterF, IRB.CreateBitCast(Data, VoidPtrTy));
1483+
IRB.CreateCall(RuntimeRegisterF, Data);
14881484
for (Value *Data : UsedVars)
14891485
if (Data != NamesVar && !isa<Function>(Data))
1490-
IRB.CreateCall(RuntimeRegisterF, IRB.CreateBitCast(Data, VoidPtrTy));
1486+
IRB.CreateCall(RuntimeRegisterF, Data);
14911487

14921488
if (NamesVar) {
14931489
Type *ParamTypes[] = {VoidPtrTy, Int64Ty};
@@ -1496,8 +1492,7 @@ void InstrProfiling::emitRegistration() {
14961492
auto *NamesRegisterF =
14971493
Function::Create(NamesRegisterTy, GlobalVariable::ExternalLinkage,
14981494
getInstrProfNamesRegFuncName(), M);
1499-
IRB.CreateCall(NamesRegisterF, {IRB.CreateBitCast(NamesVar, VoidPtrTy),
1500-
IRB.getInt64(NamesSize)});
1495+
IRB.CreateCall(NamesRegisterF, {NamesVar, IRB.getInt64(NamesSize)});
15011496
}
15021497

15031498
IRB.CreateRetVoid();

0 commit comments

Comments
 (0)