<div dir="ltr">This is still a rather long test case - I expect it should be able to be reduced further while still demonstrating the problem.<br><br>I also don't understand what the correct/incorrect behavior it is you're looking for - at least casually, the program prints the same result at -O0, which doesn't run mem2reg, and at -O3 which does run mem2reg.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 14, 2020 at 5:14 PM <a href="mailto:liubaosen@tsinghua.edu.cn">liubaosen@tsinghua.edu.cn</a> <<a href="mailto:liubaosen@tsinghua.edu.cn">liubaosen@tsinghua.edu.cn</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>
<div><span></span>Hi, David, and anyone regards,</div><div>Thanks for discussing. I meant you can run the main.c with what I affixed in last mail. Anyway, I reprepared a complete while least pack of codes, which is affixed. I've tried it with following process, </div><div><br></div>
<div><div>clang colapse.c -o colapse</div><div>./colapse</div><div>valgrind --tool=memcheck --leak-check=yes ./colapse</div><div> clang colapse.c -emit-llvm -g -c -S -o colapse.ll -Xclang -disable-O0-optnone</div><div> opt -mem2reg -da -analyze colapse.ll</div></div><div><br></div><div>so, principly, it is for sure able to recur. There are totally 3 functions can cause collapses (maybe by a same reason), and all of them are contained in the file. Please help me debug it. </div><div><br></div><div>Thanks again.</div><div><br></div><hr style="width:210px;height:1px" color="#b5c4df" size="1" align="left">
<div><span><div style="margin:10px;font-family:verdana;font-size:10pt"><div><a href="mailto:liubaosen@tsinghua.edu.cn" target="_blank">liubaosen@tsinghua.edu.cn</a></div></div></span></div>
<blockquote style="margin-top:0px;margin-bottom:0px;margin-left:0.5em;margin-right:inherit"><div> </div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm"><div style="padding:8px;font-size:12px;font-family:tahoma;color:rgb(0,0,0);background:rgb(239,239,239)"><div><b>From:</b> <a href="mailto:dblaikie@gmail.com" target="_blank">David Blaikie</a></div><div><b>Date:</b> 2020-05-15 06:31</div><div><b>To:</b> <a href="mailto:liubaosen@tsinghua.edu.cn" target="_blank">liubaosen@tsinghua.edu.cn</a>; <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev</a></div><div><b>Subject:</b> Re: Re: [llvm-dev] bug report on mem2reg</div></div></div><div><div class="gmail-m_-741138944612555739FoxDiv20200515075216404545"><div dir="ltr">Sorry, I'm not sure I'll be able to help you - main.c uses other code (optsfind/check/etc) that I don't have/don't know what that code is, and even with it it's probably a bit big/complicated for me to debug/reduce/etc. If you can reconstruct the smallest complete (reducing the total lines of all source/header files needed to reproduce the problem) example that might be more practical to discuss here & see whether it's a mem2reg bug, etc.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 13, 2020 at 6:52 PM <a href="mailto:liubaosen@tsinghua.edu.cn" target="_blank">liubaosen@tsinghua.edu.cn</a> <<a href="mailto:liubaosen@tsinghua.edu.cn" target="_blank">liubaosen@tsinghua.edu.cn</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>
<div><span></span>Hi, David and anyone relevent,</div><div><br></div><div>Thank you for replying, first.</div><div>I tried it with valgrind, no error is reported, so I'm sure it's not our problem.</div><div>The valgrind log is affixed and a mian.c which you may need to generate an executable is also affixed.</div><div>Please do me a favor and investigate what causes the colapse. Your help will be greatly appreciated.</div><div><br></div><div>Best regards</div>
<div><br></div><hr style="width:210px;height:1px" color="#b5c4df" size="1" align="left">
<div><span><div style="margin:10px;font-family:verdana;font-size:10pt"><div><a href="mailto:liubaosen@tsinghua.edu.cn" target="_blank">liubaosen@tsinghua.edu.cn</a></div></div></span></div>
<blockquote style="margin-top:0px;margin-bottom:0px;margin-left:0.5em;margin-right:inherit"><div> </div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm"><div style="padding:8px;font-size:12px;font-family:tahoma;color:rgb(0,0,0);background:rgb(239,239,239)"><div><b>From:</b> <a href="mailto:dblaikie@gmail.com" target="_blank">David Blaikie</a></div><div><b>Date:</b> 2020-05-12 11:45</div><div><b>To:</b> <a href="mailto:liubaosen@tsinghua.edu.cn" target="_blank">liubaosen@tsinghua.edu.cn</a></div><div><b>CC:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev</a></div><div><b>Subject:</b> Re: [llvm-dev] bug report on mem2reg</div></div></div><div><div><div dir="ltr">Tried testing it with things like Undefined Behaivor Sanitizer (or other sanitizers - memory/address) or valgrind?<br><br>Often "program works sometimes and doesn't work other times" is because the program has undefined behavior in it & the times its working are just luck.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 11, 2020 at 8:41 PM <a href="mailto:liubaosen@tsinghua.edu.cn" target="_blank">liubaosen@tsinghua.edu.cn</a> via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" 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>
<div><span></span>Hi, all,</div><div><br></div><div>I think I found a bug on mem2reg in a particular case.</div><div>When I ran opt -mem2reg -basicaa -scalar-evolution -loops -da -analyze opts.ll, it collapsed. While without mem2reg option, it runs well. so I guess it has something to do with mem2reg.</div><div>The relative files have been affixed, please check them for me.</div><div>Thanks in advance.</div>
<div><br></div><hr style="width:210px;height:1px" color="#b5c4df" size="1" align="left">
<div><span><div style="margin:10px;font-family:verdana;font-size:10pt"><div><a href="mailto:liubaosen@tsinghua.edu.cn" target="_blank">liubaosen@tsinghua.edu.cn</a></div></div></span></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>
</div></div></blockquote>
</div></blockquote></div>
</div></div></blockquote>
</div></blockquote></div>