Hello everyone,<br>I am trying to find the alias between a store instruction's pointer operand and function arguments. This is the code,<br>virtual void getAnalysisUsage(AnalysisUsage &AU) const {<br><br>        AU.addRequiredTransitive<AliasAnalysis>();<br>
        AU.addPreserved<AliasAnalysis>();<br>    }<br>virtual bool runOnFunction(Function &F) {<br><br><br>        AliasAnalysis &AA = getAnalysis<AliasAnalysis>();<br>      <br>        for(Function::iterator i=F.begin();i!=F.end();++i){<br>
            for(BasicBlock::iterator j=i->begin();j!=i->end();++j)<br>            {<br><br><br>                if(dyn_cast<StoreInst>(j)){<br><br>                    const StoreInst *SI=dyn_cast<StoreInst>(j);<br>
<br>                         AliasAnalysis::Location LocA = AA.getLocation(SI);<br><br><br>                    const Value *si_v= SI->getPointerOperand();<br><br>                    for(Function::arg_iterator k=F.arg_begin(); k!=F.arg_end();++k)<br>
                    {<br>                 <br><br>                         Value *v=dyn_cast<Value>(k);<br><br>                        AliasAnalysis::Location loc=AliasAnalysis::Location(v);<br>                        AliasAnalysis::AliasResult ar=AA.alias(LocA,loc);<br>
                    <br>                        switch(ar)<br>                        {<br>                        case 0:errs()<<  "NoAlias\n";<br>                        break;<br>                        ///< No dependencies.<br>
                        case 1:errs()<<"MayAlias\n";    ///< Anything goes<br>                        break;<br>                        case 2: errs()<<"PartialAlias\n";///< Pointers differ, but pointees overlap.<br>
                        break;<br><br>                        case 3: errs()<<"MustAlias\n";<br>                        }<br><br><br><br><br><br><br>            }<br>        }<br><br><br><br>        return true;<br>
    }<br>};<br>}<br><br>But I get MayAlias result even if the store instruction's pointer operand is not referencing  the function argument. Is there something wrong with the logic? Are there any files in the LLVM source code that contain code to do something similar.<br>
Thanks:)<br>