Skip to content

Commit eaf7c1d

Browse files
nikicjustinfargnoli
authored andcommitted
[RewriteStatepointsForGC] Remove unnecessary bitcasts (NFCI)
1 parent 8fb6ceb commit eaf7c1d

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,19 +1975,10 @@ insertRelocationStores(iterator_range<Value::user_iterator> GCRelocs,
19751975
assert(AllocaMap.count(OriginalValue));
19761976
Value *Alloca = AllocaMap[OriginalValue];
19771977

1978-
// Emit store into the related alloca
1979-
// All gc_relocates are i8 addrspace(1)* typed, and it must be bitcasted to
1980-
// the correct type according to alloca.
1978+
// Emit store into the related alloca.
19811979
assert(Relocate->getNextNode() &&
19821980
"Should always have one since it's not a terminator");
1983-
IRBuilder<> Builder(Relocate->getNextNode());
1984-
Value *CastedRelocatedValue =
1985-
Builder.CreateBitCast(Relocate,
1986-
cast<AllocaInst>(Alloca)->getAllocatedType(),
1987-
suffixed_name_or(Relocate, ".casted", ""));
1988-
1989-
new StoreInst(CastedRelocatedValue, Alloca,
1990-
cast<Instruction>(CastedRelocatedValue)->getNextNode());
1981+
new StoreInst(Relocate, Alloca, Relocate->getNextNode());
19911982

19921983
#ifndef NDEBUG
19931984
VisitedLiveValues.insert(OriginalValue);
@@ -2620,13 +2611,9 @@ static bool inlineGetBaseAndOffset(Function &F,
26202611
Value *Base =
26212612
findBasePointer(Callsite->getOperand(0), DVCache, KnownBases);
26222613
assert(!DVCache.count(Callsite));
2623-
auto *BaseBC = IRBuilder<>(Callsite).CreateBitCast(
2624-
Base, Callsite->getType(), suffixed_name_or(Base, ".cast", ""));
2625-
if (BaseBC != Base)
2626-
DVCache[BaseBC] = Base;
2627-
Callsite->replaceAllUsesWith(BaseBC);
2628-
if (!BaseBC->hasName())
2629-
BaseBC->takeName(Callsite);
2614+
Callsite->replaceAllUsesWith(Base);
2615+
if (!Base->hasName())
2616+
Base->takeName(Callsite);
26302617
Callsite->eraseFromParent();
26312618
break;
26322619
}

0 commit comments

Comments
 (0)