[LLVMdev] load widening conflicts with AddressSanitizer

Kostya Serebryany kcc at google.com
Fri Dec 16 14:27:31 PST 2011


>
> This is a good question.  Would it be possible for ASan to do its
> instrumentation earlier?
>

It would be possible but undesirable.
First, asan blows up the IR and running asan early will increase the
compile-time.
Second, asan greatly benefits from all optimizations running before it
because it needs to instrument less memory accesses.
It actually benefits from load widening too: in the test case above asan
instruments only one load instead of two.

In this case, we have an array of 22 bytes which is 16-aligned.
I suspect that load widening changed the alignment of alloca instruction to
make the transformation legal. Right?
Can we change the load widening algorithm to also change the size of alloca
instruction to be dividable by 16?
This will solve the problem, at least the variant I observe now.

--kcc



> I supposed we could add a "do not widen" metadata hint on load
> instructions or something like that.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111216/87f110ed/attachment.html>


More information about the llvm-dev mailing list