aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-02-26 06:58:09 +0000
committerKostya Serebryany <kcc@google.com>2013-02-26 06:58:09 +0000
commit8eec41fc778e99d42172a7f6de76faa43a6d8847 (patch)
treea6b89a9fb83eab1457104a996ea7798c9068ec10
parentce522ee0a27062390f13e7ccb53fcff4fc36c473 (diff)
Unify clang/llvm attributes for asan/tsan/msan (LLVM part)
These are two related changes (one in llvm, one in clang). LLVM: - rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode) - rename thread_safety => sanitize_thread - rename no_uninitialized_checks -> sanitize_memory CLANG: - add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis)) - add __attribute__((no_sanitize_thread)) - add __attribute__((no_sanitize_memory)) for S in address thread memory If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not set llvm attribute sanitize_S git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176075 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/LangRef.rst18
-rw-r--r--include/llvm/IR/Attributes.h6
-rw-r--r--lib/Analysis/MemoryDependenceAnalysis.cpp4
-rw-r--r--lib/AsmParser/LLLexer.cpp6
-rw-r--r--lib/AsmParser/LLParser.cpp94
-rw-r--r--lib/AsmParser/LLToken.h6
-rw-r--r--lib/IR/Attributes.cpp24
-rw-r--r--lib/IR/Verifier.cpp6
-rw-r--r--lib/Transforms/Instrumentation/AddressSanitizer.cpp4
-rw-r--r--test/Bitcode/attributes.ll12
-rw-r--r--test/CodeGen/X86/crash.ll2
-rw-r--r--test/Instrumentation/AddressSanitizer/X86/bug_11395.ll4
-rw-r--r--test/Instrumentation/AddressSanitizer/asan-vs-gvn.ll6
-rw-r--r--test/Instrumentation/AddressSanitizer/basic.ll12
-rw-r--r--test/Instrumentation/AddressSanitizer/debug_info.ll2
-rw-r--r--test/Instrumentation/AddressSanitizer/different_scale_and_offset.ll2
-rw-r--r--test/Instrumentation/AddressSanitizer/do-not-instrument-internal-globals.ll2
-rw-r--r--test/Instrumentation/AddressSanitizer/instrument-no-return.ll6
-rw-r--r--test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll10
-rw-r--r--test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll2
-rw-r--r--test/Instrumentation/AddressSanitizer/lifetime.ll6
-rw-r--r--test/Instrumentation/AddressSanitizer/test64.ll6
-rw-r--r--test/Instrumentation/ThreadSanitizer/tsan-vs-gvn.ll4
-rw-r--r--utils/llvm.grm6
-rw-r--r--utils/vim/llvm.vim4
25 files changed, 127 insertions, 127 deletions
diff --git a/docs/LangRef.rst b/docs/LangRef.rst
index 84680df731..c08cee1dbd 100644
--- a/docs/LangRef.rst
+++ b/docs/LangRef.rst
@@ -793,9 +793,6 @@ example:
define void @f() alwaysinline optsize { ... }
define void @f() optsize { ... }
-``address_safety``
- This attribute indicates that the address safety analysis is enabled
- for this function.
``alignstack(<n>)``
This attribute indicates that, when emitting the prologue and
epilogue, the backend should forcibly align the stack pointer.
@@ -873,6 +870,15 @@ example:
``setjmp`` is an example of such a function. The compiler disables
some optimizations (like tail calls) in the caller of these
functions.
+``sanitize_address``
+ This attribute indicates that AddressSanitizer checks
+ (dynamic address safety analysis) are enabled for this function.
+``sanitize_memory``
+ This attribute indicates that MemorySanitizer checks (dynamic detection
+ of accesses to uninitialized memory) are enabled for this function.
+``sanitize_thread``
+ This attribute indicates that ThreadSanitizer checks
+ (dynamic thread safety analysis) are enabled for this function.
``ssp``
This attribute indicates that the function should emit a stack
smashing protector. It is in the form of a "canary" --- a random value
@@ -914,12 +920,6 @@ example:
If a function that has an ``sspstrong`` attribute is inlined into a
function that doesn't have an ``sspstrong`` attribute, then the
resulting function will have an ``sspstrong`` attribute.
-``thread_safety``
- This attribute indicates that the thread safety analysis is enabled
- for this function.
-``uninitialized_checks``
- This attribute indicates that the checks for uses of uninitialized
- memory are enabled.
``uwtable``
This attribute indicates that the ABI being targeted requires that
an unwind table entry be produce for this function even if we can
diff --git a/include/llvm/IR/Attributes.h b/include/llvm/IR/Attributes.h
index f207ad6f75..30c0965337 100644
--- a/include/llvm/IR/Attributes.h
+++ b/include/llvm/IR/Attributes.h
@@ -63,7 +63,6 @@ public:
enum AttrKind {
// IR-Level Attributes
None, ///< No attributes have been set
- AddressSafety, ///< Address safety checking is on.
Alignment, ///< Alignment of parameter (5 bits)
///< stored as log2 of alignment with +1 bias
///< 0 means unaligned (different from align(1))
@@ -98,8 +97,9 @@ public:
StackProtectReq, ///< Stack protection required.
StackProtectStrong, ///< Strong Stack protection.
StructRet, ///< Hidden pointer to structure to return
- ThreadSafety, ///< Thread safety checking is on.
- UninitializedChecks, ///< Checking for uses of uninitialized memory is on.
+ SanitizeAddress, ///< AddressSanitizer is on.
+ SanitizeThread, ///< ThreadSanitizer is on.
+ SanitizeMemory, ///< MemorySanitizer is on.
UWTable, ///< Function must be in a unwind table
ZExt, ///< Zero extended before/after call
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index 9a1edc763f..38bf5dde39 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -287,7 +287,7 @@ getLoadLoadClobberFullWidthSize(const Value *MemLocBase, int64_t MemLocOffs,
// Load widening is hostile to ThreadSanitizer: it may cause false positives
// or make the reports more cryptic (access sizes are wrong).
if (LI->getParent()->getParent()->getAttributes().
- hasAttribute(AttributeSet::FunctionIndex, Attribute::ThreadSafety))
+ hasAttribute(AttributeSet::FunctionIndex, Attribute::SanitizeThread))
return 0;
// Get the base of this load.
@@ -334,7 +334,7 @@ getLoadLoadClobberFullWidthSize(const Value *MemLocBase, int64_t MemLocOffs,
if (LIOffs+NewLoadByteSize > MemLocEnd &&
LI->getParent()->getParent()->getAttributes().
- hasAttribute(AttributeSet::FunctionIndex, Attribute::AddressSafety))
+ hasAttribute(AttributeSet::FunctionIndex, Attribute::SanitizeAddress))
// We will be reading past the location accessed by the original program.
// While this is safe in a regular build, Address Safety analysis tools
// may start reporting false warnings. So, don't do widening.
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp
index 2b14559f3e..f46383be7e 100644
--- a/lib/AsmParser/LLLexer.cpp
+++ b/lib/AsmParser/LLLexer.cpp
@@ -562,7 +562,6 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(attributes);
- KEYWORD(address_safety);
KEYWORD(alwaysinline);
KEYWORD(byval);
KEYWORD(inlinehint);
@@ -589,8 +588,9 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(ssp);
KEYWORD(sspreq);
KEYWORD(sspstrong);
- KEYWORD(thread_safety);
- KEYWORD(uninitialized_checks);
+ KEYWORD(sanitize_address);
+ KEYWORD(sanitize_thread);
+ KEYWORD(sanitize_memory);
KEYWORD(uwtable);
KEYWORD(zeroext);
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index bde18cd9fc..c8da1f8bc6 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -907,29 +907,29 @@ bool LLParser::ParseFnAttributeValuePairs(AttrBuilder &B,
B.addStackAlignmentAttr(Alignment);
continue;
}
- case lltok::kw_address_safety: B.addAttribute(Attribute::AddressSafety); break;
- case lltok::kw_alwaysinline: B.addAttribute(Attribute::AlwaysInline); break;
- case lltok::kw_inlinehint: B.addAttribute(Attribute::InlineHint); break;
- case lltok::kw_minsize: B.addAttribute(Attribute::MinSize); break;
- case lltok::kw_naked: B.addAttribute(Attribute::Naked); break;
- case lltok::kw_nobuiltin: B.addAttribute(Attribute::NoBuiltin); break;
- case lltok::kw_noduplicate: B.addAttribute(Attribute::NoDuplicate); break;
- case lltok::kw_noimplicitfloat: B.addAttribute(Attribute::NoImplicitFloat); break;
- case lltok::kw_noinline: B.addAttribute(Attribute::NoInline); break;
- case lltok::kw_nonlazybind: B.addAttribute(Attribute::NonLazyBind); break;
- case lltok::kw_noredzone: B.addAttribute(Attribute::NoRedZone); break;
- case lltok::kw_noreturn: B.addAttribute(Attribute::NoReturn); break;
- case lltok::kw_nounwind: B.addAttribute(Attribute::NoUnwind); break;
- case lltok::kw_optsize: B.addAttribute(Attribute::OptimizeForSize); break;
- case lltok::kw_readnone: B.addAttribute(Attribute::ReadNone); break;
- case lltok::kw_readonly: B.addAttribute(Attribute::ReadOnly); break;
- case lltok::kw_returns_twice: B.addAttribute(Attribute::ReturnsTwice); break;
- case lltok::kw_ssp: B.addAttribute(Attribute::StackProtect); break;
- case lltok::kw_sspreq: B.addAttribute(Attribute::StackProtectReq); break;
- case lltok::kw_sspstrong: B.addAttribute(Attribute::StackProtectStrong); break;
- case lltok::kw_thread_safety: B.addAttribute(Attribute::ThreadSafety); break;
- case lltok::kw_uninitialized_checks: B.addAttribute(Attribute::UninitializedChecks); break;
- case lltok::kw_uwtable: B.addAttribute(Attribute::UWTable); break;
+ case lltok::kw_alwaysinline: B.addAttribute(Attribute::AlwaysInline); break;
+ case lltok::kw_inlinehint: B.addAttribute(Attribute::InlineHint); break;
+ case lltok::kw_minsize: B.addAttribute(Attribute::MinSize); break;
+ case lltok::kw_naked: B.addAttribute(Attribute::Naked); break;
+ case lltok::kw_nobuiltin: B.addAttribute(Attribute::NoBuiltin); break;
+ case lltok::kw_noduplicate: B.addAttribute(Attribute::NoDuplicate); break;
+ case lltok::kw_noimplicitfloat: B.addAttribute(Attribute::NoImplicitFloat); break;
+ case lltok::kw_noinline: B.addAttribute(Attribute::NoInline); break;
+ case lltok::kw_nonlazybind: B.addAttribute(Attribute::NonLazyBind); break;
+ case lltok::kw_noredzone: B.addAttribute(Attribute::NoRedZone); break;
+ case lltok::kw_noreturn: B.addAttribute(Attribute::NoReturn); break;
+ case lltok::kw_nounwind: B.addAttribute(Attribute::NoUnwind); break;
+ case lltok::kw_optsize: B.addAttribute(Attribute::OptimizeForSize); break;
+ case lltok::kw_readnone: B.addAttribute(Attribute::ReadNone); break;
+ case lltok::kw_readonly: B.addAttribute(Attribute::ReadOnly); break;
+ case lltok::kw_returns_twice: B.addAttribute(Attribute::ReturnsTwice); break;
+ case lltok::kw_ssp: B.addAttribute(Attribute::StackProtect); break;
+ case lltok::kw_sspreq: B.addAttribute(Attribute::StackProtectReq); break;
+ case lltok::kw_sspstrong: B.addAttribute(Attribute::StackProtectStrong); break;
+ case lltok::kw_sanitize_address: B.addAttribute(Attribute::SanitizeAddress); break;
+ case lltok::kw_sanitize_thread: B.addAttribute(Attribute::SanitizeThread); break;
+ case lltok::kw_sanitize_memory: B.addAttribute(Attribute::SanitizeMemory); break;
+ case lltok::kw_uwtable: B.addAttribute(Attribute::UWTable); break;
// Error handling.
case lltok::kw_inreg:
@@ -1159,17 +1159,17 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) {
case lltok::kw_sret: B.addAttribute(Attribute::StructRet); break;
case lltok::kw_zeroext: B.addAttribute(Attribute::ZExt); break;
- case lltok::kw_noreturn: case lltok::kw_nounwind:
- case lltok::kw_uwtable: case lltok::kw_returns_twice:
- case lltok::kw_noinline: case lltok::kw_readnone:
- case lltok::kw_readonly: case lltok::kw_inlinehint:
- case lltok::kw_alwaysinline: case lltok::kw_optsize:
- case lltok::kw_ssp: case lltok::kw_sspreq:
- case lltok::kw_noredzone: case lltok::kw_noimplicitfloat:
- case lltok::kw_naked: case lltok::kw_nonlazybind:
- case lltok::kw_address_safety: case lltok::kw_minsize:
- case lltok::kw_alignstack: case lltok::kw_thread_safety:
- case lltok::kw_nobuiltin: case lltok::kw_uninitialized_checks:
+ case lltok::kw_alignstack: case lltok::kw_nounwind:
+ case lltok::kw_alwaysinline: case lltok::kw_optsize:
+ case lltok::kw_inlinehint: case lltok::kw_readnone:
+ case lltok::kw_minsize: case lltok::kw_readonly:
+ case lltok::kw_naked: case lltok::kw_returns_twice:
+ case lltok::kw_nobuiltin: case lltok::kw_sanitize_address:
+ case lltok::kw_noimplicitfloat: case lltok::kw_sanitize_memory:
+ case lltok::kw_noinline: case lltok::kw_sanitize_thread:
+ case lltok::kw_nonlazybind: case lltok::kw_ssp:
+ case lltok::kw_noredzone: case lltok::kw_sspreq:
+ case lltok::kw_noreturn: case lltok::kw_uwtable:
HaveError |= Error(Lex.getLoc(), "invalid use of function-only attribute");
break;
}
@@ -1200,19 +1200,19 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) {
HaveError |= Error(Lex.getLoc(), "invalid use of parameter-only attribute");
break;
- case lltok::kw_noreturn: case lltok::kw_nounwind:
- case lltok::kw_uwtable: case lltok::kw_returns_twice:
- case lltok::kw_noinline: case lltok::kw_readnone:
- case lltok::kw_readonly: case lltok::kw_inlinehint:
- case lltok::kw_alwaysinline: case lltok::kw_optsize:
- case lltok::kw_ssp: case lltok::kw_sspreq:
- case lltok::kw_sspstrong: case lltok::kw_noimplicitfloat:
- case lltok::kw_noredzone: case lltok::kw_naked:
- case lltok::kw_nonlazybind: case lltok::kw_address_safety:
- case lltok::kw_minsize: case lltok::kw_alignstack:
- case lltok::kw_align: case lltok::kw_noduplicate:
- case lltok::kw_thread_safety: case lltok::kw_uninitialized_checks:
- case lltok::kw_nobuiltin:
+ case lltok::kw_align: case lltok::kw_noreturn:
+ case lltok::kw_alignstack: case lltok::kw_nounwind:
+ case lltok::kw_alwaysinline: case lltok::kw_optsize:
+ case lltok::kw_inlinehint: case lltok::kw_readnone:
+ case lltok::kw_minsize: case lltok::kw_readonly:
+ case lltok::kw_naked: case lltok::kw_returns_twice:
+ case lltok::kw_nobuiltin: case lltok::kw_sanitize_address:
+ case lltok::kw_noduplicate: case lltok::kw_sanitize_memory:
+ case lltok::kw_noimplicitfloat: case lltok::kw_sanitize_thread:
+ case lltok::kw_noinline: case lltok::kw_ssp:
+ case lltok::kw_nonlazybind: case lltok::kw_sspreq:
+ case lltok::kw_noredzone: case lltok::kw_sspstrong:
+ case lltok::kw_uwtable:
HaveError |= Error(Lex.getLoc(), "invalid use of function-only attribute");
break;
}
diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h
index a51dadacf0..cd25ba3000 100644
--- a/lib/AsmParser/LLToken.h
+++ b/lib/AsmParser/LLToken.h
@@ -94,7 +94,7 @@ namespace lltok {
// Attributes:
kw_attributes,
kw_alwaysinline,
- kw_address_safety,
+ kw_sanitize_address,
kw_byval,
kw_inlinehint,
kw_inreg,
@@ -120,8 +120,8 @@ namespace lltok {
kw_sspreq,
kw_sspstrong,
kw_sret,
- kw_thread_safety,
- kw_uninitialized_checks,
+ kw_sanitize_thread,
+ kw_sanitize_memory,
kw_uwtable,
kw_zeroext,
diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp
index 11ed82d795..6eb51f0edc 100644
--- a/lib/IR/Attributes.cpp
+++ b/lib/IR/Attributes.cpp
@@ -153,8 +153,8 @@ unsigned Attribute::getStackAlignment() const {
std::string Attribute::getAsString(bool InAttrGrp) const {
if (!pImpl) return "";
- if (hasAttribute(Attribute::AddressSafety))
- return "address_safety";
+ if (hasAttribute(Attribute::SanitizeAddress))
+ return "sanitize_address";
if (hasAttribute(Attribute::AlwaysInline))
return "alwaysinline";
if (hasAttribute(Attribute::ByVal))
@@ -207,10 +207,10 @@ std::string Attribute::getAsString(bool InAttrGrp) const {
return "sspstrong";
if (hasAttribute(Attribute::StructRet))
return "sret";
- if (hasAttribute(Attribute::ThreadSafety))
- return "thread_safety";
- if (hasAttribute(Attribute::UninitializedChecks))
- return "uninitialized_checks";
+ if (hasAttribute(Attribute::SanitizeThread))
+ return "sanitize_thread";
+ if (hasAttribute(Attribute::SanitizeMemory))
+ return "sanitize_memory";
if (hasAttribute(Attribute::UWTable))
return "uwtable";
if (hasAttribute(Attribute::ZExt))
@@ -386,12 +386,12 @@ uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) {
case Attribute::ReturnsTwice: return 1 << 29;
case Attribute::UWTable: return 1 << 30;
case Attribute::NonLazyBind: return 1U << 31;
- case Attribute::AddressSafety: return 1ULL << 32;
+ case Attribute::SanitizeAddress: return 1ULL << 32;
case Attribute::MinSize: return 1ULL << 33;
case Attribute::NoDuplicate: return 1ULL << 34;
case Attribute::StackProtectStrong: return 1ULL << 35;
- case Attribute::ThreadSafety: return 1ULL << 36;
- case Attribute::UninitializedChecks: return 1ULL << 37;
+ case Attribute::SanitizeThread: return 1ULL << 36;
+ case Attribute::SanitizeMemory: return 1ULL << 37;
case Attribute::NoBuiltin: return 1ULL << 38;
}
llvm_unreachable("Unsupported attribute type");
@@ -1119,9 +1119,9 @@ void AttrBuilder::removeFunctionOnlyAttrs() {
.removeAttribute(Attribute::UWTable)
.removeAttribute(Attribute::NonLazyBind)
.removeAttribute(Attribute::ReturnsTwice)
- .removeAttribute(Attribute::AddressSafety)
- .removeAttribute(Attribute::ThreadSafety)
- .removeAttribute(Attribute::UninitializedChecks)
+ .removeAttribute(Attribute::SanitizeAddress)
+ .removeAttribute(Attribute::SanitizeThread)
+ .removeAttribute(Attribute::SanitizeMemory)
.removeAttribute(Attribute::MinSize)
.removeAttribute(Attribute::NoDuplicate)
.removeAttribute(Attribute::NoBuiltin);
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index 33e8ec651d..8bfbb322cf 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -650,9 +650,9 @@ void Verifier::VerifyParameterAttrs(AttributeSet Attrs, uint64_t Idx, Type *Ty,
!Attrs.hasAttribute(Idx, Attribute::UWTable) &&
!Attrs.hasAttribute(Idx, Attribute::NonLazyBind) &&
!Attrs.hasAttribute(Idx, Attribute::ReturnsTwice) &&
- !Attrs.hasAttribute(Idx, Attribute::AddressSafety) &&
- !Attrs.hasAttribute(Idx, Attribute::ThreadSafety) &&
- !Attrs.hasAttribute(Idx, Attribute::UninitializedChecks) &&
+ !Attrs.hasAttribute(Idx, Attribute::SanitizeAddress) &&
+ !Attrs.hasAttribute(Idx, Attribute::SanitizeThread) &&
+ !Attrs.hasAttribute(Idx, Attribute::SanitizeMemory) &&
!Attrs.hasAttribute(Idx, Attribute::MinSize) &&
!Attrs.hasAttribute(Idx, Attribute::NoBuiltin),
"Some attributes in '" + Attrs.getAsString(Idx) +
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index f116657192..6877475b1d 100644
--- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1098,11 +1098,11 @@ bool AddressSanitizer::runOnFunction(Function &F) {
DEBUG(dbgs() << "ASAN instrumenting:\n" << F << "\n");
initializeCallbacks(*F.getParent());
- // If needed, insert __asan_init before checking for AddressSafety attr.
+ // If needed, insert __asan_init before checking for SanitizeAddress attr.
maybeInsertAsanInitAtFunctionEntry(F);
if (!F.getAttributes().hasAttribute(AttributeSet::FunctionIndex,
- Attribute::AddressSafety))
+ Attribute::SanitizeAddress))
return false;
if (!ClDebugFunc.empty() && ClDebugFunc != F.getName())
diff --git a/test/Bitcode/attributes.ll b/test/Bitcode/attributes.ll
index 764dc3f6ea..6c46e94012 100644
--- a/test/Bitcode/attributes.ll
+++ b/test/Bitcode/attributes.ll
@@ -157,17 +157,17 @@ define void @f26() nonlazybind
ret void;
}
-define void @f27() address_safety
+define void @f27() sanitize_address
; CHECK: define void @f27() #17
{
ret void;
}
-define void @f28() thread_safety
+define void @f28() sanitize_thread
; CHECK: define void @f28() #18
{
ret void;
}
-define void @f29() uninitialized_checks
+define void @f29() sanitize_memory
; CHECK: define void @f29() #19
{
ret void;
@@ -196,7 +196,7 @@ define void @f30() "cpu"="cortex-a8"
; CHECK: attributes #14 = { returns_twice }
; CHECK: attributes #15 = { uwtable }
; CHECK: attributes #16 = { nonlazybind }
-; CHECK: attributes #17 = { address_safety }
-; CHECK: attributes #18 = { thread_safety }
-; CHECK: attributes #19 = { uninitialized_checks }
+; CHECK: attributes #17 = { sanitize_address }
+; CHECK: attributes #18 = { sanitize_thread }
+; CHECK: attributes #19 = { sanitize_memory }
; CHECK: attributes #20 = { "cpu"="cortex-a8" }
diff --git a/test/CodeGen/X86/crash.ll b/test/CodeGen/X86/crash.ll
index 276d0db9a4..6d2196206e 100644
--- a/test/CodeGen/X86/crash.ll
+++ b/test/CodeGen/X86/crash.ll
@@ -431,7 +431,7 @@ return: ; preds = %entry
; uitofp expands to an FCMOV instruction which splits the basic block.
; Make sure the live range of %AL isn't split.
@.str = private unnamed_addr constant { [1 x i8], [63 x i8] } zeroinitializer, align 32
-define void @pr13188(i64* nocapture %this) uwtable ssp address_safety align 2 {
+define void @pr13188(i64* nocapture %this) uwtable ssp sanitize_address align 2 {
entry:
%x7 = load i64* %this, align 8
%sub = add i64 %x7, -1
diff --git a/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll b/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll
index 35c5c4a0bb..38168fc2d6 100644
--- a/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll
+++ b/test/Instrumentation/AddressSanitizer/X86/bug_11395.ll
@@ -36,14 +36,14 @@ target triple = "i386-unknown-linux-gnu"
@ff_mlp_firorder_7 = external global i8
@ff_mlp_firorder_8 = external global i8
-define void @ff_mlp_init_x86(%struct.DSPContext* nocapture %c, %struct.AVCodecContext* nocapture %avctx) nounwind address_safety {
+define void @ff_mlp_init_x86(%struct.DSPContext* nocapture %c, %struct.AVCodecContext* nocapture %avctx) nounwind sanitize_address {
entry:
%mlp_filter_channel = getelementptr inbounds %struct.DSPContext* %c, i32 0, i32 131
store void (i32*, i32*, i32, i32, i32, i32, i32, i32*)* @mlp_filter_channel_x86, void (i32*, i32*, i32, i32, i32, i32, i32, i32*)** %mlp_filter_channel, align 4, !tbaa !0
ret void
}
-define internal void @mlp_filter_channel_x86(i32* %state, i32* %coeff, i32 %firorder, i32 %iirorder, i32 %filter_shift, i32 %mask, i32 %blocksize, i32* %sample_buffer) nounwind address_safety {
+define internal void @mlp_filter_channel_x86(i32* %state, i32* %coeff, i32 %firorder, i32 %iirorder, i32 %filter_shift, i32 %mask, i32 %blocksize, i32* %sample_buffer) nounwind sanitize_address {
entry:
%filter_shift.addr = alloca i32, align 4
%mask.addr = alloca i32, align 4
diff --git a/test/Instrumentation/AddressSanitizer/asan-vs-gvn.ll b/test/Instrumentation/AddressSanitizer/asan-vs-gvn.ll
index c0fe15e9fc..da8f541375 100644
--- a/test/Instrumentation/AddressSanitizer/asan-vs-gvn.ll
+++ b/test/Instrumentation/AddressSanitizer/asan-vs-gvn.ll
@@ -11,9 +11,9 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
@f = global %struct_of_7_bytes_4_aligned zeroinitializer, align 4
-; Accessing bytes 4 and 6, not ok to widen to i32 if address_safety is set.
+; Accessing bytes 4 and 6, not ok to widen to i32 if sanitize_address is set.
-define i32 @test_widening_bad(i8* %P) nounwind ssp noredzone address_safety {
+define i32 @test_widening_bad(i8* %P) nounwind ssp noredzone sanitize_address {
entry:
%tmp = load i8* getelementptr inbounds (%struct_of_7_bytes_4_aligned* @f, i64 0, i32 1), align 4
%conv = zext i8 %tmp to i32
@@ -36,7 +36,7 @@ define void @end_test_widening_bad() {
;; Accessing bytes 4 and 5. Ok to widen to i16.
-define i32 @test_widening_ok(i8* %P) nounwind ssp noredzone address_safety {
+define i32 @test_widening_ok(i8* %P) nounwind ssp noredzone sanitize_address {
entry:
%tmp = load i8* getelementptr inbounds (%struct_of_7_bytes_4_aligned* @f, i64 0, i32 1), align 4
%conv = zext i8 %tmp to i32
diff --git a/test/Instrumentation/AddressSanitizer/basic.ll b/test/Instrumentation/AddressSanitizer/basic.ll
index 2f1b79e504..c477b19904 100644
--- a/test/Instrumentation/AddressSanitizer/basic.ll
+++ b/test/Instrumentation/AddressSanitizer/basic.ll
@@ -5,7 +5,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
-define i32 @test_load(i32* %a) address_safety {
+define i32 @test_load(i32* %a) sanitize_address {
; CHECK: @test_load
; CHECK-NOT: load
; CHECK: %[[LOAD_ADDR:[^ ]*]] = ptrtoint i32* %a to i64
@@ -38,7 +38,7 @@ entry:
ret i32 %tmp1
}
-define void @test_store(i32* %a) address_safety {
+define void @test_store(i32* %a) sanitize_address {
; CHECK: @test_store
; CHECK-NOT: store
; CHECK: %[[STORE_ADDR:[^ ]*]] = ptrtoint i32* %a to i64
@@ -73,7 +73,7 @@ entry:
; Check that asan leaves just one alloca.
declare void @alloca_test_use([10 x i8]*)
-define void @alloca_test() address_safety {
+define void @alloca_test() sanitize_address {
entry:
%x = alloca [10 x i8], align 1
%y = alloca [10 x i8], align 1
@@ -89,7 +89,7 @@ entry:
; CHECK-NOT: = alloca
; CHECK: ret void
-define void @LongDoubleTest(x86_fp80* nocapture %a) nounwind uwtable address_safety {
+define void @LongDoubleTest(x86_fp80* nocapture %a) nounwind uwtable sanitize_address {
entry:
store x86_fp80 0xK3FFF8000000000000000, x86_fp80* %a, align 16
ret void
@@ -101,7 +101,7 @@ entry:
; CHECK: ret void
-define void @i40test(i40* %a, i40* %b) nounwind uwtable address_safety {
+define void @i40test(i40* %a, i40* %b) nounwind uwtable sanitize_address {
entry:
%t = load i40* %a
store i40 %t, i40* %b, align 8
@@ -115,7 +115,7 @@ define void @i40test(i40* %a, i40* %b) nounwind uwtable address_safety {
; CHECK: __asan_report_store_n{{.*}}, i64 5)
; CHECK: ret void
-define void @i80test(i80* %a, i80* %b) nounwind uwtable address_safety {
+define void @i80test(i80* %a, i80* %b) nounwind uwtable sanitize_address {
entry:
%t = load i80* %a
store i80 %t, i80* %b, align 8
diff --git a/test/Instrumentation/AddressSanitizer/debug_info.ll b/test/Instrumentation/AddressSanitizer/debug_info.ll
index f686ac1c52..7822fd06ab 100644
--- a/test/Instrumentation/AddressSanitizer/debug_info.ll
+++ b/test/Instrumentation/AddressSanitizer/debug_info.ll
@@ -6,7 +6,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define i32 @_Z3zzzi(i32 %p) nounwind uwtable address_safety {
+define i32 @_Z3zzzi(i32 %p) nounwind uwtable sanitize_address {
entry:
%p.addr = alloca i32, align 4
%r = alloca i32, align 4
diff --git a/test/Instrumentation/AddressSanitizer/different_scale_and_offset.ll b/test/Instrumentation/AddressSanitizer/different_scale_and_offset.ll
index c07069c2dc..b0371769be 100644
--- a/test/Instrumentation/AddressSanitizer/different_scale_and_offset.ll
+++ b/test/Instrumentation/AddressSanitizer/different_scale_and_offset.ll
@@ -9,7 +9,7 @@ target triple = "x86_64-unknown-linux-gnu"
; CHECK: @__asan_mapping_offset = linkonce_odr constant i64 0
; CHECK: @__asan_mapping_scale = linkonce_odr constant i64 2
-define i32 @test_load(i32* %a) address_safety {
+define i32 @test_load(i32* %a) sanitize_address {
; CHECK: @test_load
; CHECK-NOT: load
; CHECK: %[[LOAD_ADDR:[^ ]*]] = ptrtoint i32* %a to i64
diff --git a/test/Instrumentation/AddressSanitizer/do-not-instrument-internal-globals.ll b/test/Instrumentation/AddressSanitizer/do-not-instrument-internal-globals.ll
index 28d4ac0c0f..2efd6b1e0d 100644
--- a/test/Instrumentation/AddressSanitizer/do-not-instrument-internal-globals.ll
+++ b/test/Instrumentation/AddressSanitizer/do-not-instrument-internal-globals.ll
@@ -5,7 +5,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define void @_Z3barv() uwtable address_safety {
+define void @_Z3barv() uwtable sanitize_address {
entry:
%a = alloca i32, align 4
call void @_Z3fooPi(i32* %a)
diff --git a/test/Instrumentation/AddressSanitizer/instrument-no-return.ll b/test/Instrumentation/AddressSanitizer/instrument-no-return.ll
index 59654cbf20..2d835a3408 100644
--- a/test/Instrumentation/AddressSanitizer/instrument-no-return.ll
+++ b/test/Instrumentation/AddressSanitizer/instrument-no-return.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gnu"
declare void @MyNoReturnFunc(i32) noreturn
-define i32 @Call1(i8* nocapture %arg) uwtable address_safety {
+define i32 @Call1(i8* nocapture %arg) uwtable sanitize_address {
entry:
call void @MyNoReturnFunc(i32 1) noreturn ; The call insn has noreturn attr.
; CHECK: @Call1
@@ -17,7 +17,7 @@ entry:
unreachable
}
-define i32 @Call2(i8* nocapture %arg) uwtable address_safety {
+define i32 @Call2(i8* nocapture %arg) uwtable sanitize_address {
entry:
call void @MyNoReturnFunc(i32 1) ; No noreturn attribure on the call.
; CHECK: @Call2
@@ -29,7 +29,7 @@ entry:
declare i32 @__gxx_personality_v0(...)
-define i64 @Invoke1(i8** %esc) nounwind uwtable ssp address_safety {
+define i64 @Invoke1(i8** %esc) nounwind uwtable ssp sanitize_address {
entry:
invoke void @MyNoReturnFunc(i32 1)
to label %invoke.cont unwind label %lpad
diff --git a/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll b/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll
index 042c06ba96..584db3762b 100644
--- a/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll
+++ b/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll
@@ -23,7 +23,7 @@ entry:
ret void
}
-define internal void @_GLOBAL__I_a() address_safety section ".text.startup" {
+define internal void @_GLOBAL__I_a() sanitize_address section ".text.startup" {
entry:
call void @__cxx_global_var_init()
ret void
@@ -40,7 +40,7 @@ entry:
; CHECK: ret
; Check that xxx is instrumented.
-define void @touch_xxx() address_safety {
+define void @touch_xxx() sanitize_address {
store i32 0, i32 *@xxx, align 4
ret void
; CHECK: define void @touch_xxx
@@ -49,7 +49,7 @@ define void @touch_xxx() address_safety {
}
; Check that XXX is instrumented.
-define void @touch_XXX() address_safety {
+define void @touch_XXX() sanitize_address {
store i32 0, i32 *@XXX, align 4
ret void
; CHECK: define void @touch_XXX
@@ -59,7 +59,7 @@ define void @touch_XXX() address_safety {
; Check that yyy is NOT instrumented (as it does not have dynamic initializer).
-define void @touch_yyy() address_safety {
+define void @touch_yyy() sanitize_address {
store i32 0, i32 *@yyy, align 4
ret void
; CHECK: define void @touch_yyy
@@ -68,7 +68,7 @@ define void @touch_yyy() address_safety {
}
; Check that YYY is NOT instrumented (as it does not have dynamic initializer).
-define void @touch_YYY() address_safety {
+define void @touch_YYY() sanitize_address {
store i32 0, i32 *@YYY, align 4
ret void
; CHECK: define void @touch_YYY
diff --git a/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll b/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll
index 633bf9ae78..23cf6d28ec 100644
--- a/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll
+++ b/test/Instrumentation/AddressSanitizer/instrument_load_then_store.ll
@@ -4,7 +4,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
-define void @IncrementMe(i32* %a) address_safety {
+define void @IncrementMe(i32* %a) sanitize_address {
entry:
%tmp1 = load i32* %a, align 4
%tmp2 = add i32 %tmp1, 1
diff --git a/test/Instrumentation/AddressSanitizer/lifetime.ll b/test/Instrumentation/AddressSanitizer/lifetime.ll
index 982ad085ec..334872865f 100644
--- a/test/Instrumentation/AddressSanitizer/lifetime.ll
+++ b/test/Instrumentation/AddressSanitizer/lifetime.ll
@@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gnu"
declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind
declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind
-define void @lifetime_no_size() address_safety {
+define void @lifetime_no_size() sanitize_address {
entry:
%i = alloca i32, align 4
%i.ptr = bitcast i32* %i to i8*
@@ -23,7 +23,7 @@ entry:
}
; Generic case of lifetime analysis.
-define void @lifetime() address_safety {
+define void @lifetime() sanitize_address {
; CHECK: @lifetime
; Regular variable lifetime intrinsics.
@@ -61,7 +61,7 @@ define void @lifetime() address_safety {
}
; Check that arguments of lifetime may come from phi nodes.
-define void @phi_args(i1 %x) address_safety {
+define void @phi_args(i1 %x) sanitize_address {
; CHECK: @phi_args
entry:
diff --git a/test/Instrumentation/AddressSanitizer/test64.ll b/test/Instrumentation/AddressSanitizer/test64.ll
index b77869b6f0..6aa5c28850 100644
--- a/test/Instrumentation/AddressSanitizer/test64.ll
+++ b/test/Instrumentation/AddressSanitizer/test64.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -asan -S | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
-define i32 @read_4_bytes(i32* %a) address_safety {
+define i32 @read_4_bytes(i32* %a) sanitize_address {
entry:
%tmp1 = load i32* %a, align 4
ret i32 %tmp1
@@ -13,7 +13,7 @@ entry:
; CHECK-NEXT: {{17592186044416|2147450880}}
; CHECK: ret
-define void @example_atomicrmw(i64* %ptr) nounwind uwtable address_safety {
+define void @example_atomicrmw(i64* %ptr) nounwind uwtable sanitize_address {
entry:
%0 = atomicrmw add i64* %ptr, i64 1 seq_cst
ret void
@@ -24,7 +24,7 @@ entry:
; CHECK: atomicrmw
; CHECK: ret
-define void @example_cmpxchg(i64* %ptr, i64 %compare_to, i64 %new_value) nounwind uwtable address_safety {
+define void @example_cmpxchg(i64* %ptr, i64 %compare_to, i64 %new_value) nounwind uwtable sanitize_address {
entry:
%0 = cmpxchg i64* %ptr, i64 %compare_to, i64 %new_value seq_cst
ret void
diff --git a/test/Instrumentation/ThreadSanitizer/tsan-vs-gvn.ll b/test/Instrumentation/ThreadSanitizer/tsan-vs-gvn.ll
index 2eee6a5e73..a83a274bcf 100644
--- a/test/Instrumentation/ThreadSanitizer/tsan-vs-gvn.ll
+++ b/test/Instrumentation/ThreadSanitizer/tsan-vs-gvn.ll
@@ -8,9 +8,9 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
@f = global %struct_of_8_bytes_4_aligned zeroinitializer, align 4
-; Accessing bytes 4 and 6, not ok to widen to i32 if thread_safety is set.
+; Accessing bytes 4 and 6, not ok to widen to i32 if sanitize_thread is set.
-define i32 @test_widening_bad(i8* %P) nounwind ssp noredzone thread_safety {
+define i32 @test_widening_bad(i8* %P) nounwind ssp noredzone sanitize_thread {
entry:
%tmp = load i8* getelementptr inbounds (%struct_of_8_bytes_4_aligned* @f, i64 0, i32 1), align 4
%conv = zext i8 %tmp to i32
diff --git a/utils/llvm.grm b/utils/llvm.grm
index c550434054..d65f075076 100644
--- a/utils/llvm.grm
+++ b/utils/llvm.grm
@@ -174,9 +174,9 @@ FuncAttr ::= noreturn
| sspreq
| returns_twice
| nonlazybind
- | address_safety
- | thread_safety
- | uninitialized_checks
+ | sanitize_address
+ | sanitize_thread
+ | sanitize_memory
;
OptFuncAttrs ::= + _ | OptFuncAttrs FuncAttr ;
diff --git a/utils/vim/llvm.vim b/utils/vim/llvm.vim
index 256ef150ed..830476f158 100644
--- a/utils/vim/llvm.vim
+++ b/utils/vim/llvm.vim
@@ -35,7 +35,7 @@ syn keyword llvmStatement uitofp ule ult umax umin une uno unreachable unwind
syn keyword llvmStatement urem va_arg xchg xor zext
" Keywords.
-syn keyword llvmKeyword acq_rel acquire address_safety addrspace alias align
+syn keyword llvmKeyword acq_rel acquire sanitize_address addrspace alias align
syn keyword llvmKeyword alignstack alwaysinline appending arm_aapcs_vfpcc
syn keyword llvmKeyword arm_aapcscc arm_apcscc asm atomic available_externally
syn keyword llvmKeyword blockaddress byval c catch cc ccc cleanup coldcc common
@@ -55,7 +55,7 @@ syn keyword llvmKeyword singlethread spir_func spir_kernel sret ssp sspreq
syn keyword llvmKeyword sspstrong tail target thread_local to triple
syn keyword llvmKeyword unnamed_addr unordered uwtable volatile weak weak_odr
syn keyword llvmKeyword x86_fastcallcc x86_stdcallcc x86_thiscallcc zeroext
-syn keyword llvmKeyword thread_safety uninitialized_checks
+syn keyword llvmKeyword sanitize_thread sanitize_memory
" Obsolete keywords.
syn keyword llvmError getresult begin end