[llvm] 83e6d2e - Revert "[ARM] Always lower direct calls as direct when the outliner is enabled (#66434)"

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 09:47:10 PDT 2023


Author: Jon Roelofs
Date: 2023-09-18T09:45:46-07:00
New Revision: 83e6d2edfcf9e073167529377eaa250795640d35

URL: https://github.com/llvm/llvm-project/commit/83e6d2edfcf9e073167529377eaa250795640d35
DIFF: https://github.com/llvm/llvm-project/commit/83e6d2edfcf9e073167529377eaa250795640d35.diff

LOG: Revert "[ARM] Always lower direct calls as direct when the outliner is enabled (#66434)"

This reverts commit 003bcad9a8b21e15e3786a52b1dafa844075ab84.

ARM folks say it regresses some of their benchmarks:
https://github.com/llvm/llvm-project/pull/66434#issuecomment-1722424162

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetPassConfig.cpp
    llvm/lib/Target/ARM/ARMISelLowering.cpp
    llvm/test/CodeGen/ARM/minsize-call-cse.ll
    llvm/test/CodeGen/ARM/pr42062.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index 94a3264960a3d5c..e6ecbc9b03f7149 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1241,9 +1241,6 @@ void TargetPassConfig::addMachinePasses() {
   addPass(&LiveDebugValuesID);
   addPass(&MachineSanitizerBinaryMetadataID);
 
-  if (EnableMachineOutliner == RunOutliner::NeverOutline)
-    TM->Options.EnableMachineOutliner = false;
-
   if (TM->Options.EnableMachineOutliner &&
       getOptLevel() != CodeGenOptLevel::None &&
       EnableMachineOutliner != RunOutliner::NeverOutline) {

diff  --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index e72ba77d56a1e60..69ef942df1f6e78 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -2395,14 +2395,6 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
                          return isa<Instruction>(U) &&
                                 cast<Instruction>(U)->getParent() == BB;
                        }) > 2;
-      // The indirect call lowering hinders the MachineOutliner's ability to
-      // recognize common sequences. The resulting indirect calls all have the
-      // same target, but the outliner can't tell this a priori, since the
-      // branch target is turned into a register operand, and those can't (yet?)
-      // be assumed to have the same value at runtime.
-      const TargetOptions &Options = DAG.getTarget().Options;
-      if (Options.EnableMachineOutliner)
-        PreferIndirect = false;
     }
   }
   if (isTailCall) {

diff  --git a/llvm/test/CodeGen/ARM/minsize-call-cse.ll b/llvm/test/CodeGen/ARM/minsize-call-cse.ll
index 3a72dd2178f723f..072b76f03ba3ca6 100644
--- a/llvm/test/CodeGen/ARM/minsize-call-cse.ll
+++ b/llvm/test/CodeGen/ARM/minsize-call-cse.ll
@@ -1,17 +1,12 @@
-; RUN: llc < %s | FileCheck %s --check-prefixes=OUTLINER,CHECK
-; RUN: llc -enable-machine-outliner=always < %s | FileCheck %s --check-prefixes=OUTLINER,CHECK
-; RUN: llc -enable-machine-outliner=never < %s  | FileCheck %s --check-prefixes=INDIRECT,CHECK
+; RUN: llc < %s | FileCheck %s
 
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
 target triple = "thumbv7m-arm-none-eabi"
 
 ; CHECK-LABEL: f:
-; OUTLINER: bl g
-; OUTLINER: bl g
-; OUTLINER: bl g
-; INDIRECT: blx r
-; INDIRECT: blx r
-; INDIRECT: blx r
+; CHECK: blx r
+; CHECK: blx r
+; CHECK: blx r
 define void @f() minsize optsize {
 entry:
   call void @g(i32 45, i32 66)

diff  --git a/llvm/test/CodeGen/ARM/pr42062.ll b/llvm/test/CodeGen/ARM/pr42062.ll
index ba7e436a6a751f9..8396f93a62414d9 100644
--- a/llvm/test/CodeGen/ARM/pr42062.ll
+++ b/llvm/test/CodeGen/ARM/pr42062.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -o - %s -enable-machine-outliner=never 2>&1 | FileCheck %s --implicit-check-not=error
+; RUN: llc -o - %s 2>&1 | FileCheck %s --implicit-check-not=error
 target triple = "thumbv8m.base-arm-none-eabi"
 @foo = external global i8
 declare i32 @bar(ptr nocapture, i32, i32, ptr nocapture)


        


More information about the llvm-commits mailing list