aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2017-12-05 00:56:14 +0000
committerMatthias Braun <matze@braunis.de>2017-12-05 00:56:14 +0000
commitc67785b60c352984dd14fa82fce86737fafe9deb (patch)
tree3956eb66d10dd72173394dcf56e70bcd45389b56
parentde0aeb800c9dc85ec249e58c56771702a0853e42 (diff)
TwoAddressInstructionPass: Trigger -O0 behavior on optnone
While we cannot skip the whole TwoAddressInstructionPass even for -O0 there are some parts of the pass that are currently skipped at -O0 but not for optnone. Changing this as there is no reason to have those two hit different code paths here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319721 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/TwoAddressInstructionPass.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp
index 28a4375cb28..c51340766b7 100644
--- a/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1661,6 +1661,10 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &Func) {
else
AA = nullptr;
OptLevel = TM.getOptLevel();
+ // Disable optimizations if requested. We cannot skip the whole pass as some
+ // fixups are necessary for correctness.
+ if (skipFunction(*Func.getFunction()))
+ OptLevel = CodeGenOpt::None;
bool MadeChange = false;