mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-28 07:17:32 +00:00
Add an explicit insert point argument to SplitBlockAndInsertIfThen.
Currently SplitBlockAndInsertIfThen requires that branch condition is an Instruction itself, which is very inconvenient, because it is sometimes an Operator, or even a Constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197677 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -735,10 +735,9 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
|
||||
while (isa<PHINode>(Pos) || isa<AllocaInst>(Pos))
|
||||
Pos = Pos->getNextNode();
|
||||
IRBuilder<> IRB(Pos);
|
||||
Instruction *NeInst = cast<Instruction>(
|
||||
IRB.CreateICmpNE(*i, DFSF.DFS.ZeroShadow));
|
||||
Value *Ne = IRB.CreateICmpNE(*i, DFSF.DFS.ZeroShadow);
|
||||
BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
|
||||
NeInst, /*Unreachable=*/ false, ColdCallWeights));
|
||||
Ne, Pos, /*Unreachable=*/false, ColdCallWeights));
|
||||
IRBuilder<> ThenIRB(BI);
|
||||
ThenIRB.CreateCall(DFSF.DFS.DFSanNonzeroLabelFn);
|
||||
}
|
||||
@@ -838,10 +837,9 @@ Value *DataFlowSanitizer::combineShadows(Value *V1, Value *V2,
|
||||
IRBuilder<> IRB(Pos);
|
||||
BasicBlock *Head = Pos->getParent();
|
||||
Value *Ne = IRB.CreateICmpNE(V1, V2);
|
||||
Instruction *NeInst = dyn_cast<Instruction>(Ne);
|
||||
if (NeInst) {
|
||||
if (Ne) {
|
||||
BranchInst *BI = cast<BranchInst>(SplitBlockAndInsertIfThen(
|
||||
NeInst, /*Unreachable=*/ false, ColdCallWeights));
|
||||
Ne, Pos, /*Unreachable=*/false, ColdCallWeights));
|
||||
IRBuilder<> ThenIRB(BI);
|
||||
CallInst *Call = ThenIRB.CreateCall2(DFSanUnionFn, V1, V2);
|
||||
Call->addAttribute(AttributeSet::ReturnIndex, Attribute::ZExt);
|
||||
|
Reference in New Issue
Block a user