[PATCH] D87718: [SimplifyCFG] Override options in default constructor

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 13:08:55 PDT 2020


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

SimplifyCFG's options should always be overridden by command line flags,
but they mistakenly weren't in the default constructor.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87718

Files:
  llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
  llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
  llvm/test/Transforms/SimplifyCFG/HoistCode.ll


Index: llvm/test/Transforms/SimplifyCFG/HoistCode.ll
===================================================================
--- llvm/test/Transforms/SimplifyCFG/HoistCode.ll
+++ llvm/test/Transforms/SimplifyCFG/HoistCode.ll
@@ -1,4 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=simplifycfg -hoist-common-insts=true -S | FileCheck %s
 ; RUN: opt < %s -simplifycfg -hoist-common-insts=true -S | FileCheck %s
 
 define void @foo(i1 %C, i32* %P) {
Index: llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -232,6 +232,10 @@
     Options.SinkCommonInsts = UserSinkCommonInsts;
 }
 
+SimplifyCFGPass::SimplifyCFGPass() : Options() {
+  applyCommandLineOverridesToOptions(Options);
+}
+
 SimplifyCFGPass::SimplifyCFGPass(const SimplifyCFGOptions &Opts)
     : Options(Opts) {
   applyCommandLineOverridesToOptions(Options);
Index: llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
===================================================================
--- llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
+++ llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
@@ -34,7 +34,7 @@
   /// rather than optimal IR. That is, by default we bypass transformations that
   /// are likely to improve performance but make analysis for other passes more
   /// difficult.
-  SimplifyCFGPass() {}
+  SimplifyCFGPass();
 
   /// Construct a pass with optional optimizations.
   SimplifyCFGPass(const SimplifyCFGOptions &PassOptions);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87718.292007.patch
Type: text/x-patch
Size: 1637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/c103a461/attachment.bin>


More information about the llvm-commits mailing list