; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -opaque-pointers=0 -passes=newgvn -S %s | FileCheck %s
+; RUN: opt -passes=newgvn -S %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
declare noalias i8* @_Znam(i64) #1
define i32 @TestNoAsan() {
; CHECK-LABEL: @TestNoAsan(
-; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @_Znam(i64 2)
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, i8* [[TMP1]], i64 1
-; CHECK-NEXT: store i8 0, i8* [[TMP2]], align 1
-; CHECK-NEXT: store i8 0, i8* [[TMP1]], align 1
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast i8* [[TMP1]] to i16*
-; CHECK-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP3]], align 4
-; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i16 [[TMP4]], 0
-; CHECK-NEXT: br i1 [[TMP5]], label [[TMP11:%.*]], label [[TMP6:%.*]]
-; CHECK: 6:
-; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, i8* [[TMP1]], i64 2
-; CHECK-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP7]] to i16*
-; CHECK-NEXT: [[TMP9:%.*]] = load i16, i16* [[TMP8]], align 2
-; CHECK-NEXT: [[TMP10:%.*]] = sext i16 [[TMP9]] to i32
-; CHECK-NEXT: br label [[TMP11]]
-; CHECK: 11:
-; CHECK-NEXT: [[TMP12:%.*]] = phi i32 [ [[TMP10]], [[TMP6]] ], [ 0, [[TMP0:%.*]] ]
-; CHECK-NEXT: ret i32 [[TMP12]]
+; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias ptr @_Znam(i64 2)
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i64 1
+; CHECK-NEXT: store i8 0, ptr [[TMP2]], align 1
+; CHECK-NEXT: store i8 0, ptr [[TMP1]], align 1
+; CHECK-NEXT: [[TMP3:%.*]] = load i16, ptr [[TMP1]], align 4
+; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i16 [[TMP3]], 0
+; CHECK-NEXT: br i1 [[TMP4]], label [[TMP9:%.*]], label [[TMP5:%.*]]
+; CHECK: 5:
+; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i64 2
+; CHECK-NEXT: [[TMP7:%.*]] = load i16, ptr [[TMP6]], align 2
+; CHECK-NEXT: [[TMP8:%.*]] = sext i16 [[TMP7]] to i32
+; CHECK-NEXT: br label [[TMP9]]
+; CHECK: 9:
+; CHECK-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP5]] ], [ 0, [[TMP0:%.*]] ]
+; CHECK-NEXT: ret i32 [[TMP10]]
;
- %1 = tail call noalias i8* @_Znam(i64 2)
- %2 = getelementptr inbounds i8, i8* %1, i64 1
- store i8 0, i8* %2, align 1
- store i8 0, i8* %1, align 1
- %3 = bitcast i8* %1 to i16*
- %4 = load i16, i16* %3, align 4
- %5 = icmp eq i16 %4, 0
- br i1 %5, label %11, label %6
+ %1 = tail call noalias ptr @_Znam(i64 2)
+ %2 = getelementptr inbounds i8, ptr %1, i64 1
+ store i8 0, ptr %2, align 1
+ store i8 0, ptr %1, align 1
+ %3 = load i16, ptr %1, align 4
+ %4 = icmp eq i16 %3, 0
+ br i1 %4, label %9, label %5
-; <label>:6 ; preds = %0
- %7 = getelementptr inbounds i8, i8* %1, i64 2
- %8 = bitcast i8* %7 to i16*
- %9 = load i16, i16* %8, align 2
- %10 = sext i16 %9 to i32
- br label %11
+; <label>:5 ; preds = %0
+ %6 = getelementptr inbounds i8, ptr %1, i64 2
+ %7 = load i16, ptr %6, align 2
+ %8 = sext i16 %7 to i32
+ br label %9
-; <label>:11 ; preds = %0, %6
- %12 = phi i32 [ %10, %6 ], [ 0, %0 ]
- ret i32 %12
+; <label>:9 ; preds = %0, %5
+ %10 = phi i32 [ %8, %5 ], [ 0, %0 ]
+ ret i32 %10
}
define i32 @TestAsan() sanitize_address {
; CHECK-LABEL: @TestAsan(
-; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @_Znam(i64 2)
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, i8* [[TMP1]], i64 1
-; CHECK-NEXT: store i8 0, i8* [[TMP2]], align 1
-; CHECK-NEXT: store i8 0, i8* [[TMP1]], align 1
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast i8* [[TMP1]] to i16*
-; CHECK-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP3]], align 4
-; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i16 [[TMP4]], 0
-; CHECK-NEXT: br i1 [[TMP5]], label [[TMP11:%.*]], label [[TMP6:%.*]]
-; CHECK: 6:
-; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, i8* [[TMP1]], i64 2
-; CHECK-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP7]] to i16*
-; CHECK-NEXT: [[TMP9:%.*]] = load i16, i16* [[TMP8]], align 2
-; CHECK-NEXT: [[TMP10:%.*]] = sext i16 [[TMP9]] to i32
-; CHECK-NEXT: br label [[TMP11]]
-; CHECK: 11:
-; CHECK-NEXT: [[TMP12:%.*]] = phi i32 [ [[TMP10]], [[TMP6]] ], [ 0, [[TMP0:%.*]] ]
-; CHECK-NEXT: ret i32 [[TMP12]]
+; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias ptr @_Znam(i64 2)
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i64 1
+; CHECK-NEXT: store i8 0, ptr [[TMP2]], align 1
+; CHECK-NEXT: store i8 0, ptr [[TMP1]], align 1
+; CHECK-NEXT: [[TMP3:%.*]] = load i16, ptr [[TMP1]], align 4
+; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i16 [[TMP3]], 0
+; CHECK-NEXT: br i1 [[TMP4]], label [[TMP9:%.*]], label [[TMP5:%.*]]
+; CHECK: 5:
+; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i64 2
+; CHECK-NEXT: [[TMP7:%.*]] = load i16, ptr [[TMP6]], align 2
+; CHECK-NEXT: [[TMP8:%.*]] = sext i16 [[TMP7]] to i32
+; CHECK-NEXT: br label [[TMP9]]
+; CHECK: 9:
+; CHECK-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP5]] ], [ 0, [[TMP0:%.*]] ]
+; CHECK-NEXT: ret i32 [[TMP10]]
;
- %1 = tail call noalias i8* @_Znam(i64 2)
- %2 = getelementptr inbounds i8, i8* %1, i64 1
- store i8 0, i8* %2, align 1
- store i8 0, i8* %1, align 1
- %3 = bitcast i8* %1 to i16*
- %4 = load i16, i16* %3, align 4
- %5 = icmp eq i16 %4, 0
- br i1 %5, label %11, label %6
+ %1 = tail call noalias ptr @_Znam(i64 2)
+ %2 = getelementptr inbounds i8, ptr %1, i64 1
+ store i8 0, ptr %2, align 1
+ store i8 0, ptr %1, align 1
+ %3 = load i16, ptr %1, align 4
+ %4 = icmp eq i16 %3, 0
+ br i1 %4, label %9, label %5
-; <label>:6 ; preds = %0
- %7 = getelementptr inbounds i8, i8* %1, i64 2
- %8 = bitcast i8* %7 to i16*
- %9 = load i16, i16* %8, align 2
- %10 = sext i16 %9 to i32
- br label %11
+; <label>:5 ; preds = %0
+ %6 = getelementptr inbounds i8, ptr %1, i64 2
+ %7 = load i16, ptr %6, align 2
+ %8 = sext i16 %7 to i32
+ br label %9
-; <label>:11 ; preds = %0, %6
- %12 = phi i32 [ %10, %6 ], [ 0, %0 ]
- ret i32 %12
+; <label>:9 ; preds = %0, %5
+ %10 = phi i32 [ %8, %5 ], [ 0, %0 ]
+ ret i32 %10
}
define i32 @TestHWAsan() sanitize_hwaddress {
; CHECK-LABEL: @TestHWAsan(
-; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @_Znam(i64 2)
-; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, i8* [[TMP1]], i64 1
-; CHECK-NEXT: store i8 0, i8* [[TMP2]], align 1
-; CHECK-NEXT: store i8 0, i8* [[TMP1]], align 1
-; CHECK-NEXT: [[TMP3:%.*]] = bitcast i8* [[TMP1]] to i16*
-; CHECK-NEXT: [[TMP4:%.*]] = load i16, i16* [[TMP3]], align 4
-; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i16 [[TMP4]], 0
-; CHECK-NEXT: br i1 [[TMP5]], label [[TMP11:%.*]], label [[TMP6:%.*]]
-; CHECK: 6:
-; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, i8* [[TMP1]], i64 2
-; CHECK-NEXT: [[TMP8:%.*]] = bitcast i8* [[TMP7]] to i16*
-; CHECK-NEXT: [[TMP9:%.*]] = load i16, i16* [[TMP8]], align 2
-; CHECK-NEXT: [[TMP10:%.*]] = sext i16 [[TMP9]] to i32
-; CHECK-NEXT: br label [[TMP11]]
-; CHECK: 11:
-; CHECK-NEXT: [[TMP12:%.*]] = phi i32 [ [[TMP10]], [[TMP6]] ], [ 0, [[TMP0:%.*]] ]
-; CHECK-NEXT: ret i32 [[TMP12]]
+; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias ptr @_Znam(i64 2)
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i64 1
+; CHECK-NEXT: store i8 0, ptr [[TMP2]], align 1
+; CHECK-NEXT: store i8 0, ptr [[TMP1]], align 1
+; CHECK-NEXT: [[TMP3:%.*]] = load i16, ptr [[TMP1]], align 4
+; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i16 [[TMP3]], 0
+; CHECK-NEXT: br i1 [[TMP4]], label [[TMP9:%.*]], label [[TMP5:%.*]]
+; CHECK: 5:
+; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[TMP1]], i64 2
+; CHECK-NEXT: [[TMP7:%.*]] = load i16, ptr [[TMP6]], align 2
+; CHECK-NEXT: [[TMP8:%.*]] = sext i16 [[TMP7]] to i32
+; CHECK-NEXT: br label [[TMP9]]
+; CHECK: 9:
+; CHECK-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP5]] ], [ 0, [[TMP0:%.*]] ]
+; CHECK-NEXT: ret i32 [[TMP10]]
;
- %1 = tail call noalias i8* @_Znam(i64 2)
- %2 = getelementptr inbounds i8, i8* %1, i64 1
- store i8 0, i8* %2, align 1
- store i8 0, i8* %1, align 1
- %3 = bitcast i8* %1 to i16*
- %4 = load i16, i16* %3, align 4
- %5 = icmp eq i16 %4, 0
- br i1 %5, label %11, label %6
+ %1 = tail call noalias ptr @_Znam(i64 2)
+ %2 = getelementptr inbounds i8, ptr %1, i64 1
+ store i8 0, ptr %2, align 1
+ store i8 0, ptr %1, align 1
+ %3 = load i16, ptr %1, align 4
+ %4 = icmp eq i16 %3, 0
+ br i1 %4, label %9, label %5
-; <label>:6 ; preds = %0
- %7 = getelementptr inbounds i8, i8* %1, i64 2
- %8 = bitcast i8* %7 to i16*
- %9 = load i16, i16* %8, align 2
- %10 = sext i16 %9 to i32
- br label %11
+; <label>:5 ; preds = %0
+ %6 = getelementptr inbounds i8, ptr %1, i64 2
+ %7 = load i16, ptr %6, align 2
+ %8 = sext i16 %7 to i32
+ br label %9
-; <label>:11 ; preds = %0, %6
- %12 = phi i32 [ %10, %6 ], [ 0, %0 ]
- ret i32 %12
+; <label>:9 ; preds = %0, %5
+ %10 = phi i32 [ %8, %5 ], [ 0, %0 ]
+ ret i32 %10
}