<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr"><br></div><div dir="ltr"><br><blockquote type="cite">On 19 Aug 2021, at 11:01, Rohit Aggarwal via llvm-dev <llvm-dev@lists.llvm.org> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr">Hi All,<div><br></div><div>Thanks Florian for response.</div><div><br></div><div><div dir="ltr"><div> Adding more details to the issue:</div><div><ul><li>I revert the commit  <a href="https://github.com/llvm/llvm-project/commit/2fd3037ac615643fe8058292d2b89bb19a49cb2f#">[ConstantFold] Allow propagation of poison for and/or i1</a> then it is working fine.</li><li>In this commit, a check is removed to stop the constantfold of instruction to poison value incase of integer ADD or OR instruction if either of operands are poison.</li><li>Using both release branch and commit reverted branch, a poison value is generated by a shift left instruction due to overflow (UB is present) </li></ul></div></div></div></div></div></blockquote><div><br></div>Ok so it sounds like this is the reason for the different output and the transformation is correct.<div><br><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><ul><li>Now in the release branch, this poison value is propagated down to 'or' inst. and  is constantfolds %or = or  true poison  -> poison</li><li>The poison value propagates to its uses</li><li>There is a store instruction which now has a poison value</li><li>In visitStoreInst, store instruction got removed due to poison value</li><li>But in revert branch, store is not getting remove as it has defined value</li></ul><div>See the below diff for more clarity.</div><div><img src="cid:ii_ksiqog9j1" alt="image.png" width="472" height="255" data-unique-identifier=""><br></div></div></div><div><br></div><div class="gmail_quote"><div class="gmail_attr">Thanks,</div><div class="gmail_attr">Rohit Aggarwal</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 19, 2021 at 2:19 PM Florian Hahn <<a href="mailto:florian_hahn@apple.com">florian_hahn@apple.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 style="overflow-wrap: break-word;">Hi,<br><div><br><blockquote type="cite"><div>On Aug 18, 2021, at 21:21, Rohit Aggarwal via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Hi All,<br></div><div dir="ltr"><div><br></div><div>I am running the instcombine pass on the given lR and executing the binary.</div><div><br></div><div><i>./build_release13x/bin/opt -enable-new-pm=false  -instcombine sample.ll -S -o sample_instcombined_llvm.ll && ./build_release13x/bin/clang sample_instcombined_llvm.ll && ./a.out</i><br></div><div><i><br></i></div><div>But before passing to instcombine, the output is <b>CE6DB4AC</b> and after passing to instcombine value changes to <b>3B83FBC</b>.</div><div><br></div><div>I tried to debug the issue and found that due to the occurence of poison value, some instructions(or, store,..) are getting deleted/erased. </div><div><b><br></b></div><div>I also observed that there are active changes happening related to poison values in the community. Is this behaviour expected one? Or Could it be a side effect of those changes</div></div></div></div></div></blockquote></div><br><div>There are 2 potential causes for the difference: 1) your input has undefined behavior and/or the result depends on a poison value or 2) a bug in instcombine. </div><div><br></div><div>Without narrowing things down to the problematic pattern, it is very hard to say which one it is. I’d suggest you try to isolate the change in behavior to the problematic instcombine pattern and minimize the input IR to trigger the problematic pattern. </div><div><br></div><div>Cheers,</div><div>Florian</div></div></blockquote></div>

<br>
<span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap;background-color:yellow">Disclaimer:- </span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-size:small">This </span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-size:small">footer text is to convey that this email is sent by one of the </span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-size:small">users of IITH. So, do not mark it as SPAM.</span></p></span><span>_______________________________________________</span><br><span>LLVM Developers mailing list</span><br><span>llvm-dev@lists.llvm.org</span><br><span>https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</span><br></div></blockquote></div></body></html>