forked from OSchip/llvm-project
[CodeGen] Split -enable-global-merge into ARM and AArch64 options.
Currently, there's a single flag, checked by the pass itself. It can't force-enable the pass (and is on by default), because it might not even have been created, as that's the targets decision. Instead, have separate explicit flags, so that the decision is consistently made in the target. Keep the flag as a last-resort "force-disable GlobalMerge" for now, for backwards compatibility. llvm-svn: 234666
This commit is contained in:
parent
241982c380
commit
b96444efd1
|
@ -73,9 +73,10 @@ using namespace llvm;
|
|||
|
||||
#define DEBUG_TYPE "global-merge"
|
||||
|
||||
// FIXME: This is only useful as a last-resort way to disable the pass.
|
||||
static cl::opt<bool>
|
||||
EnableGlobalMerge("enable-global-merge", cl::Hidden,
|
||||
cl::desc("Enable global merge pass"),
|
||||
cl::desc("Enable the global merge pass"),
|
||||
cl::init(true));
|
||||
|
||||
static cl::opt<bool>
|
||||
|
|
|
@ -87,6 +87,11 @@ EnableGEPOpt("aarch64-gep-opt", cl::Hidden,
|
|||
cl::desc("Enable optimizations on complex GEPs"),
|
||||
cl::init(true));
|
||||
|
||||
// FIXME: Unify control over GlobalMerge.
|
||||
static cl::opt<cl::boolOrDefault>
|
||||
EnableGlobalMerge("aarch64-global-merge", cl::Hidden,
|
||||
cl::desc("Enable the global merge pass"));
|
||||
|
||||
extern "C" void LLVMInitializeAArch64Target() {
|
||||
// Register the target.
|
||||
RegisterTargetMachine<AArch64leTargetMachine> X(TheAArch64leTarget);
|
||||
|
@ -245,7 +250,9 @@ bool AArch64PassConfig::addPreISel() {
|
|||
// FIXME: On AArch64, this depends on the type.
|
||||
// Basically, the addressable offsets are up to 4095 * Ty.getSizeInBytes().
|
||||
// and the offset has to be a multiple of the related size in bytes.
|
||||
if (TM->getOptLevel() == CodeGenOpt::Aggressive)
|
||||
if ((TM->getOptLevel() == CodeGenOpt::Aggressive &&
|
||||
EnableGlobalMerge == cl::BOU_UNSET) ||
|
||||
EnableGlobalMerge == cl::BOU_TRUE)
|
||||
addPass(createGlobalMergePass(TM, 4095));
|
||||
if (TM->getOptLevel() != CodeGenOpt::None)
|
||||
addPass(createAArch64AddressTypePromotionPass());
|
||||
|
|
|
@ -42,6 +42,11 @@ EnableARMLoadStoreOpt("arm-load-store-opt", cl::Hidden,
|
|||
cl::desc("Enable ARM load/store optimization pass"),
|
||||
cl::init(true));
|
||||
|
||||
// FIXME: Unify control over GlobalMerge.
|
||||
static cl::opt<cl::boolOrDefault>
|
||||
EnableGlobalMerge("arm-global-merge", cl::Hidden,
|
||||
cl::desc("Enable the global merge pass"));
|
||||
|
||||
extern "C" void LLVMInitializeARMTarget() {
|
||||
// Register the target.
|
||||
RegisterTargetMachine<ARMLETargetMachine> X(TheARMLETarget);
|
||||
|
@ -332,7 +337,9 @@ void ARMPassConfig::addIRPasses() {
|
|||
}
|
||||
|
||||
bool ARMPassConfig::addPreISel() {
|
||||
if (TM->getOptLevel() == CodeGenOpt::Aggressive)
|
||||
if ((TM->getOptLevel() == CodeGenOpt::Aggressive &&
|
||||
EnableGlobalMerge == cl::BOU_UNSET) ||
|
||||
EnableGlobalMerge == cl::BOU_TRUE)
|
||||
// FIXME: This is using the thumb1 only constant value for
|
||||
// maximal global offset for merging globals. We may want
|
||||
// to look into using the old value for non-thumb1 code of
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -O3 -enable-global-merge -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -aarch64-global-merge -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -O3 -enable-global-merge -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -aarch64-global-merge -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
|
||||
; RUN: llc %s -mtriple=aarch64-apple-ios -O3 -enable-global-merge -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
|
||||
; RUN: llc %s -mtriple=aarch64-apple-ios -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
|
||||
; RUN: llc %s -mtriple=aarch64-apple-ios -aarch64-global-merge -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
|
||||
; RUN: llc %s -mtriple=aarch64-apple-ios -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
|
||||
|
||||
@m = internal global i32 0, align 4
|
||||
@n = internal global i32 0, align 4
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-apple-ios -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
|
||||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-apple-ios -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
|
||||
|
||||
@x = global i32 0, align 4
|
||||
@y = global i32 0, align 4
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-apple-ios -O3 -enable-global-merge -global-merge-on-external -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
|
||||
; RUN: llc %s -mtriple=aarch64-none-linux-gnu -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-apple-ios -aarch64-global-merge -global-merge-on-external -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
|
||||
|
||||
@x = global [1000 x i32] zeroinitializer, align 1
|
||||
@y = global [1000 x i32] zeroinitializer, align 1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -O3 -enable-global-merge -o - | FileCheck %s
|
||||
; RUN: llc %s -mtriple=aarch64-linux-gnuabi -aarch64-global-merge -o - | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32:64-S128"
|
||||
target triple = "arm64-apple-ios7.0.0"
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
; RUN: llc %s -O0 -o - | FileCheck -check-prefix=NO-MERGE %s
|
||||
; RUN: llc %s -O0 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
|
||||
; RUN: llc %s -O0 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
|
||||
; RUN: llc %s -O1 -o - | FileCheck -check-prefix=NO-MERGE %s
|
||||
; RUN: llc %s -O1 -o - -enable-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
|
||||
; RUN: llc %s -O1 -o - -enable-global-merge=true | FileCheck -check-prefix=NO-MERGE %s
|
||||
; RUN: llc %s -O1 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
|
||||
; RUN: llc %s -O1 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
|
||||
; RUN: llc %s -O3 -o - | FileCheck -check-prefix=MERGE %s
|
||||
; RUN: llc %s -O3 -o - -enable-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
|
||||
; RUN: llc %s -O3 -o - -enable-global-merge=true | FileCheck -check-prefix=MERGE %s
|
||||
; RUN: llc %s -O3 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
|
||||
; RUN: llc %s -O3 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
|
||||
|
||||
; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2
|
||||
; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2
|
||||
|
|
Loading…
Reference in New Issue