[llvm-dev] Dump LLVM StoreInst
Craig Topper via llvm-dev
llvm-dev at lists.llvm.org
Fri Mar 9 17:37:37 PST 2018
The code you've pasted there is inconsistent in variable names. Your
created an instruction called 'op1' but your print uses 'v1'. What should
be an '->' is just a '-'. You also have a variable in your print called
'op' but that's not declared in your code. Also the result of dyn_cast
should always be checked for null before using the result.
~Craig
On Fri, Mar 9, 2018 at 9:18 AM, Zhou Zhizhong via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> Hi,
>
> I’m writing a loop-free LLVM pass, my thought is to track if the value
> inside the loop is changed, so I look up the Instruction StoreInst first
> and try to get its value in a set. I checked getValueOperand(),
> getValueName() in the API document but unfortunately they failed the
> compilation.
>
> if (isa<StoreInst>(I)){
> Value* v = I.getOperand(0);
> Instruction* op1 = dyn_cast<Instruction>(v);
> errs()<< v << "\t" << v1-getName()<<"\t"<<op<<\n"
> }
>
> Any suggestions on this?
>
> Thanks,
> Ethan
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180309/ee6f05b0/attachment.html>
More information about the llvm-dev
mailing list