[PATCH] D91473: [SimplifyCFG] Respect optforfuzzing in NPM pass
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 13 18:37:11 PST 2020
aeubanks created this revision.
aeubanks added reviewers: zequanwu, arsenm, lebedev.ri, morehouse.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
aeubanks requested review of this revision.
Herald added a subscriber: wdng.
Regression caused by refactoring in
cdd006eec9409923f9a56b9026ce2cb72e7b71dc <https://reviews.llvm.org/rGcdd006eec9409923f9a56b9026ce2cb72e7b71dc>.
See discussion in https://reviews.llvm.org/D89917.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D91473
Files:
llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
llvm/test/Transforms/SimplifyCFG/opt-for-fuzzing.ll
Index: llvm/test/Transforms/SimplifyCFG/opt-for-fuzzing.ll
===================================================================
--- llvm/test/Transforms/SimplifyCFG/opt-for-fuzzing.ll
+++ llvm/test/Transforms/SimplifyCFG/opt-for-fuzzing.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -simplifycfg -S | FileCheck %s
+; RUN: opt < %s -passes=simplifycfg -S | FileCheck %s
define i32 @foo(i32 %x) optforfuzzing {
entry:
Index: llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -245,6 +245,11 @@
FunctionAnalysisManager &AM) {
auto &TTI = AM.getResult<TargetIRAnalysis>(F);
Options.AC = &AM.getResult<AssumptionAnalysis>(F);
+ if (F.hasFnAttribute(Attribute::OptForFuzzing)) {
+ Options.setSimplifyCondBranch(false).setFoldTwoEntryPHINode(false);
+ } else {
+ Options.setSimplifyCondBranch(true).setFoldTwoEntryPHINode(true);
+ }
if (!simplifyFunctionCFG(F, TTI, Options))
return PreservedAnalyses::all();
PreservedAnalyses PA;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91473.305290.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201114/6c80f7e8/attachment.bin>
More information about the llvm-commits
mailing list