[llvm-commits] [llvm] r158937 - in /llvm/trunk: include/llvm/Analysis/MemoryBuiltins.h lib/Analysis/MemoryBuiltins.cpp lib/Transforms/InstCombine/InstCombineCalls.cpp lib/Transforms/InstCombine/InstructionCombining.cpp test/Transforms/InstCombine/objsize-64.ll
Nuno Lopes
nunoplopes at sapo.pt
Fri Jun 22 08:56:14 PDT 2012
Quoting Duncan Sands <baldrick at free.fr>:
> Hi Nuno,
>
>> --- llvm/trunk/lib/Analysis/MemoryBuiltins.cpp (original)
>> +++ llvm/trunk/lib/Analysis/MemoryBuiltins.cpp Thu Jun 21 16:25:05 2012
>> @@ -65,11 +65,17 @@
>> static Function *getCalledFunction(const Value *V, bool
>> LookThroughBitCast) {
>> if (LookThroughBitCast)
>> V = V->stripPointerCasts();
>> - const CallInst *CI = dyn_cast<CallInst>(V);
>> - if (!CI)
>> +
>> + Value *I = const_cast<Value*>(V);
>> + CallSite CS;
>> + if (CallInst *CI = dyn_cast<CallInst>(I))
>> + CS = CallSite(CI);
>> + else if (InvokeInst *II = dyn_cast<InvokeInst>(I))
>> + CS = CallSite(II);
>> + else
>> return 0;
>
> you should be able to do something like this:
>
> CallSite CS(I);
> if (!CS.getInstruction())
> return 0;
Ah, nice! Thanks, fixed in r158999.
Nuno
>> - Function *Callee = CI->getCalledFunction();
>> + Function *Callee = CS.getCalledFunction();
>> if (!Callee || !Callee->isDeclaration())
>> return 0;
>> return Callee;
>
>
>> --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
>> (original)
>> +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
>> Thu Jun 21 16:25:05 2012
>> @@ -1167,6 +1167,10 @@
>> }
>> EraseInstFromFunction(*I);
>> }
>> +
>> + if (InvokeInst *II = dyn_cast<InvokeInst>(&MI)) {
>> + BranchInst::Create(II->getNormalDest(), II->getParent());
>> + }
>
> Style: no need for {} here.
>
> Ciao, Duncan.
More information about the llvm-commits
mailing list