[llvm] r201559 - GlobalMerge: move "-global-merge" option to the pass itself.

Renato Golin renato.golin at linaro.org
Tue Feb 18 10:31:03 PST 2014


James, Tim,

IIRC this had to do with how global merge destroys kernel's magic. I
don't remember the details, but it had to do with GCC not merging
globals and they relying on that and using it for nefarious purposes.

Jan (cc'd) may have more info...

cheers,
--renato

On 18 February 2014 16:28, James Molloy <james at jamesmolloy.co.uk> wrote:
> Tim,
>
> Having looked at this recently, is there any particular reason why
> GlobalMerging has its own "disable me" flag anyway? Wouldn't it be best to
> just remove this flag completely?
>
> James
>
>
> On 18 February 2014 11:17, Tim Northover <tnorthover at apple.com> wrote:
>>
>> Author: tnorthover
>> Date: Tue Feb 18 05:17:29 2014
>> New Revision: 201559
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=201559&view=rev
>> Log:
>> GlobalMerge: move "-global-merge" option to the pass itself.
>>
>> It's rather odd to have the flag enabling and disabling this pass only
>> affect a
>> single target.
>>
>> Modified:
>>     llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp
>>     llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp
>>
>> Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=201559&r1=201558&r2=201559&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original)
>> +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Tue Feb 18 05:17:29
>> 2014
>> @@ -24,11 +24,6 @@
>>  using namespace llvm;
>>
>>  static cl::opt<bool>
>> -EnableGlobalMerge("global-merge", cl::Hidden,
>> -                  cl::desc("Enable global merge pass"),
>> -                  cl::init(true));
>> -
>> -static cl::opt<bool>
>>  DisableA15SDOptimization("disable-a15-sd-optimization", cl::Hidden,
>>                     cl::desc("Inhibit optimization of S->D register
>> accesses on A15"),
>>                     cl::init(false));
>> @@ -184,7 +179,7 @@ TargetPassConfig *ARMBaseTargetMachine::
>>  }
>>
>>  bool ARMPassConfig::addPreISel() {
>> -  if (TM->getOptLevel() != CodeGenOpt::None && EnableGlobalMerge)
>> +  if (TM->getOptLevel() != CodeGenOpt::None)
>>      addPass(createGlobalMergePass(TM));
>>
>>    return false;
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp?rev=201559&r1=201558&r2=201559&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp Tue Feb 18 05:17:29
>> 2014
>> @@ -71,6 +71,11 @@
>>  using namespace llvm;
>>
>>  static cl::opt<bool>
>> +EnableGlobalMerge("global-merge", cl::Hidden,
>> +                  cl::desc("Enable global merge pass"),
>> +                  cl::init(true));
>> +
>> +static cl::opt<bool>
>>  EnableGlobalMergeOnConst("global-merge-on-const", cl::Hidden,
>>                           cl::desc("Enable global merge pass on
>> constants"),
>>                           cl::init(false));
>> @@ -231,6 +236,9 @@ void GlobalMerge::setMustKeepGlobalVaria
>>  }
>>
>>  bool GlobalMerge::doInitialization(Module &M) {
>> +  if (!EnableGlobalMerge)
>> +    return false;
>> +
>>    DenseMap<unsigned, SmallVector<GlobalVariable*, 16> > Globals,
>> ConstGlobals,
>>                                                          BSSGlobals;
>>    const TargetLowering *TLI = TM->getTargetLowering();
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list