]> granicus.if.org Git - llvm/commitdiff
TwoAddressInstructionPass: Trigger -O0 behavior on optnone
authorMatthias Braun <matze@braunis.de>
Tue, 5 Dec 2017 00:56:14 +0000 (00:56 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 5 Dec 2017 00:56:14 +0000 (00:56 +0000)
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

lib/CodeGen/TwoAddressInstructionPass.cpp

index 28a4375cb28b60675c70117f3834f0d68f4bb48a..c51340766b798dbc0362481b0d9a6d01970749ca 100644 (file)
@@ -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;