[llvm] 1747f77 - [SimplifyCFG] Override options in default constructor
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 16:33:13 PDT 2020
Author: Arthur Eubanks
Date: 2020-09-21T16:33:01-07:00
New Revision: 1747f7776403626b23ef0389264643fe4d6bec17
URL: https://github.com/llvm/llvm-project/commit/1747f7776403626b23ef0389264643fe4d6bec17
DIFF: https://github.com/llvm/llvm-project/commit/1747f7776403626b23ef0389264643fe4d6bec17.diff
LOG: [SimplifyCFG] Override options in default constructor
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
Added:
Modified:
llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
llvm/test/Transforms/SimplifyCFG/HoistCode.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h b/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
index 978562186eba..7c5393851ae6 100644
--- a/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
+++ b/llvm/include/llvm/Transforms/Scalar/SimplifyCFG.h
@@ -34,7 +34,7 @@ class SimplifyCFGPass : public PassInfoMixin<SimplifyCFGPass> {
/// rather than optimal IR. That is, by default we bypass transformations that
/// are likely to improve performance but make analysis for other passes more
///
diff icult.
- SimplifyCFGPass() {}
+ SimplifyCFGPass();
/// Construct a pass with optional optimizations.
SimplifyCFGPass(const SimplifyCFGOptions &PassOptions);
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index b0435bf6e4ea..1798e017bfad 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -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);
diff --git a/llvm/test/Transforms/SimplifyCFG/HoistCode.ll b/llvm/test/Transforms/SimplifyCFG/HoistCode.ll
index 051d66ee752f..975107da4928 100644
--- a/llvm/test/Transforms/SimplifyCFG/HoistCode.ll
+++ b/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) {
More information about the llvm-commits
mailing list