[LLVMdev] LLVM load instruction query

Alexandru Ionut Diaconescu alexandruionutdiaconescu at gmail.com
Tue Mar 5 05:38:48 PST 2013


Try :

INITIALIZE a1 if you didnt.

if (cpProf EXISTS){
CallInst* newInst = CallInst::Create(cpProf,a1,"");

if (BB->getTerminator() && CI)
     BB->getInstList().insert((Instruction*)CI, newInst);





On Tue, Mar 5, 2013 at 1:04 PM, Anshul Garg <gargaa24 at gmail.com> wrote:

> CallInst* newInst = CallInst::Create(cpProf,a1,"");
>  BB->getInstList().insert((Instruction*)CI, newInst);
>
> these two lines when i comment there is no segmentation fault.
>
>
> On Tue, Mar 5, 2013 at 4:02 AM, Alexandru Ionut Diaconescu <
> alexandruionutdiaconescu at gmail.com> wrote:
>
>> Now i saw that you indeed have the declaration before. So check the
>> pointers. what line if you comment gives you no segfault?
>>
>>
>> On Tue, Mar 5, 2013 at 1:01 PM, Alexandru Ionut Diaconescu <
>> alexandruionutdiaconescu at gmail.com> wrote:
>>
>>> 1. check if CI->getNumOperands() is not zero before using it.
>>> 2. CallInst* newInst = CallInst::Create(cpProf,a1,"")   and then you
>>> declare std::vector<Value*> a1(1);....put declaration before
>>>
>>>
>>
>>
>> --
>> Best regards,
>> Alexandru Ionut Diaconescu
>>
>
>


-- 
Best regards,
Alexandru Ionut Diaconescu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130305/776f970c/attachment.html>


More information about the llvm-dev mailing list