mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-01 17:32:36 +00:00
Put the LICM of constant GlobalVariables, introduced in r53945, under a
command-line option, and disable it by default. It introduced performance regressions because CodeGen is currently not able to remat such loads. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53997 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5444c30723
commit
3eee6542f5
@ -62,6 +62,15 @@ static cl::opt<bool>
|
|||||||
DisablePromotion("disable-licm-promotion", cl::Hidden,
|
DisablePromotion("disable-licm-promotion", cl::Hidden,
|
||||||
cl::desc("Disable memory promotion in LICM pass"));
|
cl::desc("Disable memory promotion in LICM pass"));
|
||||||
|
|
||||||
|
// This feature is currently disabled by default because CodeGen is not yet capable
|
||||||
|
// of rematerializing these constants in PIC mode, so it can lead to degraded
|
||||||
|
// performance. Compile test/CodeGen/X86/remat-constant.ll with
|
||||||
|
// -relocation-model=pic to see an example of this.
|
||||||
|
static cl::opt<bool>
|
||||||
|
EnableLICMConstantMotion("enable-licm-constant-variables", cl::Hidden,
|
||||||
|
cl::desc("Enable hoisting/sinking of constant "
|
||||||
|
"global variables"));
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct VISIBILITY_HIDDEN LICM : public LoopPass {
|
struct VISIBILITY_HIDDEN LICM : public LoopPass {
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
@ -372,7 +381,8 @@ bool LICM::canSinkOrHoistInst(Instruction &I) {
|
|||||||
|
|
||||||
// Loads from constant memory are always safe to move, even if they end up
|
// Loads from constant memory are always safe to move, even if they end up
|
||||||
// in the same alias set as something that ends up being modified.
|
// in the same alias set as something that ends up being modified.
|
||||||
if (AA->pointsToConstantMemory(LI->getOperand(0)))
|
if (EnableLICMConstantMotion &&
|
||||||
|
AA->pointsToConstantMemory(LI->getOperand(0)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Don't hoist loads which have may-aliased stores in loop.
|
// Don't hoist loads which have may-aliased stores in loop.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | grep -A 1 entry | grep load.*@a
|
; RUN: llvm-as < %s | opt -licm -enable-licm-constant-variables | llvm-dis | grep -A 1 entry | grep load.*@a
|
||||||
@a = external constant float*
|
@a = external constant float*
|
||||||
|
|
||||||
define void @test(i32 %count) {
|
define void @test(i32 %count) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user