[llvm-commits] [llvm] r159440 - /llvm/trunk/lib/Transforms/Utils/Local.cpp

Nuno Lopes nunoplopes at sapo.pt
Fri Jun 29 15:12:50 PDT 2012


Quoting Duncan Sands <baldrick at free.fr>:

> Hi Nuno,
>
>> ignore 'invoke new' in isInstructionTriviallyDead, since most  
>> callers are not ready to handle invokes. instcombine will take care  
>> of this.
>
>> --- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Utils/Local.cpp Fri Jun 29 12:37:07 2012
>> @@ -265,7 +265,8 @@
>>         return isa<UndefValue>(II->getArgOperand(1));
>>     }
>>
>> -  if (isAllocLikeFn(I)) return true;
>> +  if (isAllocLikeFn(I))
>> +    return isa<CallInst>(I); // do not mess around with invoke here
>>
>>     if (CallInst *CI = isFreeCall(I))
>>       if (Constant *C = dyn_cast<Constant>(CI->getArgOperand(0)))
>>
>
> this isn't needed, since isInstructionTriviallyDead bails out on
> invokes right at the start:
>
> bool llvm::isInstructionTriviallyDead(Instruction *I) {
>    if (!I->use_empty() || isa<TerminatorInst>(I)) return false;

Ah, nice catch! Reverted in r159471.
Thanks Duncan!
Nuno



More information about the llvm-commits mailing list