[patch] Handle calls in GlobalStatus

Chris Lattner clattner at apple.com
Sat Oct 26 17:43:09 PDT 2013


On Oct 25, 2013, at 2:24 PM, Benjamin Kramer <benny.kra at gmail.com> wrote:

> 
> On 25.10.2013, at 02:55, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> 
>> Attached a new version that also handles invokes for completeness.
>> 
>> diff --git a/lib/Transforms/Utils/GlobalStatus.cpp b/lib/Transforms/Utils/GlobalStatus.cpp
>> index 8fb79aa..a1be6e4 100644
>> --- a/lib/Transforms/Utils/GlobalStatus.cpp
>> +++ b/lib/Transforms/Utils/GlobalStatus.cpp
>> @@ -11,6 +11,7 @@
>> #include "llvm/IR/BasicBlock.h"
>> #include "llvm/IR/GlobalVariable.h"
>> #include "llvm/IR/IntrinsicInst.h"
>> +#include "llvm/Support/CallSite.h"
>> #include "llvm/Transforms/Utils/GlobalStatus.h"
>> 
>> using namespace llvm;
>> @@ -148,6 +149,11 @@ static bool analyzeGlobalAux(const Value *V, GlobalStatus &GS,
>>         if (MSI->isVolatile())
>>           return true;
>>         GS.StoredType = GlobalStatus::Stored;
>> +      } else if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
> 
> Just one nit: you could fold the ImmutableCallSite declaration into the if. Otherwise LGTM!

LGTM too, nice catch Rafael!

-Chris



More information about the llvm-commits mailing list