[LLVMdev] Problem with llvm-c
Duncan Sands
baldrick at free.fr
Mon May 13 01:03:42 PDT 2013
Hi James,
On 13/05/13 00:25, James Courtier-Dutton wrote:
> Hi,
>
> I have the following program (attached)
>
> I produces, using the llvm-c API, this:
> ; ModuleID = './llvm-test.bc'
>
> define i32 @test2() {
> EntryBlock:
> ret i32 3
> }
>
> But, I want it to produce this:
> ; ModuleID = './llvm-test.bc'
>
> define i32 @test2() {
> EntryBlock:
> %1 = add i32 1, 2
> ret i32 %1
> }
>
> I.e. With the "add" in there.
> llvm appears to be doing some optimization on it, to remove the add.
if you used LLVMConstAdd to create the add, then don't, use LLVMBuildAdd
instead. If you were using LLVMBuildAdd, then use a builder than doesn't
do automatic constant folding.
Ciao, Duncan.
> Is there any way to switch off the optimization by adding something to
> the ll.c file?
> I will be using the llvm-c api more fully, and I wish to make sure
> that the instructions I tell it to use are in the resulting .bc and
> .ll output.
> I.e. I want the .bc and .ll output to be pre-optimizations.
>
> Kind Regards
>
> James
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list