<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">It'd be better to make the both zero-sized, like an array of i8 with zero elements. This idiom has come up before, and that's our recommended solution. We've tweaked the optimizers to ensure that zero-sized objects are not assumed to be distinct. </div></div></div></div></blockquote><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">Okay, I have rewritten my clear BSS section function as :</div><div class="">;————</div><div class="">@__bss_start = external global [0 x i32]</div><div class="">@__bss_end = external global [0 x i32]</div><div class=""><br class=""></div><div class="">define void @clearBSS () nounwind {</div><div class="">entry:</div><div class=""> %startPtr = getelementptr [0 x i32], [0 x i32]* @__bss_start, i32 0, i32 0</div><div class=""> %endPtr = getelementptr [0 x i32], [0 x i32]* @__bss_end, i32 0, i32 0</div><div class=""> br label %bssLoopTest</div><div class=""> </div><div class="">bssLoopTest:</div><div class=""> %p = phi i32* [%startPtr, %entry], [%p.next, %bssLoop]</div><div class=""> %completed = icmp eq i32* %p, %endPtr</div><div class=""> br i1 %completed, label %clearCompleted, label %bssLoop</div><div class=""> </div><div class="">bssLoop:</div><div class=""> store i32 0, i32* %p, align 4</div><div class=""> %p.next = getelementptr inbounds i32, i32* %p, i32 1</div><div class=""> br label %bssLoopTest</div><div class=""> </div><div class="">clearCompleted:</div><div class=""> ret void</div><div class="">}</div><div class="">;————</div><div class=""><div class=""><br class=""></div><div class="">It works, opt preserves the while loop.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Pierre Molinaro</div><div class=""><br class=""></div></div></div></div></div></div><div><blockquote type="cite" class=""><div class="">Le 28 août 2015 à 17:59, Reid Kleckner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Fri, Aug 28, 2015 at 8:27 AM, Joerg Sonnenberger via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Aug 28, 2015 at 04:52:56PM +0200, devh8h via llvm-dev wrote:<br class="">
> Is there a way to prevent the optimizer to assume the two variables<br class="">
> are distinct ? Or what is the proper way to deal with link time values ?<br class="">
<br class="">
</span>Make one of them weak.<br class=""></blockquote><div class=""><br class=""></div><div class="">It'd be better to make the both zero-sized, like an array of i8 with zero elements. This idiom has come up before, and that's our recommended solution. We've tweaked the optimizers to ensure that zero-sized objects are not assumed to be distinct. </div></div></div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></body></html>