-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[msan] Update origin for the entire destination range on memory store.
Previously we always stored 4 bytes of origin at the destination address even for 8-byte (and longer) stores. This should fix rare missing, or incorrect, origin stacks in MSan reports. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226658 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
2 changed files
with
138 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s | ||
|
||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" | ||
target triple = "x86_64-unknown-linux-gnu" | ||
|
||
|
||
; Test origin for longer stores. | ||
|
||
define void @Store8(i64* nocapture %p, i64 %x) sanitize_memory { | ||
entry: | ||
store i64 %x, i64* %p, align 8 | ||
ret void | ||
} | ||
|
||
; Single 8-byte origin store | ||
; CHECK-LABEL: define void @Store8( | ||
; CHECK: store i64 {{.*}}, align 8 | ||
; CHECK: store i64 {{.*}}, align 8 | ||
; CHECK: store i64 {{.*}}, align 8 | ||
; CHECK: ret void | ||
|
||
define void @Store8_align4(i64* nocapture %p, i64 %x) sanitize_memory { | ||
entry: | ||
store i64 %x, i64* %p, align 4 | ||
ret void | ||
} | ||
|
||
; Two 4-byte origin stores | ||
; CHECK-LABEL: define void @Store8_align4( | ||
; CHECK: store i64 {{.*}}, align 4 | ||
; CHECK: store i32 {{.*}}, align 4 | ||
; CHECK: getelementptr i32* {{.*}}, i32 1 | ||
; CHECK: store i32 {{.*}}, align 4 | ||
; CHECK: store i64 {{.*}}, align 4 | ||
; CHECK: ret void | ||
|
||
%struct.S = type { i32, i32, i32 } | ||
|
||
define void @StoreAgg(%struct.S* nocapture %p, %struct.S %x) sanitize_memory { | ||
entry: | ||
store %struct.S %x, %struct.S* %p, align 4 | ||
ret void | ||
} | ||
|
||
; Three 4-byte origin stores | ||
; CHECK-LABEL: define void @StoreAgg( | ||
; CHECK: store { i32, i32, i32 } {{.*}}, align 4 | ||
; CHECK: store i32 {{.*}}, align 4 | ||
; CHECK: getelementptr i32* {{.*}}, i32 1 | ||
; CHECK: store i32 {{.*}}, align 4 | ||
; CHECK: getelementptr i32* {{.*}}, i32 2 | ||
; CHECK: store i32 {{.*}}, align 4 | ||
; CHECK: store %struct.S {{.*}}, align 4 | ||
; CHECK: ret void | ||
|
||
|
||
define void @StoreAgg8(%struct.S* nocapture %p, %struct.S %x) sanitize_memory { | ||
entry: | ||
store %struct.S %x, %struct.S* %p, align 8 | ||
ret void | ||
} | ||
|
||
; 8-byte + 4-byte origin stores | ||
; CHECK-LABEL: define void @StoreAgg8( | ||
; CHECK: store { i32, i32, i32 } {{.*}}, align 8 | ||
; CHECK: store i64 {{.*}}, align 8 | ||
; CHECK: getelementptr i32* {{.*}}, i32 2 | ||
; CHECK: store i32 {{.*}}, align 8 | ||
; CHECK: store %struct.S {{.*}}, align 8 | ||
; CHECK: ret void | ||
|
||
|
||
%struct.Q = type { i64, i64, i64 } | ||
define void @StoreAgg24(%struct.Q* nocapture %p, %struct.Q %x) sanitize_memory { | ||
entry: | ||
store %struct.Q %x, %struct.Q* %p, align 8 | ||
ret void | ||
} | ||
|
||
; 3 8-byte origin stores | ||
; CHECK-LABEL: define void @StoreAgg24( | ||
; CHECK: store { i64, i64, i64 } {{.*}}, align 8 | ||
; CHECK: store i64 {{.*}}, align 8 | ||
; CHECK: getelementptr i64* {{.*}}, i32 1 | ||
; CHECK: store i64 {{.*}}, align 8 | ||
; CHECK: getelementptr i64* {{.*}}, i32 2 | ||
; CHECK: store i64 {{.*}}, align 8 | ||
; CHECK: store %struct.Q {{.*}}, align 8 | ||
; CHECK: ret void |