brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 60f8316 Raw
52 lines · plain
1; RUN: opt -S -passes=gvn-hoist < %s | FileCheck %s2 3; Check that the stores are not hoisted: it is invalid to hoist stores if they4; are not executed on all paths. In this testcase, there are paths in the loop5; that do not execute the stores.6 7; CHECK-LABEL: define i32 @main8; CHECK: store9; CHECK: store10; CHECK: store11 12@a = global i32 0, align 413 14define i32 @main() {15entry:16  br label %for.cond17 18for.cond:                                         ; preds = %for.inc5, %entry19  %0 = load i32, ptr @a, align 420  %cmp = icmp slt i32 %0, 121  br i1 %cmp, label %for.cond1, label %for.end722 23for.cond1:                                        ; preds = %for.cond, %for.inc24  %1 = load i32, ptr @a, align 425  %cmp2 = icmp slt i32 %1, 126  br i1 %cmp2, label %for.body3, label %for.inc527 28for.body3:                                        ; preds = %for.cond129  %tobool = icmp ne i32 %1, 030  br i1 %tobool, label %if.then, label %for.inc31 32if.then:                                          ; preds = %for.body333  %inc = add nsw i32 %1, 134  store i32 %inc, ptr @a, align 435  br label %for.inc36 37for.inc:                                          ; preds = %for.body3, %if.then38  %2 = load i32, ptr @a, align 439  %inc4 = add nsw i32 %2, 140  store i32 %inc4, ptr @a, align 441  br label %for.cond142 43for.inc5:                                         ; preds = %for.cond144  %inc6 = add nsw i32 %1, 145  store i32 %inc6, ptr @a, align 446  br label %for.cond47 48for.end7:                                         ; preds = %for.cond49  ret i32 %050}51 52