<div dir="ltr">Right, so you are replacing a Value with the same Value, thus an endless loop.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 13, 2020 at 8:02 AM Abid Malik <<a href="mailto:abidmuslim@gmail.com">abidmuslim@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">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.</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Thanks,</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Abid</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 13, 2020 at 7:54 AM Ryan Taylor <<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Are you replacing the value with the same value? </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 13, 2020, 7:40 AM Abid Malik <<a href="mailto:abidmuslim@gmail.com" target="_blank">abidmuslim@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Thanks</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">I tried it and it also went to an endless loop. Here is an example of what I am trying to achieve:</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><b>store i32 0, i32* %15, align 4<br> 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)<br> %41 = load i32, i32* %13, align 4</b><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">I am trying to replace <b>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.</b></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 13, 2020 at 7:28 AM Ryan Taylor <<a href="mailto:ryta1203@gmail.com" rel="noreferrer" target="_blank">ryta1203@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Value::replaceAllUsesWith(Value*) ?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 13, 2020, 7:24 AM Abid Malik via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer noreferrer" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Hello,</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">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:</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">for (auto vmitr=vm.begin(), vsitr=vs.begin(); vmitr!=vm.end() && vsitr!=vs.end(); vmitr++, vsitr++){<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">// I have two *Value ( operands)</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">for ( auto myitr =(*vsitr)->user_begin(); myitr!=(*vsitr)->user_end(); ++myitr){<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">// Finding the uses of one operand</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">for ( int k = 0; k < (*myitr)->getNumOperands(); k++){<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">// going through the operands of the Instructions that uses it</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">if ((*myitr)->getOperand(k) == *vsitr){<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">// Find the operand and its position in the instruction</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">(*myitr)->setOperand(k,*vmitr);<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">// Replacing it with the other operand value</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">}</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">}</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">}</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">The problem is that it goes into the end loop. </div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">ps. *vsitr and *vmitr are arguments of different call instructions but pointing to the same values.</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Thanks</div>-- <br><div dir="ltr"><div dir="ltr"><div>Abid M. Malik<br>******************************************************<br>"I have learned silence from the talkative, toleration from the intolerant, and kindness from the unkind"---Gibran<br>"Success is not for the chosen few, but for the few who choose" --- John Maxwell<br>"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<br>"The Universe is talking to us, and the language of the Universe is mathematics."----Abid<br> </div></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer noreferrer noreferrer" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Abid M. Malik<br>******************************************************<br>"I have learned silence from the talkative, toleration from the intolerant, and kindness from the unkind"---Gibran<br>"Success is not for the chosen few, but for the few who choose" --- John Maxwell<br>"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<br>"The Universe is talking to us, and the language of the Universe is mathematics."----Abid<br> </div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Abid M. Malik<br>******************************************************<br>"I have learned silence from the talkative, toleration from the intolerant, and kindness from the unkind"---Gibran<br>"Success is not for the chosen few, but for the few who choose" --- John Maxwell<br>"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<br>"The Universe is talking to us, and the language of the Universe is mathematics."----Abid<br> </div></div></div>
</blockquote></div>