[LLVMdev] inserting a fucntion call at the end of basic bloc

Nabila ABDESSAIED nabila.abdessaied at gmail.com
Tue Apr 26 06:50:29 PDT 2011

2011/4/26 Duncan Sands <baldrick at free.fr>

> Hi Nabila,
>     where did the "noalias" attribute and "tail call" (rather than "call")
>> come
>>    from?  Are you setting these yourself or running some optimization pass
>> after
>>    your pass?
>> i have written a module pass and i have compiled it and then
> you didn't answer my questions, you just repeated what you said before.
> Ciao, Duncan.
>   opt -load /home/inspiron/PhdWork/llvm-2.8/Release/lib/Example.so
>> -Example2 <
>> hello.bc > /dev/null
>> i get the error message
>> Wrong type for attribute noalias
>>   tail call void @consume(i32 noalias 3, i32* @y) nounwind
>> Broken module found, compilation aborted!
>> 0  libLLVM-2.8.so.1 0x019bc628
>> Stack dump:
>> 0.Program arguments: opt -load
>> /home/inspiron/PhdWork/llvm-2.8/Release/lib/Example.so -Example2
>> 1.Running pass 'Function Pass Manager' on module '<stdin>'.
>> 2.Running pass 'Module Verifier' on function '@main'
>> Aborted
>>> No, i'm not setting them by my self
>> and are you running any optimization passes?  Another possibility is that
>> the
>> the problem was present already in hello.bc.  Did you check that hello.bc
>> passes
>> the verifier?  Did you build LLVM with assertions enabled (you should)?
>>  How did
>> you add the declaration of "consume" to the module?  Finally, try running
>> under
>> valgrind.
no I do not use any optimisation pass only my pass
hello.bc works and i have check it with lli hello.bc
no without assertion enabled
i don't want to modify the original hello.bc
if would like to apply the changes found in the pass i just put  instead of
opt -load /home/inspiron/PhdWork/llvm-2.8/Release/lib/Example.so -Example2 <
hello.bc > /dev/null
i put this
opt -load /home/inspiron/PhdWork/llvm-2.8/Release/lib/Example.so -Example2 <
hello.bc >  hello2.bc

the declaration is:

PointerType* PointerTy_0 = PointerType::get(IntegerType::get(M.getContext(),
32), 0);

            std::vector<const Type*>FuncTy_3_args;
            FuncTy_3_args.push_back(IntegerType::get(M.getContext(), 32));
            FunctionType* FuncTy_3 = FunctionType::get(

 Constant *consum = M.getOrInsertFunction("consume", FuncTy_3);
            llvm::Function* func_consume = llvm::cast<llvm::Function >
            func_consume ->setLinkage(GlobalValue::ExternalLinkage);
            AttrListPtr func_consume_PAL;

i have tried to modify the method consume so that it is
void consume(int*)
and chaged the declaration also
and it works
now when i have modified the method consume like this  void consume(int)
and modified the declaration
it doesn't work

I don't know valgrid:(

Sorry I always forget to clic the reply all :)

   Ciao, Duncan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110426/33362af6/attachment.html>

More information about the llvm-dev mailing list