mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 01:55:08 +00:00
[dfsan] Simplify code after r197677.
llvm-svn: 197679
This commit is contained in:
parent
cf3b4836bd
commit
a284e559d7
@ -837,25 +837,20 @@ Value *DataFlowSanitizer::combineShadows(Value *V1, Value *V2,
|
||||
IRBuilder<> IRB(Pos);
|
||||
BasicBlock *Head = Pos->getParent();
|
||||
Value *Ne = IRB.CreateICmpNE(V1, V2);
|
||||
if (Ne) {
|
||||
BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
|
||||
Ne, Pos, /*Unreachable=*/false, ColdCallWeights));
|
||||
IRBuilder<> ThenIRB(BI);
|
||||
CallInst *Call = ThenIRB.CreateCall2(DFSanUnionFn, V1, V2);
|
||||
Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
|
||||
Call->addAttribute(1, Attribute::ZExt);
|
||||
Call->addAttribute(2, Attribute::ZExt);
|
||||
BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
|
||||
Ne, Pos, /*Unreachable=*/false, ColdCallWeights));
|
||||
IRBuilder<> ThenIRB(BI);
|
||||
CallInst *Call = ThenIRB.CreateCall2(DFSanUnionFn, V1, V2);
|
||||
Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
|
||||
Call->addAttribute(1, Attribute::ZExt);
|
||||
Call->addAttribute(2, Attribute::ZExt);
|
||||
|
||||
BasicBlock *Tail = BI->getSuccessor(0);
|
||||
PHINode *Phi = PHINode::Create(ShadowTy, 2, "", Tail->begin());
|
||||
Phi->addIncoming(Call, Call->getParent());
|
||||
Phi->addIncoming(V1, Head);
|
||||
Pos = Phi;
|
||||
return Phi;
|
||||
} else {
|
||||
assert(0 && "todo");
|
||||
return 0;
|
||||
}
|
||||
BasicBlock *Tail = BI->getSuccessor(0);
|
||||
PHINode *Phi = PHINode::Create(ShadowTy, 2, "", Tail->begin());
|
||||
Phi->addIncoming(Call, Call->getParent());
|
||||
Phi->addIncoming(V1, Head);
|
||||
Pos = Phi;
|
||||
return Phi;
|
||||
}
|
||||
|
||||
// A convenience function which folds the shadows of each of the operands
|
||||
|
Loading…
Reference in New Issue
Block a user