enable TBAA when -fthread-sanitizer is given, even with -O0 or -relaxed-aliasing

llvm-svn: 155430
This commit is contained in:
Kostya Serebryany
2012-04-24 06:57:01 +00:00
parent 0b65c40821
commit 5dd2cfc81e
4 changed files with 25 additions and 6 deletions

View File

@@ -102,9 +102,10 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
if (LangOpts.CUDA)
createCUDARuntime();
// Enable TBAA unless it's suppressed.
if (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0)
TBAA = new CodeGenTBAA(Context, VMContext, getLangOpts(),
// Enable TBAA unless it's suppressed. ThreadSanitizer needs TBAA even at O0.
if (LangOpts.ThreadSanitizer ||
(!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0))
TBAA = new CodeGenTBAA(Context, VMContext, CodeGenOpts, getLangOpts(),
ABI.getMangleContext());
// If debug info or coverage generation is enabled, create the CGDebugInfo