[llvm] r319721 - TwoAddressInstructionPass: Trigger -O0 behavior on optnone

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 16:56:14 PST 2017


Author: matze
Date: Mon Dec  4 16:56:14 2017
New Revision: 319721

URL: http://llvm.org/viewvc/llvm-project?rev=319721&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp

Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=319721&r1=319720&r2=319721&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Dec  4 16:56:14 2017
@@ -1661,6 +1661,10 @@ bool TwoAddressInstructionPass::runOnMac
   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;
 




More information about the llvm-commits mailing list