[llvm] b559583 - [HWASAN] Support tagged stack pointer
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 26 19:27:32 PDT 2023
Author: Vitaly Buka
Date: 2023-04-26T19:27:19-07:00
New Revision: b5595836bc2636eab4b4902e7e589bdd14615318
URL: https://github.com/llvm/llvm-project/commit/b5595836bc2636eab4b4902e7e589bdd14615318
DIFF: https://github.com/llvm/llvm-project/commit/b5595836bc2636eab4b4902e7e589bdd14615318.diff
LOG: [HWASAN] Support tagged stack pointer
If stack was allocated using regular allocator, it may be tagged
and it will make memToShadow calculate invalid offset.
Also when UAR tag should be the tag of the stack frame pointer.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D149228
Added:
Modified:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca-with-calls.ll
llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca.ll
llvm/test/Instrumentation/HWAddressSanitizer/RISCV/exception-lifetime.ll
llvm/test/Instrumentation/HWAddressSanitizer/RISCV/use-after-scope-setjmp.ll
llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-array.ll
llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-with-calls.ll
llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca.ll
llvm/test/Instrumentation/HWAddressSanitizer/alloca-array.ll
llvm/test/Instrumentation/HWAddressSanitizer/alloca-with-calls.ll
llvm/test/Instrumentation/HWAddressSanitizer/alloca.ll
llvm/test/Instrumentation/HWAddressSanitizer/exception-lifetime.ll
llvm/test/Instrumentation/HWAddressSanitizer/kernel-alloca.ll
llvm/test/Instrumentation/HWAddressSanitizer/stack-coloring.ll
llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope-setjmp.ll
llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index a12a4c0ba178..e6e570ebb330 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -994,7 +994,8 @@ void HWAddressSanitizer::tagAlloca(IRBuilder<> &IRB, AllocaInst *AI, Value *Tag,
ConstantInt::get(IntptrTy, AlignedSize)});
} else {
size_t ShadowSize = Size >> Mapping.Scale;
- Value *ShadowPtr = memToShadow(IRB.CreatePointerCast(AI, IntptrTy), IRB);
+ Value *AddrLong = untagPointer(IRB, IRB.CreatePointerCast(AI, IntptrTy));
+ Value *ShadowPtr = memToShadow(AddrLong, IRB);
// If this memset is not inlined, it will be intercepted in the hwasan
// runtime library. That's OK, because the interceptor skips the checks if
// the address is in the shadow region.
@@ -1070,7 +1071,12 @@ Value *HWAddressSanitizer::getAllocaTag(IRBuilder<> &IRB, Value *StackTag,
}
Value *HWAddressSanitizer::getUARTag(IRBuilder<> &IRB) {
- return ConstantInt::get(IntptrTy, 0);
+ Value *StackPointerLong = getSP(IRB);
+ Value *UARTag =
+ applyTagMask(IRB, IRB.CreateLShr(StackPointerLong, PointerTagShift));
+
+ UARTag->setName("hwasan.uar.tag");
+ return UARTag;
}
// Add a tag to an address.
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca-with-calls.ll b/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca-with-calls.ll
index 5338d16d32b2..6a04bf5b4e5f 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca-with-calls.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca-with-calls.ll
@@ -30,6 +30,7 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[TMP13:%.*]] = or i64 [[TMP1]], 4294967295
; CHECK-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP13]], 1
; CHECK-NEXT: [[TMP14:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP4]], 56
; CHECK-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; CHECK-NEXT: [[TMP15:%.*]] = call i8 @__hwasan_generate_tag()
; CHECK-NEXT: [[TMP16:%.*]] = zext i8 [[TMP15]] to i64
@@ -39,17 +40,20 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP19]] to ptr
; CHECK-NEXT: [[TMP20:%.*]] = trunc i64 [[TMP16]] to i8
; CHECK-NEXT: [[TMP21:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP22:%.*]] = lshr i64 [[TMP21]], 4
-; CHECK-NEXT: [[TMP23:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP22]]
-; CHECK-NEXT: [[TMP24:%.*]] = getelementptr i8, ptr [[TMP23]], i32 0
-; CHECK-NEXT: store i8 4, ptr [[TMP24]], align 1
-; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, ptr [[X]], i32 15
-; CHECK-NEXT: store i8 [[TMP20]], ptr [[TMP25]], align 1
+; CHECK-NEXT: [[TMP22:%.*]] = and i64 [[TMP21]], 72057594037927935
+; CHECK-NEXT: [[TMP23:%.*]] = lshr i64 [[TMP22]], 4
+; CHECK-NEXT: [[TMP24:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP23]]
+; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, ptr [[TMP24]], i32 0
+; CHECK-NEXT: store i8 4, ptr [[TMP25]], align 1
+; CHECK-NEXT: [[TMP26:%.*]] = getelementptr i8, ptr [[X]], i32 15
+; CHECK-NEXT: store i8 [[TMP20]], ptr [[TMP26]], align 1
; CHECK-NEXT: call void @use32(ptr nonnull [[X_HWASAN]])
-; CHECK-NEXT: [[TMP26:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
-; CHECK-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP27]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: [[TMP27:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP28:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP29:%.*]] = and i64 [[TMP28]], 72057594037927935
+; CHECK-NEXT: [[TMP30:%.*]] = lshr i64 [[TMP29]], 4
+; CHECK-NEXT: [[TMP31:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP30]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP31]], i8 [[TMP27]], i64 1, i1 false)
; CHECK-NEXT: ret void
;
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca.ll b/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca.ll
index 5adcafbc37d5..0059412cfb85 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/alloca.ll
@@ -18,6 +18,7 @@ define void @test_alloca() sanitize_hwaddress !dbg !15 {
; DYNAMIC-SHADOW-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[TMP0]] to i64
; DYNAMIC-SHADOW-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 20
; DYNAMIC-SHADOW-NEXT: [[HWASAN_STACK_BASE_TAG:%.*]] = xor i64 [[TMP1]], [[TMP2]]
+; DYNAMIC-SHADOW-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP1]], 56
; DYNAMIC-SHADOW-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; DYNAMIC-SHADOW-NEXT: [[TMP3:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0, !dbg [[DBG10:![0-9]+]]
; DYNAMIC-SHADOW-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG10]]
@@ -26,18 +27,21 @@ define void @test_alloca() sanitize_hwaddress !dbg !15 {
; DYNAMIC-SHADOW-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr, !dbg [[DBG10]]
; DYNAMIC-SHADOW-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8, !dbg [[DBG10]]
; DYNAMIC-SHADOW-NEXT: [[TMP8:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: [[TMP9:%.*]] = lshr i64 [[TMP8]], 4, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[DOTHWASAN_SHADOW]], i64 [[TMP9]], !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[TMP10]], i32 0, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: store i8 4, ptr [[TMP11]], align 1, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: [[TMP12:%.*]] = getelementptr i8, ptr [[X]], i32 15, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: store i8 [[TMP7]], ptr [[TMP12]], align 1, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP9:%.*]] = and i64 [[TMP8]], 72057594037927935, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP10:%.*]] = lshr i64 [[TMP9]], 4, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[DOTHWASAN_SHADOW]], i64 [[TMP10]], !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP12:%.*]] = getelementptr i8, ptr [[TMP11]], i32 0, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: store i8 4, ptr [[TMP12]], align 1, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP13:%.*]] = getelementptr i8, ptr [[X]], i32 15, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: store i8 [[TMP7]], ptr [[TMP13]], align 1, !dbg [[DBG10]]
; DYNAMIC-SHADOW-NEXT: call void @llvm.dbg.value(metadata !DIArgList(ptr [[X]], ptr [[X]]), metadata [[META11:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_tag_offset, 0, DW_OP_LLVM_arg, 1, DW_OP_LLVM_tag_offset, 0, DW_OP_plus, DW_OP_deref)), !dbg [[DBG10]]
; DYNAMIC-SHADOW-NEXT: call void @use32(ptr nonnull [[X_HWASAN]]), !dbg [[DBG13:![0-9]+]]
-; DYNAMIC-SHADOW-NEXT: [[TMP13:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG14:![0-9]+]]
-; DYNAMIC-SHADOW-NEXT: [[TMP14:%.*]] = lshr i64 [[TMP13]], 4, !dbg [[DBG14]]
-; DYNAMIC-SHADOW-NEXT: [[TMP15:%.*]] = getelementptr i8, ptr [[DOTHWASAN_SHADOW]], i64 [[TMP14]], !dbg [[DBG14]]
-; DYNAMIC-SHADOW-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP15]], i8 0, i64 1, i1 false), !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: [[TMP14:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8, !dbg [[DBG14:![0-9]+]]
+; DYNAMIC-SHADOW-NEXT: [[TMP15:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: [[TMP16:%.*]] = and i64 [[TMP15]], 72057594037927935, !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: [[TMP17:%.*]] = lshr i64 [[TMP16]], 4, !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: [[TMP18:%.*]] = getelementptr i8, ptr [[DOTHWASAN_SHADOW]], i64 [[TMP17]], !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP18]], i8 [[TMP14]], i64 1, i1 false), !dbg [[DBG14]]
; DYNAMIC-SHADOW-NEXT: ret void, !dbg [[DBG14]]
;
; ZERO-BASED-SHADOW-LABEL: define void @test_alloca
@@ -48,6 +52,7 @@ define void @test_alloca() sanitize_hwaddress !dbg !15 {
; ZERO-BASED-SHADOW-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[TMP0]] to i64
; ZERO-BASED-SHADOW-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 20
; ZERO-BASED-SHADOW-NEXT: [[HWASAN_STACK_BASE_TAG:%.*]] = xor i64 [[TMP1]], [[TMP2]]
+; ZERO-BASED-SHADOW-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP1]], 56
; ZERO-BASED-SHADOW-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; ZERO-BASED-SHADOW-NEXT: [[TMP3:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0, !dbg [[DBG10:![0-9]+]]
; ZERO-BASED-SHADOW-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG10]]
@@ -56,18 +61,21 @@ define void @test_alloca() sanitize_hwaddress !dbg !15 {
; ZERO-BASED-SHADOW-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr, !dbg [[DBG10]]
; ZERO-BASED-SHADOW-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8, !dbg [[DBG10]]
; ZERO-BASED-SHADOW-NEXT: [[TMP8:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP9:%.*]] = lshr i64 [[TMP8]], 4, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP10:%.*]] = inttoptr i64 [[TMP9]] to ptr, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[TMP10]], i32 0, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: store i8 4, ptr [[TMP11]], align 1, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP12:%.*]] = getelementptr i8, ptr [[X]], i32 15, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: store i8 [[TMP7]], ptr [[TMP12]], align 1, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP9:%.*]] = and i64 [[TMP8]], 72057594037927935, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP10:%.*]] = lshr i64 [[TMP9]], 4, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP11:%.*]] = inttoptr i64 [[TMP10]] to ptr, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP12:%.*]] = getelementptr i8, ptr [[TMP11]], i32 0, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: store i8 4, ptr [[TMP12]], align 1, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP13:%.*]] = getelementptr i8, ptr [[X]], i32 15, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: store i8 [[TMP7]], ptr [[TMP13]], align 1, !dbg [[DBG10]]
; ZERO-BASED-SHADOW-NEXT: call void @llvm.dbg.value(metadata !DIArgList(ptr [[X]], ptr [[X]]), metadata [[META11:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_tag_offset, 0, DW_OP_LLVM_arg, 1, DW_OP_LLVM_tag_offset, 0, DW_OP_plus, DW_OP_deref)), !dbg [[DBG10]]
; ZERO-BASED-SHADOW-NEXT: call void @use32(ptr nonnull [[X_HWASAN]]), !dbg [[DBG13:![0-9]+]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP13:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG14:![0-9]+]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP14:%.*]] = lshr i64 [[TMP13]], 4, !dbg [[DBG14]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP15:%.*]] = inttoptr i64 [[TMP14]] to ptr, !dbg [[DBG14]]
-; ZERO-BASED-SHADOW-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP15]], i8 0, i64 1, i1 false), !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP14:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8, !dbg [[DBG14:![0-9]+]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP15:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP16:%.*]] = and i64 [[TMP15]], 72057594037927935, !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP17:%.*]] = lshr i64 [[TMP16]], 4, !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP18:%.*]] = inttoptr i64 [[TMP17]] to ptr, !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP18]], i8 [[TMP14]], i64 1, i1 false), !dbg [[DBG14]]
; ZERO-BASED-SHADOW-NEXT: ret void, !dbg [[DBG14]]
;
entry:
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/exception-lifetime.ll b/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/exception-lifetime.ll
index c5d4ddfed8ab..afddcb795174 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/exception-lifetime.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/exception-lifetime.ll
@@ -36,6 +36,7 @@ define void @test() sanitize_hwaddress personality ptr @__gxx_personality_v0 {
; CHECK-NEXT: [[TMP13:%.*]] = or i64 [[TMP1]], 4294967295
; CHECK-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP13]], 1
; CHECK-NEXT: [[TMP14:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP4]], 56
; CHECK-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; CHECK-NEXT: [[TMP15:%.*]] = xor i64 [[TMP2]], 0
; CHECK-NEXT: [[TMP16:%.*]] = ptrtoint ptr [[X]] to i64
@@ -47,35 +48,40 @@ define void @test() sanitize_hwaddress personality ptr @__gxx_personality_v0 {
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr [[X]])
; CHECK-NEXT: [[TMP19:%.*]] = trunc i64 [[TMP15]] to i8
; CHECK-NEXT: [[TMP20:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP21:%.*]] = lshr i64 [[TMP20]], 4
-; CHECK-NEXT: [[TMP22:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP21]]
-; CHECK-NEXT: [[TMP23:%.*]] = getelementptr i8, ptr [[TMP22]], i32 0
-; CHECK-NEXT: store i8 4, ptr [[TMP23]], align 1
-; CHECK-NEXT: [[TMP24:%.*]] = getelementptr i8, ptr [[X]], i32 15
-; CHECK-NEXT: store i8 [[TMP19]], ptr [[TMP24]], align 1
+; CHECK-NEXT: [[TMP21:%.*]] = and i64 [[TMP20]], 72057594037927935
+; CHECK-NEXT: [[TMP22:%.*]] = lshr i64 [[TMP21]], 4
+; CHECK-NEXT: [[TMP23:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP22]]
+; CHECK-NEXT: [[TMP24:%.*]] = getelementptr i8, ptr [[TMP23]], i32 0
+; CHECK-NEXT: store i8 4, ptr [[TMP24]], align 1
+; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, ptr [[X]], i32 15
+; CHECK-NEXT: store i8 [[TMP19]], ptr [[TMP25]], align 1
; CHECK-NEXT: invoke void @mayFail(ptr [[X_HWASAN]])
; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
; CHECK: invoke.cont:
-; CHECK-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; CHECK-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP26]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: [[TMP26:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP27:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP28:%.*]] = and i64 [[TMP27]], 72057594037927935
+; CHECK-NEXT: [[TMP29:%.*]] = lshr i64 [[TMP28]], 4
+; CHECK-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP29]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP30]], i8 [[TMP26]], i64 1, i1 false)
; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr [[X]])
; CHECK-NEXT: ret void
; CHECK: lpad:
-; CHECK-NEXT: [[TMP28:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: [[TMP31:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
-; CHECK-NEXT: [[TMP29:%.*]] = extractvalue { ptr, i32 } [[TMP28]], 0
+; CHECK-NEXT: [[TMP32:%.*]] = extractvalue { ptr, i32 } [[TMP31]], 0
; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[TMP14]], ptr [[EXN_SLOT]], i32 19)
-; CHECK-NEXT: store ptr [[TMP29]], ptr [[EXN_SLOT]], align 8
-; CHECK-NEXT: [[TMP30:%.*]] = extractvalue { ptr, i32 } [[TMP28]], 1
+; CHECK-NEXT: store ptr [[TMP32]], ptr [[EXN_SLOT]], align 8
+; CHECK-NEXT: [[TMP33:%.*]] = extractvalue { ptr, i32 } [[TMP31]], 1
; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[TMP14]], ptr [[EHSELECTOR_SLOT]], i32 18)
-; CHECK-NEXT: store i32 [[TMP30]], ptr [[EHSELECTOR_SLOT]], align 4
+; CHECK-NEXT: store i32 [[TMP33]], ptr [[EHSELECTOR_SLOT]], align 4
; CHECK-NEXT: call void @onExcept(ptr [[X_HWASAN]])
-; CHECK-NEXT: [[TMP31:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP32:%.*]] = lshr i64 [[TMP31]], 4
-; CHECK-NEXT: [[TMP33:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP32]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP33]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: [[TMP34:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP35:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP36:%.*]] = and i64 [[TMP35]], 72057594037927935
+; CHECK-NEXT: [[TMP37:%.*]] = lshr i64 [[TMP36]], 4
+; CHECK-NEXT: [[TMP38:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP37]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP38]], i8 [[TMP34]], i64 1, i1 false)
; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr [[X]])
; CHECK-NEXT: br label [[EH_RESUME:%.*]]
; CHECK: eh.resume:
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/use-after-scope-setjmp.ll b/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/use-after-scope-setjmp.ll
index b30a42fe44f3..ead80145dba1 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/use-after-scope-setjmp.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/RISCV/use-after-scope-setjmp.ll
@@ -30,6 +30,7 @@ define dso_local noundef i1 @_Z6targetv() sanitize_hwaddress {
; CHECK-NEXT: [[TMP13:%.*]] = or i64 [[TMP1]], 4294967295
; CHECK-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP13]], 1
; CHECK-NEXT: [[TMP14:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP4]], 56
; CHECK-NEXT: [[BUF:%.*]] = alloca [4096 x i8], align 16
; CHECK-NEXT: [[TMP15:%.*]] = xor i64 [[TMP2]], 0
; CHECK-NEXT: [[TMP16:%.*]] = ptrtoint ptr [[BUF]] to i64
@@ -38,9 +39,10 @@ define dso_local noundef i1 @_Z6targetv() sanitize_hwaddress {
; CHECK-NEXT: [[BUF_HWASAN:%.*]] = inttoptr i64 [[TMP18]] to ptr
; CHECK-NEXT: [[TMP19:%.*]] = trunc i64 [[TMP15]] to i8
; CHECK-NEXT: [[TMP20:%.*]] = ptrtoint ptr [[BUF]] to i64
-; CHECK-NEXT: [[TMP21:%.*]] = lshr i64 [[TMP20]], 4
-; CHECK-NEXT: [[TMP22:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP21]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP22]], i8 [[TMP19]], i64 256, i1 false)
+; CHECK-NEXT: [[TMP21:%.*]] = and i64 [[TMP20]], 72057594037927935
+; CHECK-NEXT: [[TMP22:%.*]] = lshr i64 [[TMP21]], 4
+; CHECK-NEXT: [[TMP23:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP22]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP23]], i8 [[TMP19]], i64 256, i1 false)
; CHECK-NEXT: [[CALL:%.*]] = call i32 @setjmp(ptr noundef @jbuf)
; CHECK-NEXT: switch i32 [[CALL]], label [[WHILE_BODY:%.*]] [
; CHECK-NEXT: i32 1, label [[RETURN:%.*]]
@@ -55,10 +57,12 @@ define dso_local noundef i1 @_Z6targetv() sanitize_hwaddress {
; CHECK-NEXT: br label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi i1 [ true, [[WHILE_BODY]] ], [ true, [[SW_BB1]] ], [ false, [[ENTRY:%.*]] ]
-; CHECK-NEXT: [[TMP23:%.*]] = ptrtoint ptr [[BUF]] to i64
-; CHECK-NEXT: [[TMP24:%.*]] = lshr i64 [[TMP23]], 4
-; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP24]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP25]], i8 0, i64 256, i1 false)
+; CHECK-NEXT: [[TMP24:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[BUF]] to i64
+; CHECK-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; CHECK-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; CHECK-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP27]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 256, i1 false)
; CHECK-NEXT: ret i1 [[RETVAL_0]]
;
entry:
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-array.ll b/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-array.ll
index 4f4cb2b07416..fbce61d0d046 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-array.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-array.ll
@@ -15,25 +15,29 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 20
; CHECK-NEXT: [[TMP4:%.*]] = xor i64 [[TMP2]], [[TMP3]]
; CHECK-NEXT: [[HWASAN_STACK_BASE_TAG:%.*]] = and i64 [[TMP4]], 63
+; CHECK-NEXT: [[TMP5:%.*]] = lshr i64 [[TMP2]], 57
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP5]], 63
; CHECK-NEXT: [[X:%.*]] = alloca { [4 x i8], [12 x i8] }, align 16
-; CHECK-NEXT: [[TMP5:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0
-; CHECK-NEXT: [[TMP6:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP7:%.*]] = shl i64 [[TMP5]], 57
-; CHECK-NEXT: [[TMP8:%.*]] = or i64 [[TMP6]], [[TMP7]]
-; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP8]] to ptr
-; CHECK-NEXT: [[TMP9:%.*]] = trunc i64 [[TMP5]] to i8
-; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP9]], i64 16)
+; CHECK-NEXT: [[TMP6:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0
+; CHECK-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; CHECK-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; CHECK-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP10]], i64 16)
; CHECK-NEXT: [[Y:%.*]] = alloca i8, i64 16, align 16
-; CHECK-NEXT: [[TMP10:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 1
-; CHECK-NEXT: [[TMP11:%.*]] = ptrtoint ptr [[Y]] to i64
-; CHECK-NEXT: [[TMP12:%.*]] = shl i64 [[TMP10]], 57
-; CHECK-NEXT: [[TMP13:%.*]] = or i64 [[TMP11]], [[TMP12]]
-; CHECK-NEXT: [[Y_HWASAN:%.*]] = inttoptr i64 [[TMP13]] to ptr
-; CHECK-NEXT: [[TMP14:%.*]] = trunc i64 [[TMP10]] to i8
-; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[Y]], i8 [[TMP14]], i64 16)
+; CHECK-NEXT: [[TMP11:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 1
+; CHECK-NEXT: [[TMP12:%.*]] = ptrtoint ptr [[Y]] to i64
+; CHECK-NEXT: [[TMP13:%.*]] = shl i64 [[TMP11]], 57
+; CHECK-NEXT: [[TMP14:%.*]] = or i64 [[TMP12]], [[TMP13]]
+; CHECK-NEXT: [[Y_HWASAN:%.*]] = inttoptr i64 [[TMP14]] to ptr
+; CHECK-NEXT: [[TMP15:%.*]] = trunc i64 [[TMP11]] to i8
+; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[Y]], i8 [[TMP15]], i64 16)
; CHECK-NEXT: call void @use(ptr [[X_HWASAN]], ptr [[Y_HWASAN]])
-; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 0, i64 16)
-; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[Y]], i8 0, i64 16)
+; CHECK-NEXT: [[TMP16:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP16]], i64 16)
+; CHECK-NEXT: [[TMP17:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[Y]], i8 [[TMP17]], i64 16)
; CHECK-NEXT: ret void
;
%x = alloca i8, i64 4
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-with-calls.ll b/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-with-calls.ll
index 2f59c686b5a9..fe8b074690c2 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-with-calls.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca-with-calls.ll
@@ -13,17 +13,22 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-SAME: () #[[ATTR0:[0-9]+]] personality ptr @__hwasan_personality_thunk {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
+; CHECK-NEXT: [[TMP0:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[TMP0]] to i64
+; CHECK-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 57
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP2]], 63
; CHECK-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
-; CHECK-NEXT: [[TMP0:%.*]] = call i8 @__hwasan_generate_tag()
-; CHECK-NEXT: [[TMP1:%.*]] = zext i8 [[TMP0]] to i64
-; CHECK-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP3:%.*]] = shl i64 [[TMP1]], 57
-; CHECK-NEXT: [[TMP4:%.*]] = or i64 [[TMP2]], [[TMP3]]
-; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP4]] to ptr
-; CHECK-NEXT: [[TMP5:%.*]] = trunc i64 [[TMP1]] to i8
-; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP5]], i64 16)
+; CHECK-NEXT: [[TMP3:%.*]] = call i8 @__hwasan_generate_tag()
+; CHECK-NEXT: [[TMP4:%.*]] = zext i8 [[TMP3]] to i64
+; CHECK-NEXT: [[TMP5:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP6:%.*]] = shl i64 [[TMP4]], 57
+; CHECK-NEXT: [[TMP7:%.*]] = or i64 [[TMP5]], [[TMP6]]
+; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP7]] to ptr
+; CHECK-NEXT: [[TMP8:%.*]] = trunc i64 [[TMP4]] to i8
+; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP8]], i64 16)
; CHECK-NEXT: call void @use32(ptr nonnull [[X_HWASAN]])
-; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 0, i64 16)
+; CHECK-NEXT: [[TMP9:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP9]], i64 16)
; CHECK-NEXT: ret void
;
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca.ll b/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca.ll
index 2ee0f8de4428..21c1ec49d1a1 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca.ll
@@ -18,16 +18,19 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 20
; CHECK-NEXT: [[TMP3:%.*]] = xor i64 [[TMP1]], [[TMP2]]
; CHECK-NEXT: [[HWASAN_STACK_BASE_TAG:%.*]] = and i64 [[TMP3]], 63
+; CHECK-NEXT: [[TMP4:%.*]] = lshr i64 [[TMP1]], 57
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP4]], 63
; CHECK-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
-; CHECK-NEXT: [[TMP4:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0
-; CHECK-NEXT: [[TMP5:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP6:%.*]] = shl i64 [[TMP4]], 57
-; CHECK-NEXT: [[TMP7:%.*]] = or i64 [[TMP5]], [[TMP6]]
-; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP7]] to ptr
-; CHECK-NEXT: [[TMP8:%.*]] = trunc i64 [[TMP4]] to i8
-; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP8]], i64 16)
+; CHECK-NEXT: [[TMP5:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0
+; CHECK-NEXT: [[TMP6:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP7:%.*]] = shl i64 [[TMP5]], 57
+; CHECK-NEXT: [[TMP8:%.*]] = or i64 [[TMP6]], [[TMP7]]
+; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP8]] to ptr
+; CHECK-NEXT: [[TMP9:%.*]] = trunc i64 [[TMP5]] to i8
+; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP9]], i64 16)
; CHECK-NEXT: call void @use32(ptr nonnull [[X_HWASAN]])
-; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 0, i64 16)
+; CHECK-NEXT: [[TMP10:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: call void @__hwasan_tag_memory(ptr [[X]], i8 [[TMP10]], i64 16)
; CHECK-NEXT: ret void
;
entry:
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/alloca-array.ll b/llvm/test/Instrumentation/HWAddressSanitizer/alloca-array.ll
index 41382cf0f680..b0291776a164 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/alloca-array.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/alloca-array.ll
@@ -29,6 +29,7 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; CHECK-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; CHECK-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; CHECK-NEXT: [[X:%.*]] = alloca { [4 x i8], [12 x i8] }, align 16
; CHECK-NEXT: [[TMP18:%.*]] = xor i64 [[TMP4]], 0
; CHECK-NEXT: [[TMP19:%.*]] = ptrtoint ptr [[X]] to i64
@@ -37,29 +38,35 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP21]] to ptr
; CHECK-NEXT: [[TMP22:%.*]] = trunc i64 [[TMP18]] to i8
; CHECK-NEXT: [[TMP23:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP24:%.*]] = lshr i64 [[TMP23]], 4
-; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP24]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP25]], i8 [[TMP22]], i64 1, i1 false)
+; CHECK-NEXT: [[TMP24:%.*]] = and i64 [[TMP23]], 72057594037927935
+; CHECK-NEXT: [[TMP25:%.*]] = lshr i64 [[TMP24]], 4
+; CHECK-NEXT: [[TMP26:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP25]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP26]], i8 [[TMP22]], i64 1, i1 false)
; CHECK-NEXT: [[Y:%.*]] = alloca i8, i64 16, align 16
-; CHECK-NEXT: [[TMP26:%.*]] = xor i64 [[TMP4]], 128
-; CHECK-NEXT: [[TMP27:%.*]] = ptrtoint ptr [[Y]] to i64
-; CHECK-NEXT: [[TMP28:%.*]] = shl i64 [[TMP26]], 56
-; CHECK-NEXT: [[TMP29:%.*]] = or i64 [[TMP27]], [[TMP28]]
-; CHECK-NEXT: [[Y_HWASAN:%.*]] = inttoptr i64 [[TMP29]] to ptr
-; CHECK-NEXT: [[TMP30:%.*]] = trunc i64 [[TMP26]] to i8
-; CHECK-NEXT: [[TMP31:%.*]] = ptrtoint ptr [[Y]] to i64
-; CHECK-NEXT: [[TMP32:%.*]] = lshr i64 [[TMP31]], 4
-; CHECK-NEXT: [[TMP33:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP32]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP33]], i8 [[TMP30]], i64 1, i1 false)
+; CHECK-NEXT: [[TMP27:%.*]] = xor i64 [[TMP4]], 128
+; CHECK-NEXT: [[TMP28:%.*]] = ptrtoint ptr [[Y]] to i64
+; CHECK-NEXT: [[TMP29:%.*]] = shl i64 [[TMP27]], 56
+; CHECK-NEXT: [[TMP30:%.*]] = or i64 [[TMP28]], [[TMP29]]
+; CHECK-NEXT: [[Y_HWASAN:%.*]] = inttoptr i64 [[TMP30]] to ptr
+; CHECK-NEXT: [[TMP31:%.*]] = trunc i64 [[TMP27]] to i8
+; CHECK-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[Y]] to i64
+; CHECK-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 72057594037927935
+; CHECK-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
+; CHECK-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 [[TMP31]], i64 1, i1 false)
; CHECK-NEXT: call void @use(ptr [[X_HWASAN]], ptr [[Y_HWASAN]])
-; CHECK-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP35:%.*]] = lshr i64 [[TMP34]], 4
-; CHECK-NEXT: [[TMP36:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP35]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP36]], i8 0, i64 1, i1 false)
-; CHECK-NEXT: [[TMP37:%.*]] = ptrtoint ptr [[Y]] to i64
-; CHECK-NEXT: [[TMP38:%.*]] = lshr i64 [[TMP37]], 4
-; CHECK-NEXT: [[TMP39:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP38]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP39]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: [[TMP36:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP37:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP38:%.*]] = and i64 [[TMP37]], 72057594037927935
+; CHECK-NEXT: [[TMP39:%.*]] = lshr i64 [[TMP38]], 4
+; CHECK-NEXT: [[TMP40:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP39]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP40]], i8 [[TMP36]], i64 1, i1 false)
+; CHECK-NEXT: [[TMP41:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP42:%.*]] = ptrtoint ptr [[Y]] to i64
+; CHECK-NEXT: [[TMP43:%.*]] = and i64 [[TMP42]], 72057594037927935
+; CHECK-NEXT: [[TMP44:%.*]] = lshr i64 [[TMP43]], 4
+; CHECK-NEXT: [[TMP45:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP44]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP45]], i8 [[TMP41]], i64 1, i1 false)
; CHECK-NEXT: ret void
;
%x = alloca i8, i64 4
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/alloca-with-calls.ll b/llvm/test/Instrumentation/HWAddressSanitizer/alloca-with-calls.ll
index 018ade98925a..b38ff31628bd 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/alloca-with-calls.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/alloca-with-calls.ll
@@ -32,6 +32,7 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[TMP15:%.*]] = or i64 [[TMP2]], 4294967295
; CHECK-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP15]], 1
; CHECK-NEXT: [[TMP16:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP6]], 56
; CHECK-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; CHECK-NEXT: [[TMP17:%.*]] = call i8 @__hwasan_generate_tag()
; CHECK-NEXT: [[TMP18:%.*]] = zext i8 [[TMP17]] to i64
@@ -41,14 +42,17 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP21]] to ptr
; CHECK-NEXT: [[TMP22:%.*]] = trunc i64 [[TMP18]] to i8
; CHECK-NEXT: [[TMP23:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP24:%.*]] = lshr i64 [[TMP23]], 4
-; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP24]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP25]], i8 [[TMP22]], i64 1, i1 false)
+; CHECK-NEXT: [[TMP24:%.*]] = and i64 [[TMP23]], 72057594037927935
+; CHECK-NEXT: [[TMP25:%.*]] = lshr i64 [[TMP24]], 4
+; CHECK-NEXT: [[TMP26:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP25]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP26]], i8 [[TMP22]], i64 1, i1 false)
; CHECK-NEXT: call void @use32(ptr nonnull [[X_HWASAN]])
-; CHECK-NEXT: [[TMP26:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
-; CHECK-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP27]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: [[TMP27:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP28:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP29:%.*]] = and i64 [[TMP28]], 72057594037927935
+; CHECK-NEXT: [[TMP30:%.*]] = lshr i64 [[TMP29]], 4
+; CHECK-NEXT: [[TMP31:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP30]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP31]], i8 [[TMP27]], i64 1, i1 false)
; CHECK-NEXT: ret void
;
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/alloca.ll b/llvm/test/Instrumentation/HWAddressSanitizer/alloca.ll
index 9a36c26788b3..7f757d3f2977 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/alloca.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/alloca.ll
@@ -18,6 +18,7 @@ define void @test_alloca() sanitize_hwaddress !dbg !15 {
; DYNAMIC-SHADOW-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[TMP0]] to i64
; DYNAMIC-SHADOW-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 20
; DYNAMIC-SHADOW-NEXT: [[HWASAN_STACK_BASE_TAG:%.*]] = xor i64 [[TMP1]], [[TMP2]]
+; DYNAMIC-SHADOW-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP1]], 56
; DYNAMIC-SHADOW-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; DYNAMIC-SHADOW-NEXT: [[TMP3:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0, !dbg [[DBG10:![0-9]+]]
; DYNAMIC-SHADOW-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG10]]
@@ -26,18 +27,21 @@ define void @test_alloca() sanitize_hwaddress !dbg !15 {
; DYNAMIC-SHADOW-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr, !dbg [[DBG10]]
; DYNAMIC-SHADOW-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8, !dbg [[DBG10]]
; DYNAMIC-SHADOW-NEXT: [[TMP8:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: [[TMP9:%.*]] = lshr i64 [[TMP8]], 4, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: [[TMP10:%.*]] = getelementptr i8, ptr [[DOTHWASAN_SHADOW]], i64 [[TMP9]], !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[TMP10]], i32 0, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: store i8 4, ptr [[TMP11]], align 1, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: [[TMP12:%.*]] = getelementptr i8, ptr [[X]], i32 15, !dbg [[DBG10]]
-; DYNAMIC-SHADOW-NEXT: store i8 [[TMP7]], ptr [[TMP12]], align 1, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP9:%.*]] = and i64 [[TMP8]], 72057594037927935, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP10:%.*]] = lshr i64 [[TMP9]], 4, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[DOTHWASAN_SHADOW]], i64 [[TMP10]], !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP12:%.*]] = getelementptr i8, ptr [[TMP11]], i32 0, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: store i8 4, ptr [[TMP12]], align 1, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: [[TMP13:%.*]] = getelementptr i8, ptr [[X]], i32 15, !dbg [[DBG10]]
+; DYNAMIC-SHADOW-NEXT: store i8 [[TMP7]], ptr [[TMP13]], align 1, !dbg [[DBG10]]
; DYNAMIC-SHADOW-NEXT: call void @llvm.dbg.value(metadata !DIArgList(ptr [[X]], ptr [[X]]), metadata [[META11:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_tag_offset, 0, DW_OP_LLVM_arg, 1, DW_OP_LLVM_tag_offset, 0, DW_OP_plus, DW_OP_deref)), !dbg [[DBG10]]
; DYNAMIC-SHADOW-NEXT: call void @use32(ptr nonnull [[X_HWASAN]]), !dbg [[DBG13:![0-9]+]]
-; DYNAMIC-SHADOW-NEXT: [[TMP13:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG14:![0-9]+]]
-; DYNAMIC-SHADOW-NEXT: [[TMP14:%.*]] = lshr i64 [[TMP13]], 4, !dbg [[DBG14]]
-; DYNAMIC-SHADOW-NEXT: [[TMP15:%.*]] = getelementptr i8, ptr [[DOTHWASAN_SHADOW]], i64 [[TMP14]], !dbg [[DBG14]]
-; DYNAMIC-SHADOW-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP15]], i8 0, i64 1, i1 false), !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: [[TMP14:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8, !dbg [[DBG14:![0-9]+]]
+; DYNAMIC-SHADOW-NEXT: [[TMP15:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: [[TMP16:%.*]] = and i64 [[TMP15]], 72057594037927935, !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: [[TMP17:%.*]] = lshr i64 [[TMP16]], 4, !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: [[TMP18:%.*]] = getelementptr i8, ptr [[DOTHWASAN_SHADOW]], i64 [[TMP17]], !dbg [[DBG14]]
+; DYNAMIC-SHADOW-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP18]], i8 [[TMP14]], i64 1, i1 false), !dbg [[DBG14]]
; DYNAMIC-SHADOW-NEXT: ret void, !dbg [[DBG14]]
;
; ZERO-BASED-SHADOW-LABEL: define void @test_alloca
@@ -48,6 +52,7 @@ define void @test_alloca() sanitize_hwaddress !dbg !15 {
; ZERO-BASED-SHADOW-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[TMP0]] to i64
; ZERO-BASED-SHADOW-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 20
; ZERO-BASED-SHADOW-NEXT: [[HWASAN_STACK_BASE_TAG:%.*]] = xor i64 [[TMP1]], [[TMP2]]
+; ZERO-BASED-SHADOW-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP1]], 56
; ZERO-BASED-SHADOW-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; ZERO-BASED-SHADOW-NEXT: [[TMP3:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0, !dbg [[DBG10:![0-9]+]]
; ZERO-BASED-SHADOW-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG10]]
@@ -56,18 +61,21 @@ define void @test_alloca() sanitize_hwaddress !dbg !15 {
; ZERO-BASED-SHADOW-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr, !dbg [[DBG10]]
; ZERO-BASED-SHADOW-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8, !dbg [[DBG10]]
; ZERO-BASED-SHADOW-NEXT: [[TMP8:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP9:%.*]] = lshr i64 [[TMP8]], 4, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP10:%.*]] = inttoptr i64 [[TMP9]] to ptr, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP11:%.*]] = getelementptr i8, ptr [[TMP10]], i32 0, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: store i8 4, ptr [[TMP11]], align 1, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP12:%.*]] = getelementptr i8, ptr [[X]], i32 15, !dbg [[DBG10]]
-; ZERO-BASED-SHADOW-NEXT: store i8 [[TMP7]], ptr [[TMP12]], align 1, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP9:%.*]] = and i64 [[TMP8]], 72057594037927935, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP10:%.*]] = lshr i64 [[TMP9]], 4, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP11:%.*]] = inttoptr i64 [[TMP10]] to ptr, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP12:%.*]] = getelementptr i8, ptr [[TMP11]], i32 0, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: store i8 4, ptr [[TMP12]], align 1, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP13:%.*]] = getelementptr i8, ptr [[X]], i32 15, !dbg [[DBG10]]
+; ZERO-BASED-SHADOW-NEXT: store i8 [[TMP7]], ptr [[TMP13]], align 1, !dbg [[DBG10]]
; ZERO-BASED-SHADOW-NEXT: call void @llvm.dbg.value(metadata !DIArgList(ptr [[X]], ptr [[X]]), metadata [[META11:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_tag_offset, 0, DW_OP_LLVM_arg, 1, DW_OP_LLVM_tag_offset, 0, DW_OP_plus, DW_OP_deref)), !dbg [[DBG10]]
; ZERO-BASED-SHADOW-NEXT: call void @use32(ptr nonnull [[X_HWASAN]]), !dbg [[DBG13:![0-9]+]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP13:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG14:![0-9]+]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP14:%.*]] = lshr i64 [[TMP13]], 4, !dbg [[DBG14]]
-; ZERO-BASED-SHADOW-NEXT: [[TMP15:%.*]] = inttoptr i64 [[TMP14]] to ptr, !dbg [[DBG14]]
-; ZERO-BASED-SHADOW-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP15]], i8 0, i64 1, i1 false), !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP14:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8, !dbg [[DBG14:![0-9]+]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP15:%.*]] = ptrtoint ptr [[X]] to i64, !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP16:%.*]] = and i64 [[TMP15]], 72057594037927935, !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP17:%.*]] = lshr i64 [[TMP16]], 4, !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: [[TMP18:%.*]] = inttoptr i64 [[TMP17]] to ptr, !dbg [[DBG14]]
+; ZERO-BASED-SHADOW-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP18]], i8 [[TMP14]], i64 1, i1 false), !dbg [[DBG14]]
; ZERO-BASED-SHADOW-NEXT: ret void, !dbg [[DBG14]]
;
entry:
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/exception-lifetime.ll b/llvm/test/Instrumentation/HWAddressSanitizer/exception-lifetime.ll
index 1940eb95d567..618240977ff5 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/exception-lifetime.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/exception-lifetime.ll
@@ -38,6 +38,7 @@ define void @test() sanitize_hwaddress personality ptr @__gxx_personality_v0 {
; CHECK-NEXT: [[TMP15:%.*]] = or i64 [[TMP2]], 4294967295
; CHECK-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP15]], 1
; CHECK-NEXT: [[TMP16:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP6]], 56
; CHECK-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; CHECK-NEXT: [[TMP17:%.*]] = xor i64 [[TMP3]], 0
; CHECK-NEXT: [[TMP18:%.*]] = ptrtoint ptr [[X]] to i64
@@ -49,34 +50,39 @@ define void @test() sanitize_hwaddress personality ptr @__gxx_personality_v0 {
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr [[X]])
; CHECK-NEXT: [[TMP21:%.*]] = trunc i64 [[TMP17]] to i8
; CHECK-NEXT: [[TMP22:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP23:%.*]] = lshr i64 [[TMP22]], 4
-; CHECK-NEXT: [[TMP24:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP23]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP24]], i8 [[TMP21]], i64 1, i1 false)
+; CHECK-NEXT: [[TMP23:%.*]] = and i64 [[TMP22]], 72057594037927935
+; CHECK-NEXT: [[TMP24:%.*]] = lshr i64 [[TMP23]], 4
+; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP24]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP25]], i8 [[TMP21]], i64 1, i1 false)
; CHECK-NEXT: invoke void @mayFail(ptr [[X_HWASAN]])
; CHECK-NEXT: to label [[INVOKE_CONT:%.*]] unwind label [[LPAD:%.*]]
; CHECK: invoke.cont:
-; CHECK-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; CHECK-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP26]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: [[TMP26:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP27:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP28:%.*]] = and i64 [[TMP27]], 72057594037927935
+; CHECK-NEXT: [[TMP29:%.*]] = lshr i64 [[TMP28]], 4
+; CHECK-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP29]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP30]], i8 [[TMP26]], i64 1, i1 false)
; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr [[X]])
; CHECK-NEXT: ret void
; CHECK: lpad:
-; CHECK-NEXT: [[TMP28:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: [[TMP31:%.*]] = landingpad { ptr, i32 }
; CHECK-NEXT: cleanup
-; CHECK-NEXT: [[TMP29:%.*]] = call i64 @llvm.read_register.i64(metadata [[META2:![0-9]+]])
-; CHECK-NEXT: call void @__hwasan_handle_vfork(i64 [[TMP29]])
-; CHECK-NEXT: [[TMP30:%.*]] = extractvalue { ptr, i32 } [[TMP28]], 0
+; CHECK-NEXT: [[TMP32:%.*]] = call i64 @llvm.read_register.i64(metadata [[META2:![0-9]+]])
+; CHECK-NEXT: call void @__hwasan_handle_vfork(i64 [[TMP32]])
+; CHECK-NEXT: [[TMP33:%.*]] = extractvalue { ptr, i32 } [[TMP31]], 0
; CHECK-NEXT: call void @llvm.hwasan.check.memaccess(ptr [[TMP16]], ptr [[EXN_SLOT]], i32 19)
-; CHECK-NEXT: store ptr [[TMP30]], ptr [[EXN_SLOT]], align 8
-; CHECK-NEXT: [[TMP31:%.*]] = extractvalue { ptr, i32 } [[TMP28]], 1
+; CHECK-NEXT: store ptr [[TMP33]], ptr [[EXN_SLOT]], align 8
+; CHECK-NEXT: [[TMP34:%.*]] = extractvalue { ptr, i32 } [[TMP31]], 1
; CHECK-NEXT: call void @llvm.hwasan.check.memaccess(ptr [[TMP16]], ptr [[EHSELECTOR_SLOT]], i32 18)
-; CHECK-NEXT: store i32 [[TMP31]], ptr [[EHSELECTOR_SLOT]], align 4
+; CHECK-NEXT: store i32 [[TMP34]], ptr [[EHSELECTOR_SLOT]], align 4
; CHECK-NEXT: call void @onExcept(ptr [[X_HWASAN]])
-; CHECK-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP33:%.*]] = lshr i64 [[TMP32]], 4
-; CHECK-NEXT: [[TMP34:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP33]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP34]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: [[TMP35:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP36:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP37:%.*]] = and i64 [[TMP36]], 72057594037927935
+; CHECK-NEXT: [[TMP38:%.*]] = lshr i64 [[TMP37]], 4
+; CHECK-NEXT: [[TMP39:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP38]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP39]], i8 [[TMP35]], i64 1, i1 false)
; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr [[X]])
; CHECK-NEXT: br label [[EH_RESUME:%.*]]
; CHECK: eh.resume:
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/kernel-alloca.ll b/llvm/test/Instrumentation/HWAddressSanitizer/kernel-alloca.ll
index 315cd4df1a44..0f920fe1c209 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/kernel-alloca.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/kernel-alloca.ll
@@ -17,6 +17,7 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[TMP0]] to i64
; CHECK-NEXT: [[TMP2:%.*]] = lshr i64 [[TMP1]], 20
; CHECK-NEXT: [[HWASAN_STACK_BASE_TAG:%.*]] = xor i64 [[TMP1]], [[TMP2]]
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP1]], 56
; CHECK-NEXT: [[X:%.*]] = alloca { i32, [12 x i8] }, align 16
; CHECK-NEXT: [[TMP3:%.*]] = xor i64 [[HWASAN_STACK_BASE_TAG]], 0
; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[X]] to i64
@@ -26,14 +27,17 @@ define void @test_alloca() sanitize_hwaddress {
; CHECK-NEXT: [[X_HWASAN:%.*]] = inttoptr i64 [[TMP7]] to ptr
; CHECK-NEXT: [[TMP8:%.*]] = trunc i64 [[TMP3]] to i8
; CHECK-NEXT: [[TMP9:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP10:%.*]] = lshr i64 [[TMP9]], 4
-; CHECK-NEXT: [[TMP11:%.*]] = inttoptr i64 [[TMP10]] to ptr
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP11]], i8 [[TMP8]], i64 1, i1 false)
+; CHECK-NEXT: [[TMP10:%.*]] = or i64 [[TMP9]], -72057594037927936
+; CHECK-NEXT: [[TMP11:%.*]] = lshr i64 [[TMP10]], 4
+; CHECK-NEXT: [[TMP12:%.*]] = inttoptr i64 [[TMP11]] to ptr
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP12]], i8 [[TMP8]], i64 1, i1 false)
; CHECK-NEXT: call void @use32(ptr nonnull [[X_HWASAN]])
-; CHECK-NEXT: [[TMP12:%.*]] = ptrtoint ptr [[X]] to i64
-; CHECK-NEXT: [[TMP13:%.*]] = lshr i64 [[TMP12]], 4
-; CHECK-NEXT: [[TMP14:%.*]] = inttoptr i64 [[TMP13]] to ptr
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP14]], i8 0, i64 1, i1 false)
+; CHECK-NEXT: [[TMP13:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP14:%.*]] = ptrtoint ptr [[X]] to i64
+; CHECK-NEXT: [[TMP15:%.*]] = or i64 [[TMP14]], -72057594037927936
+; CHECK-NEXT: [[TMP16:%.*]] = lshr i64 [[TMP15]], 4
+; CHECK-NEXT: [[TMP17:%.*]] = inttoptr i64 [[TMP16]] to ptr
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP17]], i8 [[TMP13]], i64 1, i1 false)
; CHECK-NEXT: ret void
;
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/stack-coloring.ll b/llvm/test/Instrumentation/HWAddressSanitizer/stack-coloring.ll
index 74cd9720d5f1..9ad7c05aea92 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/stack-coloring.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/stack-coloring.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; Test that storage for allocas with disjoint lifetimes is reused with
; use-after-scope.
@@ -14,7 +15,7 @@ target triple = "aarch64-unknown-linux-android29"
; REQUIRES: aarch64-registered-target
; COLOR: sub sp, sp, #240
-; NOCOLOR: sub sp, sp, #368
+; NOCOLOR: sub sp, sp, #384
define i32 @myCall_w2(i32 %in) sanitize_hwaddress {
entry:
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope-setjmp.ll b/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope-setjmp.ll
index 45a8132ff754..fd19da0b7a88 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope-setjmp.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope-setjmp.ll
@@ -32,6 +32,7 @@ define dso_local noundef i1 @_Z6targetv() sanitize_hwaddress {
; CHECK-NEXT: [[TMP15:%.*]] = or i64 [[TMP2]], 4294967295
; CHECK-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP15]], 1
; CHECK-NEXT: [[TMP16:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP6]], 56
; CHECK-NEXT: [[BUF:%.*]] = alloca [4096 x i8], align 16
; CHECK-NEXT: [[TMP17:%.*]] = xor i64 [[TMP3]], 0
; CHECK-NEXT: [[TMP18:%.*]] = ptrtoint ptr [[BUF]] to i64
@@ -40,9 +41,10 @@ define dso_local noundef i1 @_Z6targetv() sanitize_hwaddress {
; CHECK-NEXT: [[BUF_HWASAN:%.*]] = inttoptr i64 [[TMP20]] to ptr
; CHECK-NEXT: [[TMP21:%.*]] = trunc i64 [[TMP17]] to i8
; CHECK-NEXT: [[TMP22:%.*]] = ptrtoint ptr [[BUF]] to i64
-; CHECK-NEXT: [[TMP23:%.*]] = lshr i64 [[TMP22]], 4
-; CHECK-NEXT: [[TMP24:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP23]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP24]], i8 [[TMP21]], i64 256, i1 false)
+; CHECK-NEXT: [[TMP23:%.*]] = and i64 [[TMP22]], 72057594037927935
+; CHECK-NEXT: [[TMP24:%.*]] = lshr i64 [[TMP23]], 4
+; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP24]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP25]], i8 [[TMP21]], i64 256, i1 false)
; CHECK-NEXT: [[CALL:%.*]] = call i32 @setjmp(ptr noundef @jbuf)
; CHECK-NEXT: switch i32 [[CALL]], label [[WHILE_BODY:%.*]] [
; CHECK-NEXT: i32 1, label [[RETURN:%.*]]
@@ -57,10 +59,12 @@ define dso_local noundef i1 @_Z6targetv() sanitize_hwaddress {
; CHECK-NEXT: br label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi i1 [ true, [[WHILE_BODY]] ], [ true, [[SW_BB1]] ], [ false, [[ENTRY:%.*]] ]
-; CHECK-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[BUF]] to i64
-; CHECK-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; CHECK-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP26]]
-; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 0, i64 256, i1 false)
+; CHECK-NEXT: [[TMP26:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; CHECK-NEXT: [[TMP27:%.*]] = ptrtoint ptr [[BUF]] to i64
+; CHECK-NEXT: [[TMP28:%.*]] = and i64 [[TMP27]], 72057594037927935
+; CHECK-NEXT: [[TMP29:%.*]] = lshr i64 [[TMP28]], 4
+; CHECK-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP16]], i64 [[TMP29]]
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP30]], i8 [[TMP26]], i64 256, i1 false)
; CHECK-NEXT: ret i1 [[RETVAL_0]]
;
entry:
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll b/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
index e7681138cf72..9dddde528e27 100644
--- a/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
+++ b/llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
@@ -25,44 +25,54 @@
define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress {
; X86-SCOPE-LABEL: @standard_lifetime(
; X86-SCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-SCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-SCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-SCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-SCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-SCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-SCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-SCOPE-NEXT: br label [[TMP7:%.*]]
-; X86-SCOPE: 7:
-; X86-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP1]])
-; X86-SCOPE-NEXT: [[TMP8:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP8]], i64 16)
-; X86-SCOPE-NEXT: [[TMP9:%.*]] = tail call i1 (...) @cond()
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
-; X86-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP1]])
-; X86-SCOPE-NEXT: br i1 [[TMP9]], label [[TMP10:%.*]], label [[TMP7]]
+; X86-SCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-SCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-SCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-SCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-SCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-SCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-SCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-SCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-SCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-SCOPE-NEXT: br label [[TMP10:%.*]]
; X86-SCOPE: 10:
+; X86-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP4]])
+; X86-SCOPE-NEXT: [[TMP11:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP11]], i64 16)
+; X86-SCOPE-NEXT: [[TMP12:%.*]] = tail call i1 (...) @cond()
+; X86-SCOPE-NEXT: [[TMP13:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP13]], i64 16)
+; X86-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP4]])
+; X86-SCOPE-NEXT: br i1 [[TMP12]], label [[TMP14:%.*]], label [[TMP10]]
+; X86-SCOPE: 14:
; X86-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; X86-SCOPE-NEXT: ret i32 0
;
; X86-NOSCOPE-LABEL: @standard_lifetime(
; X86-NOSCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP7]], i64 16)
-; X86-NOSCOPE-NEXT: br label [[TMP8:%.*]]
-; X86-NOSCOPE: 8:
-; X86-NOSCOPE-NEXT: [[TMP9:%.*]] = tail call i1 (...) @cond()
-; X86-NOSCOPE-NEXT: br i1 [[TMP9]], label [[TMP10:%.*]], label [[TMP8]]
-; X86-NOSCOPE: 10:
+; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-NOSCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-NOSCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-NOSCOPE-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP10]], i64 16)
+; X86-NOSCOPE-NEXT: br label [[TMP11:%.*]]
+; X86-NOSCOPE: 11:
+; X86-NOSCOPE-NEXT: [[TMP12:%.*]] = tail call i1 (...) @cond()
+; X86-NOSCOPE-NEXT: br i1 [[TMP12]], label [[TMP13:%.*]], label [[TMP11]]
+; X86-NOSCOPE: 13:
; X86-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-NOSCOPE-NEXT: [[TMP14:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP14]], i64 16)
; X86-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SCOPE-LABEL: @standard_lifetime(
@@ -86,6 +96,7 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
; AARCH64-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -98,17 +109,20 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
; AARCH64-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP18]])
; AARCH64-SCOPE-NEXT: [[TMP25:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SCOPE-NEXT: [[TMP26:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
-; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP25]], i64 1, i1 false)
-; AARCH64-SCOPE-NEXT: [[TMP29:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = lshr i64 [[TMP30]], 4
-; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP31]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP32]], i8 0, i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = and i64 [[TMP26]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = lshr i64 [[TMP27]], 4
+; AARCH64-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP28]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP29]], i8 [[TMP25]], i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP30:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SCOPE-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
+; AARCH64-SCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 [[TMP31]], i64 1, i1 false)
; AARCH64-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP18]])
-; AARCH64-SCOPE-NEXT: br i1 [[TMP29]], label [[TMP33:%.*]], label [[TMP24]]
-; AARCH64-SCOPE: 33:
+; AARCH64-SCOPE-NEXT: br i1 [[TMP30]], label [[TMP36:%.*]], label [[TMP24]]
+; AARCH64-SCOPE: 36:
; AARCH64-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; AARCH64-SCOPE-NEXT: ret i32 0
;
@@ -133,6 +147,7 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
; AARCH64-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -142,19 +157,22 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
; AARCH64-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 [[TMP24]], i64 1, i1 false)
-; AARCH64-NOSCOPE-NEXT: br label [[TMP28:%.*]]
-; AARCH64-NOSCOPE: 28:
-; AARCH64-NOSCOPE-NEXT: [[TMP29:%.*]] = tail call i1 (...) @cond()
-; AARCH64-NOSCOPE-NEXT: br i1 [[TMP29]], label [[TMP30:%.*]], label [[TMP28]]
-; AARCH64-NOSCOPE: 30:
+; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: br label [[TMP29:%.*]]
+; AARCH64-NOSCOPE: 29:
+; AARCH64-NOSCOPE-NEXT: [[TMP30:%.*]] = tail call i1 (...) @cond()
+; AARCH64-NOSCOPE-NEXT: br i1 [[TMP30]], label [[TMP31:%.*]], label [[TMP29]]
+; AARCH64-NOSCOPE: 31:
; AARCH64-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-NOSCOPE-NEXT: [[TMP31:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP32:%.*]] = lshr i64 [[TMP31]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP33:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP32]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP33]], i8 0, i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: [[TMP32:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-NOSCOPE-NEXT: [[TMP33:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-NOSCOPE-NEXT: [[TMP34:%.*]] = and i64 [[TMP33]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP35:%.*]] = lshr i64 [[TMP34]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP36:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP35]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP36]], i8 [[TMP32]], i64 1, i1 false)
; AARCH64-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SHORT-SCOPE-LABEL: @standard_lifetime(
@@ -178,6 +196,7 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
; AARCH64-SHORT-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -190,20 +209,23 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP18]])
; AARCH64-SHORT-SCOPE-NEXT: [[TMP25:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-SCOPE-NEXT: [[TMP26:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
-; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP25]], ptr [[TMP30]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP31:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = lshr i64 [[TMP32]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP33]]
-; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP34]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = and i64 [[TMP26]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = lshr i64 [[TMP27]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP28]]
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP29]], i32 0
+; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP30]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP31:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP25]], ptr [[TMP31]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP32:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP35:%.*]] = and i64 [[TMP34]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP36:%.*]] = lshr i64 [[TMP35]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP37:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP36]]
+; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP37]], i8 [[TMP33]], i64 1, i1 false)
; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP18]])
-; AARCH64-SHORT-SCOPE-NEXT: br i1 [[TMP31]], label [[TMP35:%.*]], label [[TMP24]]
-; AARCH64-SHORT-SCOPE: 35:
+; AARCH64-SHORT-SCOPE-NEXT: br i1 [[TMP32]], label [[TMP38:%.*]], label [[TMP24]]
+; AARCH64-SHORT-SCOPE: 38:
; AARCH64-SHORT-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; AARCH64-SHORT-SCOPE-NEXT: ret i32 0
;
@@ -228,6 +250,7 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -237,22 +260,25 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
; AARCH64-SHORT-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP27]], i32 0
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP28]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP29]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: br label [[TMP30:%.*]]
-; AARCH64-SHORT-NOSCOPE: 30:
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP31:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SHORT-NOSCOPE-NEXT: br i1 [[TMP31]], label [[TMP32:%.*]], label [[TMP30]]
-; AARCH64-SHORT-NOSCOPE: 32:
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP30]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: br label [[TMP31:%.*]]
+; AARCH64-SHORT-NOSCOPE: 31:
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP32:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SHORT-NOSCOPE-NEXT: br i1 [[TMP32]], label [[TMP33:%.*]], label [[TMP31]]
+; AARCH64-SHORT-NOSCOPE: 33:
; AARCH64-SHORT-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP33:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
-; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP34:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP35:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP36:%.*]] = and i64 [[TMP35]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP37:%.*]] = lshr i64 [[TMP36]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP38:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP37]]
+; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP38]], i8 [[TMP34]], i64 1, i1 false)
; AARCH64-SHORT-NOSCOPE-NEXT: ret i32 0
;
%1 = alloca i8, align 1
@@ -274,44 +300,54 @@ define dso_local i32 @standard_lifetime() local_unnamed_addr sanitize_hwaddress
define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noinline sanitize_hwaddress {
; X86-SCOPE-LABEL: @standard_lifetime_optnone(
; X86-SCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-SCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-SCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-SCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-SCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-SCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-SCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-SCOPE-NEXT: br label [[TMP7:%.*]]
-; X86-SCOPE: 7:
-; X86-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP1]])
-; X86-SCOPE-NEXT: [[TMP8:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP8]], i64 16)
-; X86-SCOPE-NEXT: [[TMP9:%.*]] = tail call i1 (...) @cond()
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
-; X86-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP1]])
-; X86-SCOPE-NEXT: br i1 [[TMP9]], label [[TMP10:%.*]], label [[TMP7]]
+; X86-SCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-SCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-SCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-SCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-SCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-SCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-SCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-SCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-SCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-SCOPE-NEXT: br label [[TMP10:%.*]]
; X86-SCOPE: 10:
+; X86-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP4]])
+; X86-SCOPE-NEXT: [[TMP11:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP11]], i64 16)
+; X86-SCOPE-NEXT: [[TMP12:%.*]] = tail call i1 (...) @cond()
+; X86-SCOPE-NEXT: [[TMP13:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP13]], i64 16)
+; X86-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP4]])
+; X86-SCOPE-NEXT: br i1 [[TMP12]], label [[TMP14:%.*]], label [[TMP10]]
+; X86-SCOPE: 14:
; X86-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; X86-SCOPE-NEXT: ret i32 0
;
; X86-NOSCOPE-LABEL: @standard_lifetime_optnone(
; X86-NOSCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP7]], i64 16)
-; X86-NOSCOPE-NEXT: br label [[TMP8:%.*]]
-; X86-NOSCOPE: 8:
-; X86-NOSCOPE-NEXT: [[TMP9:%.*]] = tail call i1 (...) @cond()
-; X86-NOSCOPE-NEXT: br i1 [[TMP9]], label [[TMP10:%.*]], label [[TMP8]]
-; X86-NOSCOPE: 10:
+; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-NOSCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-NOSCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-NOSCOPE-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP10]], i64 16)
+; X86-NOSCOPE-NEXT: br label [[TMP11:%.*]]
+; X86-NOSCOPE: 11:
+; X86-NOSCOPE-NEXT: [[TMP12:%.*]] = tail call i1 (...) @cond()
+; X86-NOSCOPE-NEXT: br i1 [[TMP12]], label [[TMP13:%.*]], label [[TMP11]]
+; X86-NOSCOPE: 13:
; X86-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-NOSCOPE-NEXT: [[TMP14:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP14]], i64 16)
; X86-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SCOPE-LABEL: @standard_lifetime_optnone(
@@ -335,6 +371,7 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
; AARCH64-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -347,17 +384,20 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
; AARCH64-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP18]])
; AARCH64-SCOPE-NEXT: [[TMP25:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SCOPE-NEXT: [[TMP26:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
-; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP25]], i64 1, i1 false)
-; AARCH64-SCOPE-NEXT: [[TMP29:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = lshr i64 [[TMP30]], 4
-; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP31]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP32]], i8 0, i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = and i64 [[TMP26]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = lshr i64 [[TMP27]], 4
+; AARCH64-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP28]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP29]], i8 [[TMP25]], i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP30:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SCOPE-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
+; AARCH64-SCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 [[TMP31]], i64 1, i1 false)
; AARCH64-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP18]])
-; AARCH64-SCOPE-NEXT: br i1 [[TMP29]], label [[TMP33:%.*]], label [[TMP24]]
-; AARCH64-SCOPE: 33:
+; AARCH64-SCOPE-NEXT: br i1 [[TMP30]], label [[TMP36:%.*]], label [[TMP24]]
+; AARCH64-SCOPE: 36:
; AARCH64-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; AARCH64-SCOPE-NEXT: ret i32 0
;
@@ -382,6 +422,7 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
; AARCH64-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -391,19 +432,22 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
; AARCH64-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 [[TMP24]], i64 1, i1 false)
-; AARCH64-NOSCOPE-NEXT: br label [[TMP28:%.*]]
-; AARCH64-NOSCOPE: 28:
-; AARCH64-NOSCOPE-NEXT: [[TMP29:%.*]] = tail call i1 (...) @cond()
-; AARCH64-NOSCOPE-NEXT: br i1 [[TMP29]], label [[TMP30:%.*]], label [[TMP28]]
-; AARCH64-NOSCOPE: 30:
+; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: br label [[TMP29:%.*]]
+; AARCH64-NOSCOPE: 29:
+; AARCH64-NOSCOPE-NEXT: [[TMP30:%.*]] = tail call i1 (...) @cond()
+; AARCH64-NOSCOPE-NEXT: br i1 [[TMP30]], label [[TMP31:%.*]], label [[TMP29]]
+; AARCH64-NOSCOPE: 31:
; AARCH64-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-NOSCOPE-NEXT: [[TMP31:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP32:%.*]] = lshr i64 [[TMP31]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP33:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP32]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP33]], i8 0, i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: [[TMP32:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-NOSCOPE-NEXT: [[TMP33:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-NOSCOPE-NEXT: [[TMP34:%.*]] = and i64 [[TMP33]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP35:%.*]] = lshr i64 [[TMP34]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP36:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP35]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP36]], i8 [[TMP32]], i64 1, i1 false)
; AARCH64-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SHORT-SCOPE-LABEL: @standard_lifetime_optnone(
@@ -427,6 +471,7 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
; AARCH64-SHORT-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -439,20 +484,23 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP18]])
; AARCH64-SHORT-SCOPE-NEXT: [[TMP25:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-SCOPE-NEXT: [[TMP26:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
-; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP25]], ptr [[TMP30]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP31:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = lshr i64 [[TMP32]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP33]]
-; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP34]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = and i64 [[TMP26]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = lshr i64 [[TMP27]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP28]]
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP29]], i32 0
+; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP30]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP31:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP25]], ptr [[TMP31]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP32:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP35:%.*]] = and i64 [[TMP34]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP36:%.*]] = lshr i64 [[TMP35]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP37:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP36]]
+; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP37]], i8 [[TMP33]], i64 1, i1 false)
; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP18]])
-; AARCH64-SHORT-SCOPE-NEXT: br i1 [[TMP31]], label [[TMP35:%.*]], label [[TMP24]]
-; AARCH64-SHORT-SCOPE: 35:
+; AARCH64-SHORT-SCOPE-NEXT: br i1 [[TMP32]], label [[TMP38:%.*]], label [[TMP24]]
+; AARCH64-SHORT-SCOPE: 38:
; AARCH64-SHORT-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; AARCH64-SHORT-SCOPE-NEXT: ret i32 0
;
@@ -477,6 +525,7 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -486,22 +535,25 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
; AARCH64-SHORT-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP27]], i32 0
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP28]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP29]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: br label [[TMP30:%.*]]
-; AARCH64-SHORT-NOSCOPE: 30:
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP31:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SHORT-NOSCOPE-NEXT: br i1 [[TMP31]], label [[TMP32:%.*]], label [[TMP30]]
-; AARCH64-SHORT-NOSCOPE: 32:
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP30]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: br label [[TMP31:%.*]]
+; AARCH64-SHORT-NOSCOPE: 31:
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP32:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SHORT-NOSCOPE-NEXT: br i1 [[TMP32]], label [[TMP33:%.*]], label [[TMP31]]
+; AARCH64-SHORT-NOSCOPE: 33:
; AARCH64-SHORT-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP33:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
-; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP34:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP35:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP36:%.*]] = and i64 [[TMP35]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP37:%.*]] = lshr i64 [[TMP36]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP38:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP37]]
+; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP38]], i8 [[TMP34]], i64 1, i1 false)
; AARCH64-SHORT-NOSCOPE-NEXT: ret i32 0
;
%1 = alloca i8, align 1
@@ -523,34 +575,44 @@ define dso_local i32 @standard_lifetime_optnone() local_unnamed_addr optnone noi
define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress {
; X86-SCOPE-LABEL: @multiple_lifetimes(
; X86-SCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-SCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-SCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-SCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-SCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-SCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-SCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-SCOPE-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP7]], i64 16)
+; X86-SCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-SCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-SCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-SCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-SCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-SCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-SCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-SCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-SCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-SCOPE-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP10]], i64 16)
; X86-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; X86-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-SCOPE-NEXT: [[TMP11:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP11]], i64 16)
; X86-SCOPE-NEXT: ret i32 0
;
; X86-NOSCOPE-LABEL: @multiple_lifetimes(
; X86-NOSCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP7]], i64 16)
+; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-NOSCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-NOSCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-NOSCOPE-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP10]], i64 16)
; X86-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; X86-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-NOSCOPE-NEXT: [[TMP11:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP11]], i64 16)
; X86-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SCOPE-LABEL: @multiple_lifetimes(
@@ -574,6 +636,7 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
; AARCH64-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -583,15 +646,18 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
; AARCH64-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-SCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 [[TMP24]], i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 1, i1 false)
; AARCH64-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; AARCH64-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP29:%.*]] = lshr i64 [[TMP28]], 4
-; AARCH64-SCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP29]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP30]], i8 0, i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP29:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = and i64 [[TMP30]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = lshr i64 [[TMP31]], 4
+; AARCH64-SCOPE-NEXT: [[TMP33:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP32]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP33]], i8 [[TMP29]], i64 1, i1 false)
; AARCH64-SCOPE-NEXT: ret i32 0
;
; AARCH64-NOSCOPE-LABEL: @multiple_lifetimes(
@@ -615,6 +681,7 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
; AARCH64-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -624,15 +691,18 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
; AARCH64-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 [[TMP24]], i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 1, i1 false)
; AARCH64-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; AARCH64-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-NOSCOPE-NEXT: [[TMP28:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP29:%.*]] = lshr i64 [[TMP28]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP29]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP30]], i8 0, i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: [[TMP29:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-NOSCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-NOSCOPE-NEXT: [[TMP31:%.*]] = and i64 [[TMP30]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP32:%.*]] = lshr i64 [[TMP31]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP33:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP32]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP33]], i8 [[TMP29]], i64 1, i1 false)
; AARCH64-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SHORT-SCOPE-LABEL: @multiple_lifetimes(
@@ -656,6 +726,7 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
; AARCH64-SHORT-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -665,18 +736,21 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
; AARCH64-SHORT-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-SHORT-SCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-SCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP27]], i32 0
-; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP28]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP29]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
+; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP30]], align 1
; AARCH64-SHORT-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; AARCH64-SHORT-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP31:%.*]] = lshr i64 [[TMP30]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP32:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP31]]
-; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP32]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP31:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
+; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 [[TMP31]], i64 1, i1 false)
; AARCH64-SHORT-SCOPE-NEXT: ret i32 0
;
; AARCH64-SHORT-NOSCOPE-LABEL: @multiple_lifetimes(
@@ -700,6 +774,7 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -709,18 +784,21 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
; AARCH64-SHORT-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP27]], i32 0
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP28]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP29]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP30]], align 1
; AARCH64-SHORT-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
; AARCH64-SHORT-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP31:%.*]] = lshr i64 [[TMP30]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP32:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP31]]
-; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP32]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP31:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
+; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 [[TMP31]], i64 1, i1 false)
; AARCH64-SHORT-NOSCOPE-NEXT: ret i32 0
;
%1 = alloca i8, align 1
@@ -738,45 +816,57 @@ define dso_local i32 @multiple_lifetimes() local_unnamed_addr sanitize_hwaddress
define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; X86-SCOPE-LABEL: @unreachable_exit(
; X86-SCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-SCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-SCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-SCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-SCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-SCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-SCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP1]])
-; X86-SCOPE-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP7]], i64 16)
-; X86-SCOPE-NEXT: [[TMP8:%.*]] = tail call i1 (...) @cond()
-; X86-SCOPE-NEXT: br i1 [[TMP8]], label [[TMP9:%.*]], label [[TMP10:%.*]]
-; X86-SCOPE: 9:
+; X86-SCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-SCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-SCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-SCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-SCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-SCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-SCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-SCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-SCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP4]])
+; X86-SCOPE-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP10]], i64 16)
+; X86-SCOPE-NEXT: [[TMP11:%.*]] = tail call i1 (...) @cond()
+; X86-SCOPE-NEXT: br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP14:%.*]]
+; X86-SCOPE: 12:
; X86-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-SCOPE-NEXT: [[TMP13:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP13]], i64 16)
; X86-SCOPE-NEXT: ret i32 0
-; X86-SCOPE: 10:
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-SCOPE: 14:
+; X86-SCOPE-NEXT: [[TMP15:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP15]], i64 16)
; X86-SCOPE-NEXT: ret i32 0
;
; X86-NOSCOPE-LABEL: @unreachable_exit(
; X86-NOSCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP7]], i64 16)
-; X86-NOSCOPE-NEXT: [[TMP8:%.*]] = tail call i1 (...) @cond()
-; X86-NOSCOPE-NEXT: br i1 [[TMP8]], label [[TMP9:%.*]], label [[TMP10:%.*]]
-; X86-NOSCOPE: 9:
+; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-NOSCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-NOSCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-NOSCOPE-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP10]], i64 16)
+; X86-NOSCOPE-NEXT: [[TMP11:%.*]] = tail call i1 (...) @cond()
+; X86-NOSCOPE-NEXT: br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP14:%.*]]
+; X86-NOSCOPE: 12:
; X86-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-NOSCOPE-NEXT: [[TMP13:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP13]], i64 16)
; X86-NOSCOPE-NEXT: ret i32 0
-; X86-NOSCOPE: 10:
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-NOSCOPE: 14:
+; X86-NOSCOPE-NEXT: [[TMP15:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP15]], i64 16)
; X86-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SCOPE-LABEL: @unreachable_exit(
@@ -800,6 +890,7 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -810,23 +901,28 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP18]])
; AARCH64-SCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 [[TMP24]], i64 1, i1 false)
-; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SCOPE-NEXT: br i1 [[TMP28]], label [[TMP29:%.*]], label [[TMP33:%.*]]
-; AARCH64-SCOPE: 29:
+; AARCH64-SCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP29:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SCOPE-NEXT: br i1 [[TMP29]], label [[TMP30:%.*]], label [[TMP36:%.*]]
+; AARCH64-SCOPE: 30:
; AARCH64-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = lshr i64 [[TMP30]], 4
-; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP31]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP32]], i8 0, i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SCOPE-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
+; AARCH64-SCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 [[TMP31]], i64 1, i1 false)
; AARCH64-SCOPE-NEXT: ret i32 0
-; AARCH64-SCOPE: 33:
-; AARCH64-SCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP35:%.*]] = lshr i64 [[TMP34]], 4
-; AARCH64-SCOPE-NEXT: [[TMP36:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP35]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP36]], i8 0, i64 1, i1 false)
+; AARCH64-SCOPE: 36:
+; AARCH64-SCOPE-NEXT: [[TMP37:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SCOPE-NEXT: [[TMP38:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SCOPE-NEXT: [[TMP39:%.*]] = and i64 [[TMP38]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP40:%.*]] = lshr i64 [[TMP39]], 4
+; AARCH64-SCOPE-NEXT: [[TMP41:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP40]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP41]], i8 [[TMP37]], i64 1, i1 false)
; AARCH64-SCOPE-NEXT: ret i32 0
;
; AARCH64-NOSCOPE-LABEL: @unreachable_exit(
@@ -850,6 +946,7 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; AARCH64-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -859,23 +956,28 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; AARCH64-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 [[TMP24]], i64 1, i1 false)
-; AARCH64-NOSCOPE-NEXT: [[TMP28:%.*]] = tail call i1 (...) @cond()
-; AARCH64-NOSCOPE-NEXT: br i1 [[TMP28]], label [[TMP29:%.*]], label [[TMP33:%.*]]
-; AARCH64-NOSCOPE: 29:
+; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: [[TMP29:%.*]] = tail call i1 (...) @cond()
+; AARCH64-NOSCOPE-NEXT: br i1 [[TMP29]], label [[TMP30:%.*]], label [[TMP36:%.*]]
+; AARCH64-NOSCOPE: 30:
; AARCH64-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-NOSCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP31:%.*]] = lshr i64 [[TMP30]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP32:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP31]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP32]], i8 0, i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: [[TMP31:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-NOSCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-NOSCOPE-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 [[TMP31]], i64 1, i1 false)
; AARCH64-NOSCOPE-NEXT: ret i32 0
-; AARCH64-NOSCOPE: 33:
-; AARCH64-NOSCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP35:%.*]] = lshr i64 [[TMP34]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP36:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP35]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP36]], i8 0, i64 1, i1 false)
+; AARCH64-NOSCOPE: 36:
+; AARCH64-NOSCOPE-NEXT: [[TMP37:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-NOSCOPE-NEXT: [[TMP38:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-NOSCOPE-NEXT: [[TMP39:%.*]] = and i64 [[TMP38]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP40:%.*]] = lshr i64 [[TMP39]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP41:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP40]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP41]], i8 [[TMP37]], i64 1, i1 false)
; AARCH64-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SHORT-SCOPE-LABEL: @unreachable_exit(
@@ -899,6 +1001,7 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SHORT-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -909,26 +1012,31 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP18]])
; AARCH64-SHORT-SCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-SCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP27]], i32 0
-; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP28]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP29]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SHORT-SCOPE-NEXT: br i1 [[TMP30]], label [[TMP31:%.*]], label [[TMP35:%.*]]
-; AARCH64-SHORT-SCOPE: 31:
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
+; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP30]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP31:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SHORT-SCOPE-NEXT: br i1 [[TMP31]], label [[TMP32:%.*]], label [[TMP38:%.*]]
+; AARCH64-SHORT-SCOPE: 32:
; AARCH64-SHORT-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = lshr i64 [[TMP32]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP33]]
-; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP34]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP35:%.*]] = and i64 [[TMP34]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP36:%.*]] = lshr i64 [[TMP35]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP37:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP36]]
+; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP37]], i8 [[TMP33]], i64 1, i1 false)
; AARCH64-SHORT-SCOPE-NEXT: ret i32 0
-; AARCH64-SHORT-SCOPE: 35:
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP36:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP37:%.*]] = lshr i64 [[TMP36]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP38:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP37]]
-; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP38]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-SCOPE: 38:
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP39:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP40:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP41:%.*]] = and i64 [[TMP40]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP42:%.*]] = lshr i64 [[TMP41]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP43:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP42]]
+; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP43]], i8 [[TMP39]], i64 1, i1 false)
; AARCH64-SHORT-SCOPE-NEXT: ret i32 0
;
; AARCH64-SHORT-NOSCOPE-LABEL: @unreachable_exit(
@@ -952,6 +1060,7 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -961,26 +1070,31 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SHORT-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP27]], i32 0
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP28]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP29]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP30:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SHORT-NOSCOPE-NEXT: br i1 [[TMP30]], label [[TMP31:%.*]], label [[TMP35:%.*]]
-; AARCH64-SHORT-NOSCOPE: 31:
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP30]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP31:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SHORT-NOSCOPE-NEXT: br i1 [[TMP31]], label [[TMP32:%.*]], label [[TMP38:%.*]]
+; AARCH64-SHORT-NOSCOPE: 32:
; AARCH64-SHORT-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP33:%.*]] = lshr i64 [[TMP32]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP34:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP33]]
-; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP34]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP33:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP35:%.*]] = and i64 [[TMP34]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP36:%.*]] = lshr i64 [[TMP35]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP37:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP36]]
+; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP37]], i8 [[TMP33]], i64 1, i1 false)
; AARCH64-SHORT-NOSCOPE-NEXT: ret i32 0
-; AARCH64-SHORT-NOSCOPE: 35:
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP36:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP37:%.*]] = lshr i64 [[TMP36]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP38:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP37]]
-; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP38]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-NOSCOPE: 38:
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP39:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP40:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP41:%.*]] = and i64 [[TMP40]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP42:%.*]] = lshr i64 [[TMP41]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP43:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP42]]
+; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP43]], i8 [[TMP39]], i64 1, i1 false)
; AARCH64-SHORT-NOSCOPE-NEXT: ret i32 0
;
%1 = alloca i8, align 1
@@ -1000,50 +1114,61 @@ define dso_local i32 @unreachable_exit() local_unnamed_addr sanitize_hwaddress {
define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; X86-SCOPE-LABEL: @diamond_lifetime(
; X86-SCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-SCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-SCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-SCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-SCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-SCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-SCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP1]])
-; X86-SCOPE-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP7]], i64 16)
-; X86-SCOPE-NEXT: [[TMP8:%.*]] = tail call i1 (...) @cond()
-; X86-SCOPE-NEXT: br i1 [[TMP8]], label [[TMP9:%.*]], label [[TMP10:%.*]]
-; X86-SCOPE: 9:
+; X86-SCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-SCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-SCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-SCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-SCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-SCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-SCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-SCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-SCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-SCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP4]])
+; X86-SCOPE-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP10]], i64 16)
+; X86-SCOPE-NEXT: [[TMP11:%.*]] = tail call i1 (...) @cond()
+; X86-SCOPE-NEXT: br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP14:%.*]]
+; X86-SCOPE: 12:
; X86-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
-; X86-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP1]])
-; X86-SCOPE-NEXT: br label [[TMP11:%.*]]
-; X86-SCOPE: 10:
-; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
-; X86-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP1]])
-; X86-SCOPE-NEXT: br label [[TMP11]]
-; X86-SCOPE: 11:
+; X86-SCOPE-NEXT: [[TMP13:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP13]], i64 16)
+; X86-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP4]])
+; X86-SCOPE-NEXT: br label [[TMP16:%.*]]
+; X86-SCOPE: 14:
+; X86-SCOPE-NEXT: [[TMP15:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-SCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP15]], i64 16)
+; X86-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP4]])
+; X86-SCOPE-NEXT: br label [[TMP16]]
+; X86-SCOPE: 16:
; X86-SCOPE-NEXT: ret i32 0
;
; X86-NOSCOPE-LABEL: @diamond_lifetime(
; X86-NOSCOPE-NEXT: [[DOTHWASAN_SHADOW:%.*]] = call ptr asm "", "=r,0"(ptr null)
-; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = alloca { i8, [15 x i8] }, align 16
-; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = call i8 @__hwasan_generate_tag()
-; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = zext i8 [[TMP2]] to i64
-; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP1]] to i64
-; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = shl i64 [[TMP3]], 57
-; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = or i64 [[TMP4]], [[TMP5]]
-; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP6]] to ptr
-; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP3]] to i8
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 [[TMP7]], i64 16)
-; X86-NOSCOPE-NEXT: [[TMP8:%.*]] = tail call i1 (...) @cond()
-; X86-NOSCOPE-NEXT: br i1 [[TMP8]], label [[TMP9:%.*]], label [[TMP10:%.*]]
-; X86-NOSCOPE: 9:
+; X86-NOSCOPE-NEXT: [[TMP1:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
+; X86-NOSCOPE-NEXT: [[TMP2:%.*]] = ptrtoint ptr [[TMP1]] to i64
+; X86-NOSCOPE-NEXT: [[TMP3:%.*]] = lshr i64 [[TMP2]], 57
+; X86-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = and i64 [[TMP3]], 63
+; X86-NOSCOPE-NEXT: [[TMP4:%.*]] = alloca { i8, [15 x i8] }, align 16
+; X86-NOSCOPE-NEXT: [[TMP5:%.*]] = call i8 @__hwasan_generate_tag()
+; X86-NOSCOPE-NEXT: [[TMP6:%.*]] = zext i8 [[TMP5]] to i64
+; X86-NOSCOPE-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; X86-NOSCOPE-NEXT: [[TMP8:%.*]] = shl i64 [[TMP6]], 57
+; X86-NOSCOPE-NEXT: [[TMP9:%.*]] = or i64 [[TMP7]], [[TMP8]]
+; X86-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; X86-NOSCOPE-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP6]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP10]], i64 16)
+; X86-NOSCOPE-NEXT: [[TMP11:%.*]] = tail call i1 (...) @cond()
+; X86-NOSCOPE-NEXT: br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP13:%.*]]
+; X86-NOSCOPE: 12:
; X86-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; X86-NOSCOPE-NEXT: br label [[TMP11:%.*]]
-; X86-NOSCOPE: 10:
-; X86-NOSCOPE-NEXT: br label [[TMP11]]
-; X86-NOSCOPE: 11:
-; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP1]], i8 0, i64 16)
+; X86-NOSCOPE-NEXT: br label [[TMP14:%.*]]
+; X86-NOSCOPE: 13:
+; X86-NOSCOPE-NEXT: br label [[TMP14]]
+; X86-NOSCOPE: 14:
+; X86-NOSCOPE-NEXT: [[TMP15:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; X86-NOSCOPE-NEXT: call void @__hwasan_tag_memory(ptr [[TMP4]], i8 [[TMP15]], i64 16)
; X86-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SCOPE-LABEL: @diamond_lifetime(
@@ -1067,6 +1192,7 @@ define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -1077,27 +1203,32 @@ define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP18]])
; AARCH64-SCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 [[TMP24]], i64 1, i1 false)
-; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SCOPE-NEXT: br i1 [[TMP28]], label [[TMP29:%.*]], label [[TMP33:%.*]]
-; AARCH64-SCOPE: 29:
+; AARCH64-SCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP29:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SCOPE-NEXT: br i1 [[TMP29]], label [[TMP30:%.*]], label [[TMP36:%.*]]
+; AARCH64-SCOPE: 30:
; AARCH64-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SCOPE-NEXT: [[TMP30:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = lshr i64 [[TMP30]], 4
-; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP31]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP32]], i8 0, i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: [[TMP31:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SCOPE-NEXT: [[TMP33:%.*]] = and i64 [[TMP32]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP34:%.*]] = lshr i64 [[TMP33]], 4
+; AARCH64-SCOPE-NEXT: [[TMP35:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP34]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP35]], i8 [[TMP31]], i64 1, i1 false)
; AARCH64-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP18]])
-; AARCH64-SCOPE-NEXT: br label [[TMP37:%.*]]
-; AARCH64-SCOPE: 33:
-; AARCH64-SCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SCOPE-NEXT: [[TMP35:%.*]] = lshr i64 [[TMP34]], 4
-; AARCH64-SCOPE-NEXT: [[TMP36:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP35]]
-; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP36]], i8 0, i64 1, i1 false)
+; AARCH64-SCOPE-NEXT: br label [[TMP42:%.*]]
+; AARCH64-SCOPE: 36:
+; AARCH64-SCOPE-NEXT: [[TMP37:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SCOPE-NEXT: [[TMP38:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SCOPE-NEXT: [[TMP39:%.*]] = and i64 [[TMP38]], 72057594037927935
+; AARCH64-SCOPE-NEXT: [[TMP40:%.*]] = lshr i64 [[TMP39]], 4
+; AARCH64-SCOPE-NEXT: [[TMP41:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP40]]
+; AARCH64-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP41]], i8 [[TMP37]], i64 1, i1 false)
; AARCH64-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP18]])
-; AARCH64-SCOPE-NEXT: br label [[TMP37]]
-; AARCH64-SCOPE: 37:
+; AARCH64-SCOPE-NEXT: br label [[TMP42]]
+; AARCH64-SCOPE: 42:
; AARCH64-SCOPE-NEXT: ret i32 0
;
; AARCH64-NOSCOPE-LABEL: @diamond_lifetime(
@@ -1121,6 +1252,7 @@ define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; AARCH64-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -1130,21 +1262,24 @@ define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; AARCH64-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP27]], i8 [[TMP24]], i64 1, i1 false)
-; AARCH64-NOSCOPE-NEXT: [[TMP28:%.*]] = tail call i1 (...) @cond()
-; AARCH64-NOSCOPE-NEXT: br i1 [[TMP28]], label [[TMP29:%.*]], label [[TMP30:%.*]]
-; AARCH64-NOSCOPE: 29:
-; AARCH64-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-NOSCOPE-NEXT: br label [[TMP31:%.*]]
+; AARCH64-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP28]], i8 [[TMP24]], i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: [[TMP29:%.*]] = tail call i1 (...) @cond()
+; AARCH64-NOSCOPE-NEXT: br i1 [[TMP29]], label [[TMP30:%.*]], label [[TMP31:%.*]]
; AARCH64-NOSCOPE: 30:
-; AARCH64-NOSCOPE-NEXT: br label [[TMP31]]
+; AARCH64-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
+; AARCH64-NOSCOPE-NEXT: br label [[TMP32:%.*]]
; AARCH64-NOSCOPE: 31:
-; AARCH64-NOSCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-NOSCOPE-NEXT: [[TMP33:%.*]] = lshr i64 [[TMP32]], 4
-; AARCH64-NOSCOPE-NEXT: [[TMP34:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP33]]
-; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP34]], i8 0, i64 1, i1 false)
+; AARCH64-NOSCOPE-NEXT: br label [[TMP32]]
+; AARCH64-NOSCOPE: 32:
+; AARCH64-NOSCOPE-NEXT: [[TMP33:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-NOSCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-NOSCOPE-NEXT: [[TMP35:%.*]] = and i64 [[TMP34]], 72057594037927935
+; AARCH64-NOSCOPE-NEXT: [[TMP36:%.*]] = lshr i64 [[TMP35]], 4
+; AARCH64-NOSCOPE-NEXT: [[TMP37:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP36]]
+; AARCH64-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP37]], i8 [[TMP33]], i64 1, i1 false)
; AARCH64-NOSCOPE-NEXT: ret i32 0
;
; AARCH64-SHORT-SCOPE-LABEL: @diamond_lifetime(
@@ -1168,6 +1303,7 @@ define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SHORT-SCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-SCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-SCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-SCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-SCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-SCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -1178,30 +1314,35 @@ define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.lifetime.start.p0(i64 16, ptr nonnull [[TMP18]])
; AARCH64-SHORT-SCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-SCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP27]], i32 0
-; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP28]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP29]], align 1
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SHORT-SCOPE-NEXT: br i1 [[TMP30]], label [[TMP31:%.*]], label [[TMP35:%.*]]
-; AARCH64-SHORT-SCOPE: 31:
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
+; AARCH64-SHORT-SCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-SCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP30]], align 1
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP31:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SHORT-SCOPE-NEXT: br i1 [[TMP31]], label [[TMP32:%.*]], label [[TMP38:%.*]]
+; AARCH64-SHORT-SCOPE: 32:
; AARCH64-SHORT-SCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP32:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = lshr i64 [[TMP32]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP33]]
-; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP34]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP33:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP35:%.*]] = and i64 [[TMP34]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP36:%.*]] = lshr i64 [[TMP35]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP37:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP36]]
+; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP37]], i8 [[TMP33]], i64 1, i1 false)
; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP18]])
-; AARCH64-SHORT-SCOPE-NEXT: br label [[TMP39:%.*]]
-; AARCH64-SHORT-SCOPE: 35:
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP36:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP37:%.*]] = lshr i64 [[TMP36]], 4
-; AARCH64-SHORT-SCOPE-NEXT: [[TMP38:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP37]]
-; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP38]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-SCOPE-NEXT: br label [[TMP44:%.*]]
+; AARCH64-SHORT-SCOPE: 38:
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP39:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP40:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP41:%.*]] = and i64 [[TMP40]], 72057594037927935
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP42:%.*]] = lshr i64 [[TMP41]], 4
+; AARCH64-SHORT-SCOPE-NEXT: [[TMP43:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP42]]
+; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP43]], i8 [[TMP39]], i64 1, i1 false)
; AARCH64-SHORT-SCOPE-NEXT: call void @llvm.lifetime.end.p0(i64 16, ptr nonnull [[TMP18]])
-; AARCH64-SHORT-SCOPE-NEXT: br label [[TMP39]]
-; AARCH64-SHORT-SCOPE: 39:
+; AARCH64-SHORT-SCOPE-NEXT: br label [[TMP44]]
+; AARCH64-SHORT-SCOPE: 44:
; AARCH64-SHORT-SCOPE-NEXT: ret i32 0
;
; AARCH64-SHORT-NOSCOPE-LABEL: @diamond_lifetime(
@@ -1225,6 +1366,7 @@ define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP16:%.*]] = or i64 [[TMP3]], 4294967295
; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP16]], 1
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP17:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
+; AARCH64-SHORT-NOSCOPE-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP7]], 56
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP18:%.*]] = alloca { i8, [15 x i8] }, align 16
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP19:%.*]] = call i8 @__hwasan_generate_tag()
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP20:%.*]] = zext i8 [[TMP19]] to i64
@@ -1234,24 +1376,27 @@ define dso_local i32 @diamond_lifetime() local_unnamed_addr sanitize_hwaddress {
; AARCH64-SHORT-NOSCOPE-NEXT: [[ALLOCA_0_HWASAN:%.*]] = inttoptr i64 [[TMP23]] to ptr
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP24:%.*]] = trunc i64 [[TMP20]] to i8
; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP25:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = lshr i64 [[TMP25]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP26]]
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP27]], i32 0
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP28]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
-; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP29]], align 1
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP30:%.*]] = tail call i1 (...) @cond()
-; AARCH64-SHORT-NOSCOPE-NEXT: br i1 [[TMP30]], label [[TMP31:%.*]], label [[TMP32:%.*]]
-; AARCH64-SHORT-NOSCOPE: 31:
-; AARCH64-SHORT-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
-; AARCH64-SHORT-NOSCOPE-NEXT: br label [[TMP33:%.*]]
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP26:%.*]] = and i64 [[TMP25]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP27:%.*]] = lshr i64 [[TMP26]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP28:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP27]]
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP28]], i32 0
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 1, ptr [[TMP29]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP30:%.*]] = getelementptr i8, ptr [[TMP18]], i32 15
+; AARCH64-SHORT-NOSCOPE-NEXT: store i8 [[TMP24]], ptr [[TMP30]], align 1
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP31:%.*]] = tail call i1 (...) @cond()
+; AARCH64-SHORT-NOSCOPE-NEXT: br i1 [[TMP31]], label [[TMP32:%.*]], label [[TMP33:%.*]]
; AARCH64-SHORT-NOSCOPE: 32:
-; AARCH64-SHORT-NOSCOPE-NEXT: br label [[TMP33]]
+; AARCH64-SHORT-NOSCOPE-NEXT: call void @use(ptr nonnull [[ALLOCA_0_HWASAN]])
+; AARCH64-SHORT-NOSCOPE-NEXT: br label [[TMP34:%.*]]
; AARCH64-SHORT-NOSCOPE: 33:
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP34:%.*]] = ptrtoint ptr [[TMP18]] to i64
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP35:%.*]] = lshr i64 [[TMP34]], 4
-; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP36:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP35]]
-; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP36]], i8 0, i64 1, i1 false)
+; AARCH64-SHORT-NOSCOPE-NEXT: br label [[TMP34]]
+; AARCH64-SHORT-NOSCOPE: 34:
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP35:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP36:%.*]] = ptrtoint ptr [[TMP18]] to i64
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP37:%.*]] = and i64 [[TMP36]], 72057594037927935
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP38:%.*]] = lshr i64 [[TMP37]], 4
+; AARCH64-SHORT-NOSCOPE-NEXT: [[TMP39:%.*]] = getelementptr i8, ptr [[TMP17]], i64 [[TMP38]]
+; AARCH64-SHORT-NOSCOPE-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP39]], i8 [[TMP35]], i64 1, i1 false)
; AARCH64-SHORT-NOSCOPE-NEXT: ret i32 0
;
%1 = alloca i8, align 1
More information about the llvm-commits
mailing list