[llvm] r220985 - [asan] do not treat inline asm calls as indirect calls
Kostya Serebryany
kcc at google.com
Fri Oct 31 11:38:24 PDT 2014
Author: kcc
Date: Fri Oct 31 13:38:23 2014
New Revision: 220985
URL: http://llvm.org/viewvc/llvm-project?rev=220985&view=rev
Log:
[asan] do not treat inline asm calls as indirect calls
Modified:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/trunk/test/Instrumentation/AddressSanitizer/coverage.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=220985&r1=220984&r2=220985&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Fri Oct 31 13:38:23 2014
@@ -1408,12 +1408,14 @@ void AddressSanitizer::InjectCoverageFor
for (auto I : IndirCalls) {
IRBuilder<> IRB(I);
CallSite CS(I);
+ Value *Callee = CS.getCalledValue();
+ if (dyn_cast<InlineAsm>(Callee)) continue;
GlobalVariable *CalleeCache = new GlobalVariable(
*F.getParent(), Ty, false, GlobalValue::PrivateLinkage,
Constant::getNullValue(Ty), "__asan_gen_callee_cache");
CalleeCache->setAlignment(kCacheAlignment);
IRB.CreateCall2(AsanCovIndirCallFunction,
- IRB.CreatePointerCast(CS.getCalledValue(), IntptrTy),
+ IRB.CreatePointerCast(Callee, IntptrTy),
IRB.CreatePointerCast(CalleeCache, IntptrTy));
}
}
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/coverage.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/coverage.ll?rev=220985&r1=220984&r2=220985&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/coverage.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/coverage.ll Fri Oct 31 13:38:23 2014
@@ -79,6 +79,7 @@ entry:
%1 = load void (%struct.StructWithVptr*)** %vtable, align 8
tail call void %1(%struct.StructWithVptr* %foo)
tail call void %1(%struct.StructWithVptr* %foo)
+ tail call void asm sideeffect "", ""()
ret void
}
More information about the llvm-commits
mailing list