[llvm-dev] How to change IR type?

Celine via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 15 03:24:54 PDT 2019


I want to change the following IR:

  %2 = tail call i16 @llvm.nvvm.read.ptx.sreg.tid.x() #2
  %add = add i16 %mul6, %2

  %2 = tail call i16v @llvm.nvvm.read.ptx.sreg.tid.x() #2
(i16v)%add = add i16 %mul6, (i16v)%2     //Here keep %mul6 i16 as it is.

I'm not familar with LLVM IR API, it's not easy to get the type and change it right away. Seems need to create a new IR and replace the old one? 

But it's also hard to CreateCall() or CreateAdd(), hard to get the original IR's info to fill in those CreateXXX parameter. 

Any ideas or reference code?
How to learn LLVM IR API quickly?

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191015/7346bca3/attachment.html>

More information about the llvm-dev mailing list