31 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=newgvn -S | FileCheck %s3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"4 5%rec11 = type { i16, i16, i16 }6 7@str = global %rec11 { i16 1, i16 2, i16 3 }8 9;; Test that we forward the first store to the second load10define i16 @bazinga() {11; CHECK-LABEL: @bazinga(12; CHECK-NEXT: [[_TMP10:%.*]] = load i16, ptr getelementptr inbounds nuw (i8, ptr @str, i64 2), align 213; CHECK-NEXT: store i16 [[_TMP10]], ptr @str, align 214; CHECK-NEXT: [[_TMP15:%.*]] = icmp eq i16 [[_TMP10]], 315; CHECK-NEXT: [[_TMP16:%.*]] = select i1 [[_TMP15]], i16 1, i16 016; CHECK-NEXT: br label [[BB1:%.*]]17; CHECK: bb1:18; CHECK-NEXT: ret i16 [[_TMP16]]19;20 %_tmp9 = getelementptr %rec11, ptr @str, i16 0, i32 121 %_tmp10 = load i16, ptr %_tmp922 store i16 %_tmp10, ptr @str23 %_tmp14 = load i16, ptr @str24 %_tmp15 = icmp eq i16 %_tmp14, 325 %_tmp16 = select i1 %_tmp15, i16 1, i16 026 br label %bb127 28bb1:29 ret i16 %_tmp1630}31