[ASan] Disable instrumentation for inalloca variables.
[oota-llvm.git] / lib / Transforms / Instrumentation / AddressSanitizer.cpp
index 538cc850295a78bb44802a22babe7361f7115309..1c51264d7376860fe750df5dce94f08b6b74358c 100644 (file)
@@ -840,7 +840,10 @@ bool AddressSanitizer::isInterestingAlloca(AllocaInst &AI) {
        getAllocaSizeInBytes(&AI) > 0 &&
        // We are only interested in allocas not promotable to registers.
        // Promotable allocas are common under -O0.
-       (!ClSkipPromotableAllocas || !isAllocaPromotable(&AI)));
+       (!ClSkipPromotableAllocas || !isAllocaPromotable(&AI)) &&
+       // inalloca allocas are not treated as static, and we don't want
+       // dynamic alloca instrumentation for them as well.
+       !AI.isUsedWithInAlloca());
 
   ProcessedAllocas[&AI] = IsInteresting;
   return IsInteresting;