[asan] do not treat inline asm calls as indirect calls
[oota-llvm.git] / lib / Transforms / Instrumentation / AddressSanitizer.cpp
index de7b83d02940c91c6dd84797ee4d878ac6011949..e93c011913f88fceff61d12bcedec2f57ab5d8b6 100644 (file)
@@ -1408,12 +1408,14 @@ void AddressSanitizer::InjectCoverageForIndirectCalls(
   for (auto I : IndirCalls) {
     IRBuilder<> IRB(I);
     CallSite CS(I);
   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,
     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));
   }
 }
                     IRB.CreatePointerCast(CalleeCache, IntptrTy));
   }
 }