[PATCH] [compiler-rt] Fix alloca_instruments_all_paddings.cc test to work under higher -O levels

Kuba Brecka kuba.brecka at gmail.com
Sun Feb 22 03:10:13 PST 2015


Updating patch.


http://reviews.llvm.org/D7810

Files:
  lib/Transforms/Instrumentation/AddressSanitizer.cpp
  projects/compiler-rt/test/asan/TestCases/alloca_instruments_all_paddings.cc

Index: lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1646,8 +1646,10 @@
 
   if (ClInstrumentAllocas)
     // Handle dynamic allocas.
-    for (auto &AllocaCall : DynamicAllocaVec)
+    for (auto &AllocaCall : DynamicAllocaVec) {
       handleDynamicAllocaCall(AllocaCall);
+      unpoisonDynamicAlloca(AllocaCall);
+    }
 
   if (AllocaVec.size() == 0) return;
 
@@ -1826,11 +1828,6 @@
     }
   }
 
-  if (ClInstrumentAllocas)
-    // Unpoison dynamic allocas.
-    for (auto &AllocaCall : DynamicAllocaVec)
-      unpoisonDynamicAlloca(AllocaCall);
-
   // We are done. Remove the old unused alloca instructions.
   for (auto AI : AllocaVec)
     AI->eraseFromParent();
Index: projects/compiler-rt/test/asan/TestCases/alloca_instruments_all_paddings.cc
===================================================================
--- projects/compiler-rt/test/asan/TestCases/alloca_instruments_all_paddings.cc
+++ projects/compiler-rt/test/asan/TestCases/alloca_instruments_all_paddings.cc
@@ -1,4 +1,5 @@
 // RUN: %clangxx_asan -O0 -mllvm -asan-instrument-allocas %s -o %t
+// RUN: %clangxx_asan -O3 -mllvm -asan-instrument-allocas %s -o %t
 // RUN: %run %t 2>&1
 //

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7810.20473.patch
Type: text/x-patch
Size: 1355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150222/34285e09/attachment.bin>


More information about the llvm-commits mailing list