[SimplifyCFG] Override options in default constructor
authorArthur Eubanks <aeubanks@google.com>
Tue, 15 Sep 2020 20:03:05 +0000 (13:03 -0700)
committerArthur Eubanks <aeubanks@google.com>
Mon, 21 Sep 2020 23:33:01 +0000 (16:33 -0700)
SimplifyCFG's options should always be overridden by command line flags,
but they mistakenly weren't in the default constructor.

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D87718

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

index 9785621..7c53938 100644 (file)
@@ -34,7 +34,7 @@ public:
   /// 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);
index b0435bf..1798e01 100644 (file)
@@ -232,6 +232,10 @@ static void applyCommandLineOverridesToOptions(SimplifyCFGOptions &Options) {
     Options.SinkCommonInsts = UserSinkCommonInsts;
 }
 
+SimplifyCFGPass::SimplifyCFGPass() : Options() {
+  applyCommandLineOverridesToOptions(Options);
+}
+
 SimplifyCFGPass::SimplifyCFGPass(const SimplifyCFGOptions &Opts)
     : Options(Opts) {
   applyCommandLineOverridesToOptions(Options);
index 051d66e..975107d 100644 (file)
@@ -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) {