[RISCV] Enable merging of external globals by default (#117880)
This follows up #115495 by enabling merging of external globals by default, which had been left as a next step in order to make the previous change more incremental and so we can more easily narrow down on any identified regressions. Enabling merging of external globals matches what Arm does (for non mach-o targets), though AArch64 doesn't as there were [some concerns](https://reviews.llvm.org/D61947) it might cause regressions in some cases. See https://github.com/llvm/llvm-project/pull/117880 for benchmark figures and discussion.
This commit is contained in:
parent
10ad2135ab
commit
3787fbf040
@ -51,13 +51,6 @@ static cl::opt<cl::boolOrDefault>
|
||||
EnableGlobalMerge("riscv-enable-global-merge", cl::Hidden,
|
||||
cl::desc("Enable the global merge pass"));
|
||||
|
||||
static cl::opt<bool> ForceEnableGlobalMergeExternalGlobals(
|
||||
"riscv-force-enable-global-merge-external-globals", cl::Hidden,
|
||||
cl::init(false),
|
||||
cl::desc(
|
||||
"If the global merge pass is enabled, force enable global merging of "
|
||||
"external globals (overriding any logic that might disable it)"));
|
||||
|
||||
static cl::opt<bool>
|
||||
EnableMachineCombiner("riscv-enable-machine-combiner",
|
||||
cl::desc("Enable the machine combiner pass"),
|
||||
@ -494,8 +487,7 @@ bool RISCVPassConfig::addPreISel() {
|
||||
// Investigating and addressing both items are TODO.
|
||||
addPass(createGlobalMergePass(TM, /* MaxOffset */ 2047,
|
||||
/* OnlyOptimizeForSize */ false,
|
||||
/* MergeExternalByDefault */
|
||||
ForceEnableGlobalMergeExternalGlobals));
|
||||
/* MergeExternalByDefault */ true));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1,8 +1,7 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc -mtriple=riscv64 -riscv-force-enable-global-merge-external-globals \
|
||||
; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=SMALL-DATA
|
||||
; RUN: llc -mtriple=riscv64 -global-merge-min-data-size=0 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs < %s \
|
||||
; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
|
||||
; RUN: | FileCheck %s -check-prefix=SMALL-DATA
|
||||
; RUN: llc -mtriple=riscv64 -global-merge-min-data-size=0 -verify-machineinstrs < %s \
|
||||
; RUN: | FileCheck %s -check-prefix=MINSIZE
|
||||
|
||||
@ig1 = internal global i32 0, align 4
|
||||
|
@ -1,8 +1,7 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc -mtriple=riscv32 -riscv-force-enable-global-merge-external-globals \
|
||||
; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=SMALL-DATA
|
||||
; RUN: llc -mtriple=riscv64 -global-merge-min-data-size=5 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs < %s \
|
||||
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
|
||||
; RUN: | FileCheck %s -check-prefix=SMALL-DATA
|
||||
; RUN: llc -mtriple=riscv64 -global-merge-min-data-size=5 -verify-machineinstrs < %s \
|
||||
; RUN: | FileCheck %s -check-prefix=MINSIZE
|
||||
|
||||
@ig1 = internal global i32 0, align 4
|
||||
|
@ -1,8 +1,8 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc -mtriple=riscv32 -riscv-force-enable-global-merge-external-globals \
|
||||
; RUN: llc -mtriple=riscv32 \
|
||||
; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=RV32
|
||||
; RUN: llc -mtriple=riscv32 -global-merge-min-data-size=5 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs < %s | FileCheck %s -check-prefix=RV32-MINSIZE
|
||||
; RUN: -verify-machineinstrs < %s | FileCheck %s -check-prefix=RV32-MINSIZE
|
||||
|
||||
@ig1 = internal global i32 0, align 4
|
||||
@ig2 = internal global i32 0, align 4
|
||||
|
@ -1,12 +1,12 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: sed 's/ArrSize/100/g' %s | llc -mtriple=riscv32 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs | FileCheck %s
|
||||
; RUN: -verify-machineinstrs | FileCheck %s
|
||||
; RUN: sed 's/ArrSize/100/g' %s | llc -mtriple=riscv64 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs | FileCheck %s
|
||||
; RUN: -verify-machineinstrs | FileCheck %s
|
||||
; RUN: sed 's/ArrSize/101/g' %s | llc -mtriple=riscv32 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs | FileCheck %s -check-prefix=CHECK-TOOBIG
|
||||
; RUN: -verify-machineinstrs | FileCheck %s -check-prefix=CHECK-TOOBIG
|
||||
; RUN: sed 's/ArrSize/101/g' %s | llc -mtriple=riscv64 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs | FileCheck %s -check-prefix=CHECK-TOOBIG
|
||||
; RUN: -verify-machineinstrs | FileCheck %s -check-prefix=CHECK-TOOBIG
|
||||
|
||||
; This test demonstrates that the MaxOffset is set correctly for RISC-V by
|
||||
; constructing an input that is at the limit and comparing.
|
||||
|
@ -1,11 +1,11 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s | FileCheck %s
|
||||
; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s | FileCheck %s
|
||||
; RUN: llc -mtriple=riscv32 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs < %s \
|
||||
; RUN: llc -mtriple=riscv32 -global-merge-on-external=false \
|
||||
; RUN: -verify-machineinstrs < %s | FileCheck %s
|
||||
; RUN: llc -mtriple=riscv64 -global-merge-on-external=false \
|
||||
; RUN: -verify-machineinstrs < %s | FileCheck %s
|
||||
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
|
||||
; RUN: | FileCheck -check-prefix=CHECK-WEXTERN %s
|
||||
; RUN: llc -mtriple=riscv64 \
|
||||
; RUN: -riscv-force-enable-global-merge-external-globals -verify-machineinstrs < %s \
|
||||
; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
|
||||
; RUN: | FileCheck -check-prefix=CHECK-WEXTERN %s
|
||||
|
||||
@ig1 = internal global i32 0, align 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user