[PATCH] D89590: [NPM][SimplifyCFGPass] For OptForFuzzing attribute, disable SimplifyCondBranch and FoldTwoEntryPHINode in NPM

Zequan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 13:11:26 PDT 2020


zequanwu created this revision.
zequanwu added reviewers: aeubanks, arsenm, asbirlea, ychen.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
zequanwu requested review of this revision.
Herald added a subscriber: wdng.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89590

Files:
  llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp


Index: llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -245,6 +245,10 @@
                                        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: D89590.298733.patch
Type: text/x-patch
Size: 732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201016/58f98130/attachment.bin>


More information about the llvm-commits mailing list