[llvm-dev] setOperands(int, Value*)
Ryan Taylor via llvm-dev
llvm-dev at lists.llvm.org
Thu Feb 13 05:20:55 PST 2020
Right, so you are replacing a Value with the same Value, thus an endless
loop.
On Thu, Feb 13, 2020 at 8:02 AM Abid Malik <abidmuslim at gmail.com> wrote:
> They are different pointers but have the same values. E.g same loop
> iteration step but different opemmp for a loop. So we have different
> pointers but they are pointing to the same value.
>
> Thanks,
> Abid
>
> On Thu, Feb 13, 2020 at 7:54 AM Ryan Taylor <ryta1203 at gmail.com> wrote:
>
>> Are you replacing the value with the same value?
>>
>> On Thu, Feb 13, 2020, 7:40 AM Abid Malik <abidmuslim at gmail.com> wrote:
>>
>>> Thanks
>>> I tried it and it also went to an endless loop. Here is an example of
>>> what I am trying to achieve:
>>>
>>>
>>>
>>> *store i32 0, i32* %15, align 4 call void
>>> @__kmpc_for_static_init_4(%struct.ident_t* @0, i32 %17, i32 34, i32* %15,
>>> i32* %12, i32* %13, i32* %14, i32 1, i32 1) %41 = load i32, i32* %13,
>>> align 4*
>>>
>>> I am trying to replace *i32* %15 and i32* %13 with another operand
>>> values say i32* %18 and i32* 23. FYI, i32* %15== i32* %18 and . i32*
>>> %18==i32* %23 in terms of content values.*
>>>
>>>
>>> On Thu, Feb 13, 2020 at 7:28 AM Ryan Taylor <ryta1203 at gmail.com> wrote:
>>>
>>>> Value::replaceAllUsesWith(Value*) ?
>>>>
>>>> On Thu, Feb 13, 2020, 7:24 AM Abid Malik via llvm-dev <
>>>> llvm-dev at lists.llvm.org> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I am trying to reset the operands of instructions. What I am doing is,
>>>>> I am finding all Uses of a specific operand in an Instruction and resetting
>>>>> it with a new value using "setOperands(int, Value*)". I am doing as:
>>>>>
>>>>> for (auto vmitr=vm.begin(), vsitr=vs.begin(); vmitr!=vm.end() &&
>>>>> vsitr!=vs.end(); vmitr++, vsitr++){
>>>>> // I have two *Value ( operands)
>>>>>
>>>>> for ( auto myitr =(*vsitr)->user_begin(); myitr!=(*vsitr)->user_end();
>>>>> ++myitr){
>>>>> // Finding the uses of one operand
>>>>> for ( int k = 0; k < (*myitr)->getNumOperands(); k++){
>>>>> // going through the operands of the Instructions that uses it
>>>>> if ((*myitr)->getOperand(k) == *vsitr){
>>>>> // Find the operand and its position in the instruction
>>>>> (*myitr)->setOperand(k,*vmitr);
>>>>> // Replacing it with the other operand value
>>>>> }
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>> The problem is that it goes into the end loop.
>>>>> ps. *vsitr and *vmitr are arguments of different call instructions but
>>>>> pointing to the same values.
>>>>>
>>>>> Thanks
>>>>> --
>>>>> Abid M. Malik
>>>>> ******************************************************
>>>>> "I have learned silence from the talkative, toleration from the
>>>>> intolerant, and kindness from the unkind"---Gibran
>>>>> "Success is not for the chosen few, but for the few who choose" ---
>>>>> John Maxwell
>>>>> "Being a good person does not depend on your religion or status in
>>>>> life, your race or skin color, political views or culture. IT DEPENDS ON
>>>>> HOW GOOD YOU TREAT OTHERS"--- Abid
>>>>> "The Universe is talking to us, and the language of the Universe is
>>>>> mathematics."----Abid
>>>>>
>>>>> _______________________________________________
>>>>> LLVM Developers mailing list
>>>>> llvm-dev at lists.llvm.org
>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>>>
>>>>
>>>
>>> --
>>> Abid M. Malik
>>> ******************************************************
>>> "I have learned silence from the talkative, toleration from the
>>> intolerant, and kindness from the unkind"---Gibran
>>> "Success is not for the chosen few, but for the few who choose" --- John
>>> Maxwell
>>> "Being a good person does not depend on your religion or status in life,
>>> your race or skin color, political views or culture. IT DEPENDS ON HOW GOOD
>>> YOU TREAT OTHERS"--- Abid
>>> "The Universe is talking to us, and the language of the Universe is
>>> mathematics."----Abid
>>>
>>>
>>
>
> --
> Abid M. Malik
> ******************************************************
> "I have learned silence from the talkative, toleration from the
> intolerant, and kindness from the unkind"---Gibran
> "Success is not for the chosen few, but for the few who choose" --- John
> Maxwell
> "Being a good person does not depend on your religion or status in life,
> your race or skin color, political views or culture. IT DEPENDS ON HOW GOOD
> YOU TREAT OTHERS"--- Abid
> "The Universe is talking to us, and the language of the Universe is
> mathematics."----Abid
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200213/2bc06fa2/attachment.html>
More information about the llvm-dev
mailing list