llvm.org GIT mirror llvm / 3797adb
[asan] don't instrument functions with available_externally linkage. This saves a bit of compile time and reduces the number of redundant global strings generated by asan (https://code.google.com/p/address-sanitizer/issues/detail?id=167) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177250 91177308-0d34-0410-b5e6-96231b3b80d8 Kostya Serebryany 6 years ago
2 changed file(s) with 13 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
10941094 bool AddressSanitizer::runOnFunction(Function &F) {
10951095 if (BL->isIn(F)) return false;
10961096 if (&F == AsanCtorFunction) return false;
1097 if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage) return false;
10971098 DEBUG(dbgs() << "ASAN instrumenting:\n" << F << "\n");
10981099 initializeCallbacks(*F.getParent());
10991100
127127 ; CHECK: __asan_report_store_n{{.*}}, i64 10)
128128 ; CHECK: __asan_report_store_n{{.*}}, i64 10)
129129 ; CHECK: ret void
130
131 ; asan should not instrument functions with available_externally linkage.
132 define available_externally i32 @f_available_externally(i32* %a) sanitize_address {
133 entry:
134 %tmp1 = load i32* %a
135 ret i32 %tmp1
136 }
137 ; CHECK: @f_available_externally
138 ; CHECK-NOT: __asan_report
139 ; CHECK: ret i32
140
141