<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>This is a good question.  Would it be possible for ASan to do its instrumentation earlier?  </div>
</div></blockquote><div><br></div><div>It would be possible but undesirable. </div><div>First, asan blows up the IR and running asan early will increase the compile-time. </div><div>Second, asan greatly benefits from all optimizations running before it because it needs to instrument less memory accesses. </div>
<div>It actually benefits from load widening too: in the test case above asan instruments only one load instead of two. </div><div><br></div><div>In this case, we have an array of 22 bytes which is 16-aligned. </div><div>
I suspect that load widening changed the alignment of alloca instruction to make the transformation legal. Right? </div><div>Can we change the load widening algorithm to also change the size of alloca instruction to be dividable by 16? </div>
<div>This will solve the problem, at least the variant I observe now. </div><div><br></div><div>--kcc </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>I supposed we could add a "do not widen" metadata hint on load instructions or something like that.</div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div>
</blockquote></div>