please review: preserve temp names under asan/msan (PR17303)

Kostya Serebryany kcc at google.com
Mon Oct 21 05:11:27 PDT 2013


Eli,

Sending a patch according to http://llvm.org/bugs/show_bug.cgi?id=17303#c8

--- lib/CodeGen/CGExpr.cpp      (revision 193069)
+++ lib/CodeGen/CGExpr.cpp      (working copy)
@@ -52,7 +52,9 @@
 /// block.
 llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty,
                                                     const Twine &Name) {
-  if (!Builder.isNamePreserving())
+  // AddressSanitizer and MemorySanitizer need temp names.
+  // FIXME: this may need a better solution, see PR17303.
+  if (!Builder.isNamePreserving() && !SanOpts->Address && !SanOpts->Memory)
     return new llvm::AllocaInst(Ty, 0, "", AllocaInsertPt);
   return new llvm::AllocaInst(Ty, 0, Name, AllocaInsertPt);
 }


I did not find a way to test it in clang w/o depending on asan/msan.
If I do a lit test in test/CodeGen/ and invoke clang with -emit-llvm
-fsanitize=address,
it actually runs the asan LLVM pass and only then emits IR.
Is there some standard way to output IR before it goes into optimizations?
I tried adding -disable-llvm-optzns (per Chandler's suggestion) -- did not
help.
I'll make another test in compiler-rt anyway.


Thanks,
--kcc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131021/f8b7551d/attachment.html>


More information about the cfe-commits mailing list