[llvm] 66b650f - [NFC][msan] Add NormalArgAfterNoUndef testcase

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 20 21:08:28 PDT 2021


Author: Vitaly Buka
Date: 2021-10-20T21:08:12-07:00
New Revision: 66b650f3da70e45ca40ffa281df79e044c28fe04

URL: https://github.com/llvm/llvm-project/commit/66b650f3da70e45ca40ffa281df79e044c28fe04
DIFF: https://github.com/llvm/llvm-project/commit/66b650f3da70e45ca40ffa281df79e044c28fe04.diff

LOG: [NFC][msan] Add NormalArgAfterNoUndef testcase

Added: 
    

Modified: 
    llvm/test/Instrumentation/MemorySanitizer/msan_eager.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Instrumentation/MemorySanitizer/msan_eager.ll b/llvm/test/Instrumentation/MemorySanitizer/msan_eager.ll
index 5a1a120308cb..582d9a926344 100644
--- a/llvm/test/Instrumentation/MemorySanitizer/msan_eager.ll
+++ b/llvm/test/Instrumentation/MemorySanitizer/msan_eager.ll
@@ -67,6 +67,32 @@ define void @NormalArg(i32 noundef %a) nounwind uwtable sanitize_memory {
   ret void
 }
 
+define void @NormalArgAfterNoUndef(i32 noundef %a, i32 %b) nounwind uwtable sanitize_memory {
+; CHECK-LABEL: @NormalArgAfterNoUndef(
+; CHECK-NEXT:    [[TMP1:%.*]] = load i32, i32* bitcast ([100 x i64]* @__msan_param_tls to i32*), align 8
+; CHECK-NEXT:    [[TMP2:%.*]] = load i32, i32* getelementptr inbounds ([200 x i32], [200 x i32]* @__msan_param_origin_tls, i32 0, i32 0), align 4
+; CHECK-NEXT:    call void @llvm.donothing()
+; CHECK-NEXT:    [[P:%.*]] = inttoptr i64 0 to i32*
+; CHECK-NEXT:    [[TMP3:%.*]] = ptrtoint i32* [[P]] to i64
+; CHECK-NEXT:    [[TMP4:%.*]] = xor i64 [[TMP3]], 87960930222080
+; CHECK-NEXT:    [[TMP5:%.*]] = inttoptr i64 [[TMP4]] to i32*
+; CHECK-NEXT:    [[TMP6:%.*]] = add i64 [[TMP4]], 17592186044416
+; CHECK-NEXT:    [[TMP7:%.*]] = inttoptr i64 [[TMP6]] to i32*
+; CHECK-NEXT:    store i32 [[TMP1]], i32* [[TMP5]], align 4
+; CHECK-NEXT:    [[_MSCMP:%.*]] = icmp ne i32 [[TMP1]], 0
+; CHECK-NEXT:    br i1 [[_MSCMP]], label [[TMP8:%.*]], label [[TMP9:%.*]], !prof [[PROF0]]
+; CHECK:       8:
+; CHECK-NEXT:    store i32 [[TMP2]], i32* [[TMP7]], align 4
+; CHECK-NEXT:    br label [[TMP9]]
+; CHECK:       9:
+; CHECK-NEXT:    store i32 [[B:%.*]], i32* [[P]], align 4
+; CHECK-NEXT:    ret void
+;
+  %p = inttoptr i64 0 to i32 *
+  store i32 %b, i32 *%p
+  ret void
+}
+
 define void @PartialArg(i32 %a) nounwind uwtable sanitize_memory {
 ; CHECK-LABEL: @PartialArg(
 ; CHECK-NEXT:    [[TMP1:%.*]] = load i32, i32* bitcast ([100 x i64]* @__msan_param_tls to i32*), align 8
@@ -105,6 +131,19 @@ define void @CallNormal() nounwind uwtable sanitize_memory {
   ret void
 }
 
+define void @CallNormalArgAfterNoUndef() nounwind uwtable sanitize_memory {
+; CHECK-LABEL: @CallNormalArgAfterNoUndef(
+; CHECK-NEXT:    call void @llvm.donothing()
+; CHECK-NEXT:    [[R:%.*]] = call i32 @NormalRet() #[[ATTR0]]
+; CHECK-NEXT:    store i32 0, i32* bitcast ([100 x i64]* @__msan_param_tls to i32*), align 8
+; CHECK-NEXT:    call void @NormalArgAfterNoUndef(i32 [[R]], i32 [[R]]) #[[ATTR0]]
+; CHECK-NEXT:    ret void
+;
+  %r = call i32 @NormalRet() nounwind uwtable sanitize_memory
+  call void @NormalArgAfterNoUndef(i32 %r, i32 %r) nounwind uwtable sanitize_memory
+  ret void
+}
+
 define void @CallWithLoaded() nounwind uwtable sanitize_memory {
 ; CHECK-LABEL: @CallWithLoaded(
 ; CHECK-NEXT:    call void @llvm.donothing()


        


More information about the llvm-commits mailing list