1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basicaa -newgvn -S | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 %rec11 = type { i16, i16, i16 }
7 @str = global %rec11 { i16 1, i16 2, i16 3 }
9 ;; Test that we forward the first store to the second load
10 define i16 @bazinga() {
11 ; CHECK-LABEL: @bazinga(
12 ; CHECK-NEXT: [[_TMP10:%.*]] = load i16, i16* getelementptr inbounds (%rec11, %rec11* @str, i64 0, i32 1)
13 ; CHECK-NEXT: store i16 [[_TMP10]], i16* getelementptr inbounds (%rec11, %rec11* @str, i64 0, i32 0)
14 ; CHECK-NEXT: [[_TMP15:%.*]] = icmp eq i16 [[_TMP10]], 3
15 ; CHECK-NEXT: [[_TMP16:%.*]] = select i1 [[_TMP15]], i16 1, i16 0
16 ; CHECK-NEXT: br label [[BB1:%.*]]
18 ; CHECK-NEXT: ret i16 [[_TMP16]]
20 %_tmp9 = getelementptr %rec11, %rec11* @str, i16 0, i32 1
21 %_tmp10 = load i16, i16* %_tmp9
22 %_tmp12 = getelementptr %rec11, %rec11* @str, i16 0, i32 0
23 store i16 %_tmp10, i16* %_tmp12
24 %_tmp13 = getelementptr %rec11, %rec11* @str, i16 0, i32 0
25 %_tmp14 = load i16, i16* %_tmp13
26 %_tmp15 = icmp eq i16 %_tmp14, 3
27 %_tmp16 = select i1 %_tmp15, i16 1, i16 0