brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 1d89dd6 Raw
36 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 62; RUN: opt %s -passes=instcombine,mem2reg,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -o - | FileCheck %s3 4; Test to make sure that instcombine does not accidentally propagate the load5; into the PHI, which would break the program.6 7define i32 @test(i1 %C) {8; CHECK-LABEL: define i32 @test(9; CHECK-SAME: i1 [[C:%.*]]) {10; CHECK-NEXT:  [[ENTRY:.*:]]11; CHECK-NEXT:    [[X:%.*]] = alloca i32, align 412; CHECK-NEXT:    [[X2:%.*]] = alloca i32, align 413; CHECK-NEXT:    store i32 1, ptr [[X]], align 414; CHECK-NEXT:    store i32 2, ptr [[X2]], align 415; CHECK-NEXT:    [[SPEC_SELECT:%.*]] = select i1 [[C]], ptr [[X]], ptr [[X2]]16; CHECK-NEXT:    store i32 3, ptr [[X]], align 417; CHECK-NEXT:    [[TMP_3:%.*]] = load i32, ptr [[SPEC_SELECT]], align 418; CHECK-NEXT:    ret i32 [[TMP_3]]19;20entry:21  %X = alloca i32         ; <ptr> [#uses=3]22  %X2 = alloca i32                ; <ptr> [#uses=2]23  store i32 1, ptr %X24  store i32 2, ptr %X225  br i1 %C, label %cond_true.i, label %cond_continue.i26 27cond_true.i:            ; preds = %entry28  br label %cond_continue.i29 30cond_continue.i:                ; preds = %cond_true.i, %entry31  %mem_tmp.i.0 = phi ptr [ %X, %cond_true.i ], [ %X2, %entry ]           ; <ptr> [#uses=1]32  store i32 3, ptr %X33  %tmp.3 = load i32, ptr %mem_tmp.i.0         ; <i32> [#uses=1]34  ret i32 %tmp.335}36