[asan] Optimize accesses to global arrays with constant index
authorKostya Serebryany <kcc@google.com>
Wed, 16 Oct 2013 14:06:14 +0000 (14:06 +0000)
committerKostya Serebryany <kcc@google.com>
Wed, 16 Oct 2013 14:06:14 +0000 (14:06 +0000)
commit3386d252579ea00d0fc26a3ba7874bec25ce4516
treec7d6ce42f1c7ff9409df701e97ed4c54d22eeda3
parentd77a7669ec1a6bba7e45791b1aa1e65a603dda92
[asan] Optimize accesses to global arrays with constant index

Summary:
Given a global array G[N], which is declared in this CU and has static initializer
avoid instrumenting accesses like G[i], where 'i' is a constant and 0<=i<N.
Also add a bit of stats.

This eliminates ~1% of instrumentations on SPEC2006
and also partially helps when asan is being run together with coverage.

Reviewers: samsonov

Reviewed By: samsonov

CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1947

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192794 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/AddressSanitizer.cpp
test/Instrumentation/AddressSanitizer/asan-vs-gvn.ll
test/Instrumentation/AddressSanitizer/instrument_global.ll