[llvm-commits] [pr12351] Handle intrinsics in GlobalsModRef
Duncan Sands
baldrick at free.fr
Wed Mar 28 13:23:02 PDT 2012
Hi Rafael,
> I have attached a new patch which includes a testcase of both the
> original problem and the issue with the first patch.
> --- a/lib/Analysis/IPA/GlobalsModRef.cpp
> +++ b/lib/Analysis/IPA/GlobalsModRef.cpp
> @@ -467,6 +467,13 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
> } else if (isMalloc(&cast<Instruction>(*II)) ||
> isFreeCall(&cast<Instruction>(*II))) {
> FunctionEffect |= ModRef;
> + } else if(CallInst *CI = dyn_cast<CallInst>(&*II)) {
here you can do a dyn_cast<InstrinsicInst>, see IntrinsicInst.h, immediately
getting hold of the intrinsic.
Ciao, Duncan.
> + // The callgraph doesn't include intrinsic calls.
> + Function *Callee = CI->getCalledFunction();
> + if (Callee && Callee->isIntrinsic()) {
> + ModRefBehavior Behaviour = AliasAnalysis::getModRefBehavior(Callee);
> + FunctionEffect |= (Behaviour & ModRef);
> + }
> }
>
> if ((FunctionEffect & Mod) == 0)
More information about the llvm-commits
mailing list