1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instcombine -S | FileCheck %s
3
4@x = weak global i32 0
5
6define void @self_assign_1() {
7; CHECK-LABEL: @self_assign_1(
8; CHECK-NEXT:  entry:
9; CHECK-NEXT:    [[TMP:%.*]] = load volatile i32, i32* @x, align 4
10; CHECK-NEXT:    store volatile i32 [[TMP]], i32* @x, align 4
11; CHECK-NEXT:    br label [[RETURN:%.*]]
12; CHECK:       return:
13; CHECK-NEXT:    ret void
14;
15entry:
16  %tmp = load volatile i32, i32* @x
17  store volatile i32 %tmp, i32* @x
18  br label %return
19
20return:
21  ret void
22}
23
24define void @volatile_store_before_unreachable(i1 %c, i8* %p) {
25; CHECK-LABEL: @volatile_store_before_unreachable(
26; CHECK-NEXT:    br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]]
27; CHECK:       true:
28; CHECK-NEXT:    store volatile i8 0, i8* [[P:%.*]], align 1
29; CHECK-NEXT:    unreachable
30; CHECK:       false:
31; CHECK-NEXT:    ret void
32;
33  br i1 %c, label %true, label %false
34
35true:
36  store volatile i8 0, i8* %p
37  unreachable
38
39false:
40  ret void
41}
42