forked from OSchip/llvm-project
Revert "SimplifyCFG: Clean up optforfuzzing implementation"
See discussion: https://reviews.llvm.org/D89590
This reverts commit cdd006eec9
.
This commit is contained in:
parent
4634ad6c0b
commit
716f7636e1
|
@ -273,14 +273,6 @@ struct CFGSimplifyPass : public FunctionPass {
|
|||
return false;
|
||||
|
||||
Options.AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F);
|
||||
if (F.hasFnAttribute(Attribute::OptForFuzzing)) {
|
||||
Options.setSimplifyCondBranch(false)
|
||||
.setFoldTwoEntryPHINode(false);
|
||||
} else {
|
||||
Options.setSimplifyCondBranch(true)
|
||||
.setFoldTwoEntryPHINode(true);
|
||||
}
|
||||
|
||||
auto &TTI = getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
|
||||
return simplifyFunctionCFG(F, TTI, Options);
|
||||
}
|
||||
|
|
|
@ -2415,6 +2415,9 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
|
|||
// dependence information for this check, but simplifycfg can't keep it up
|
||||
// to date, and this catches most of the cases we care about anyway.
|
||||
BasicBlock *BB = PN->getParent();
|
||||
const Function *Fn = BB->getParent();
|
||||
if (Fn && Fn->hasFnAttribute(Attribute::OptForFuzzing))
|
||||
return false;
|
||||
|
||||
BasicBlock *IfTrue, *IfFalse;
|
||||
Value *IfCond = GetIfCondition(BB, IfTrue, IfFalse);
|
||||
|
@ -6055,7 +6058,8 @@ static BasicBlock *allPredecessorsComeFromSameSource(BasicBlock *BB) {
|
|||
|
||||
bool SimplifyCFGOpt::simplifyCondBranch(BranchInst *BI, IRBuilder<> &Builder) {
|
||||
BasicBlock *BB = BI->getParent();
|
||||
if (!Options.SimplifyCondBranch)
|
||||
const Function *Fn = BB->getParent();
|
||||
if (Fn && Fn->hasFnAttribute(Attribute::OptForFuzzing))
|
||||
return false;
|
||||
|
||||
// Conditional branch
|
||||
|
@ -6270,13 +6274,11 @@ bool SimplifyCFGOpt::simplifyOnce(BasicBlock *BB) {
|
|||
|
||||
IRBuilder<> Builder(BB);
|
||||
|
||||
if (Options.FoldTwoEntryPHINode) {
|
||||
// If there is a trivial two-entry PHI node in this basic block, and we can
|
||||
// eliminate it, do so now.
|
||||
if (auto *PN = dyn_cast<PHINode>(BB->begin()))
|
||||
if (PN->getNumIncomingValues() == 2)
|
||||
Changed |= FoldTwoEntryPHINode(PN, TTI, DL);
|
||||
}
|
||||
// If there is a trivial two-entry PHI node in this basic block, and we can
|
||||
// eliminate it, do so now.
|
||||
if (auto *PN = dyn_cast<PHINode>(BB->begin()))
|
||||
if (PN->getNumIncomingValues() == 2)
|
||||
Changed |= FoldTwoEntryPHINode(PN, TTI, DL);
|
||||
|
||||
Instruction *Terminator = BB->getTerminator();
|
||||
Builder.SetInsertPoint(Terminator);
|
||||
|
|
Loading…
Reference in New Issue