<div dir="ltr"><div>I don't think its legal to remove it. That code is equivalent to asking (%0 mod 8) == 7. Which is true for 7 and 15 and 23, etc. You can't just remove the mod part of that or it would just return true for %0 == 7.</div><div><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 11, 2020 at 6:31 PM Riyaz Puthiyapurayil via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">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 lang="EN-US">
<div class="gmail-m_-1904793332509699731WordSection1">
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas">define dso_local i32 @f(i32 %0) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas"> <span style="background:yellow">
%2 = and i32 %0, 7</span><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas"> %3 = icmp eq i32 %2, 7<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas"> %4 = zext i1 %3 to i32<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas"> ret i32 %4<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas">}<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas">I thought instcombine would remove it. It doesn’t and nothing else does either. LLVM Version is 10.0.0.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:14pt;font-family:Consolas">/Riyaz<u></u><u></u></span></p>
</div>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>