[cfe-dev] Use clang to generate LLVM IR with -O3, how to visit these load operations after -reg2mem
Eric Lu
eirc.lew at gmail.com
Tue Apr 21 21:29:07 PDT 2015
Best Regards!
Eric Lew
On 周三, 4月 22, 2015 at 12:11 下午, David Blaikie < dblaikie at gmail.com [dblaikie at gmail.com] > wrote:
On Tue, Apr 21, 2015 at 8:34 PM, Eric Lu <eirc.lew at gmail.com> wrote:
> Hi, all
>
> I want to instrument load/store operations in LLVM IR. And I find the LLVM
> IR generated with flag -o3 is much more efficient than -o0, so I try to
> instrument on these optimized LLVM IR, but, some load operations are changed
> to Phi loads. Then, I try the -reg2mem flag to remove these phi nodes.
> The problems are:
> 1) I use visitLoadInst to collect these load operations, and it seems I
> cannot reach these loads that are generated by reg2mem? What is the reason?
Clang doesn't generate optimized IR - so if your instrumentation is in
Clang's IRGen (clang/lib/CodeGen) it won't see these. Clang generates
the unoptimized IR (you can see it with -Xclang -disable-llvm-optzns)
I do instrumentation in the opt of llvm. Does clang itself do some optimizations
that speed up applications with -O3 compared to -O0?
> 2) Is there any way to compile with -O3 but not generate phi nodes ?
Not likely - without that it'd disable a lot of LLVM's optimization power.
- David
>
>
> --
> Best Regards!
> Eric Lew
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150422/3a3c2849/attachment.html>
More information about the cfe-dev
mailing list