mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[GCRoot] Assert preconditions to clarify behavior
This code isn't reachable if the GFI (GCFunctionInfo*) is null. Clarify this by adding an assert and removing an always taken if. llvm-svn: 257724
This commit is contained in:
parent
1fc090e6ed
commit
d695d6345f
@ -5060,15 +5060,19 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
getValue(I.getArgOperand(0))));
|
||||
return nullptr;
|
||||
}
|
||||
case Intrinsic::gcroot:
|
||||
if (GFI) {
|
||||
const Value *Alloca = I.getArgOperand(0)->stripPointerCasts();
|
||||
const Constant *TypeMap = cast<Constant>(I.getArgOperand(1));
|
||||
case Intrinsic::gcroot: {
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
const Function *F = MF.getFunction();
|
||||
assert(F->hasGC() &&
|
||||
"only valid in functions with gc specified, enforced by Verifier");
|
||||
assert(GFI && "implied by previous");
|
||||
const Value *Alloca = I.getArgOperand(0)->stripPointerCasts();
|
||||
const Constant *TypeMap = cast<Constant>(I.getArgOperand(1));
|
||||
|
||||
FrameIndexSDNode *FI = cast<FrameIndexSDNode>(getValue(Alloca).getNode());
|
||||
GFI->addStackRoot(FI->getIndex(), TypeMap);
|
||||
}
|
||||
FrameIndexSDNode *FI = cast<FrameIndexSDNode>(getValue(Alloca).getNode());
|
||||
GFI->addStackRoot(FI->getIndex(), TypeMap);
|
||||
return nullptr;
|
||||
}
|
||||
case Intrinsic::gcread:
|
||||
case Intrinsic::gcwrite:
|
||||
llvm_unreachable("GC failed to lower gcread/gcwrite intrinsics!");
|
||||
|
Loading…
Reference in New Issue
Block a user