[llvm] r289987 - Inline stripInvariantGroupMetadata out of existence

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 18:00:15 PST 2016


Hi Philip,

On Fri, Dec 16, 2016 at 12:58 PM, Philip Reames
<listmail at philipreames.com> wrote:
> Should we maybe have a removeMetadata(Kind) function?  Setting to nullptr
> seems obscure.

I think it would be ugly to have two ways to do the same thing
(setMetadata(X, nullptr) vs. removeMetadata(X)).  I suppose we could
have a strict contract that setMetdata never sets X to nullptr and add
asserts to that effect, but then I'd have to make sure nothing breaks
afterwards, and I don't want to sign up to do that at the moment.

-- Sanjoy

>
>
> On 12/16/2016 12:29 PM, Sanjoy Das via llvm-commits wrote:
>>
>> Author: sanjoy
>> Date: Fri Dec 16 14:29:39 2016
>> New Revision: 289987
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=289987&view=rev
>> Log:
>> Inline stripInvariantGroupMetadata out of existence
>>
>> As a one liner function, I don't think it is pulling its weight in terms
>> of helping readability.
>>
>> Modified:
>>      llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
>>
>> Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=289987&r1=289986&r2=289987&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Fri Dec 16 14:29:39 2016
>> @@ -206,7 +206,6 @@ class TypePromotionTransaction;
>>                           unsigned CreatedInstCost);
>>       bool splitBranchCondition(Function &F);
>>       bool simplifyOffsetableRelocate(Instruction &I);
>> -    void stripInvariantGroupMetadata(Instruction &I);
>>     };
>>   }
>>   @@ -5316,7 +5315,7 @@ bool CodeGenPrepare::optimizeInst(Instru
>>         return OptimizeCmpExpression(CI, TLI);
>>       if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
>> -    stripInvariantGroupMetadata(*LI);
>> +    LI->setMetadata(LLVMContext::MD_invariant_group, nullptr);
>>       if (TLI) {
>>         bool Modified = optimizeLoadExt(LI);
>>         unsigned AS = LI->getPointerAddressSpace();
>> @@ -5327,7 +5326,7 @@ bool CodeGenPrepare::optimizeInst(Instru
>>     }
>>       if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
>> -    stripInvariantGroupMetadata(*SI);
>> +    SI->setMetadata(LLVMContext::MD_invariant_group, nullptr);
>>       if (TLI) {
>>         unsigned AS = SI->getPointerAddressSpace();
>>         return optimizeMemoryInst(I, SI->getOperand(1),
>> @@ -5733,7 +5732,3 @@ bool CodeGenPrepare::splitBranchConditio
>>     }
>>     return MadeChange;
>>   }
>> -
>> -void CodeGenPrepare::stripInvariantGroupMetadata(Instruction &I) {
>> -  I.setMetadata(LLVMContext::MD_invariant_group, nullptr);
>> -}
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>



-- 
Sanjoy Das
http://playingwithpointers.com


More information about the llvm-commits mailing list