[llvm-branch-commits] [llvm] 5e4480b - [ARM] Don't run the block placement pass at O0

Sam Tebbs via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 15 06:04:36 PST 2021


Author: Sam Tebbs
Date: 2021-01-15T13:59:29Z
New Revision: 5e4480b6c0f02beef5ca7f62c3427031872fcd52

URL: https://github.com/llvm/llvm-project/commit/5e4480b6c0f02beef5ca7f62c3427031872fcd52
DIFF: https://github.com/llvm/llvm-project/commit/5e4480b6c0f02beef5ca7f62c3427031872fcd52.diff

LOG: [ARM] Don't run the block placement pass at O0

The block placement pass shouldn't run unless optimisations are enabled.

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

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMBlockPlacement.cpp
    llvm/lib/Target/ARM/ARMTargetMachine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMBlockPlacement.cpp b/llvm/lib/Target/ARM/ARMBlockPlacement.cpp
index fda05f526335..20491273ea5d 100644
--- a/llvm/lib/Target/ARM/ARMBlockPlacement.cpp
+++ b/llvm/lib/Target/ARM/ARMBlockPlacement.cpp
@@ -58,6 +58,8 @@ INITIALIZE_PASS(ARMBlockPlacement, DEBUG_TYPE, "ARM block placement", false,
                 false)
 
 bool ARMBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
+  if (skipFunction(MF.getFunction()))
+      return false;
   const ARMSubtarget &ST = static_cast<const ARMSubtarget &>(MF.getSubtarget());
   if (!ST.hasLOB())
     return false;

diff  --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
index 51399941629a..237ef54c8339 100644
--- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
@@ -553,11 +553,11 @@ void ARMPassConfig::addPreEmitPass() {
     return MF.getSubtarget<ARMSubtarget>().isThumb2();
   }));
 
-  addPass(createARMBlockPlacementPass());
-
-  // Don't optimize barriers at -O0.
-  if (getOptLevel() != CodeGenOpt::None)
+  // Don't optimize barriers or block placement at -O0.
+  if (getOptLevel() != CodeGenOpt::None) {
+    addPass(createARMBlockPlacementPass());
     addPass(createARMOptimizeBarriersPass());
+  }
 }
 
 void ARMPassConfig::addPreEmitPass2() {


        


More information about the llvm-branch-commits mailing list