54 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -passes=gvn -enable-pre -S | FileCheck %s --check-prefixes=CHECK,MDEP3; RUN: opt < %s -passes='gvn<memoryssa>' -enable-pre -S | FileCheck %s --check-prefixes=CHECK,MSSA4; RUN: opt < %s -passes="gvn<pre>" -enable-pre=false -S | FileCheck %s5 6@H = common global i32 0 ; <ptr> [#uses=2]7@G = common global i32 0 ; <ptr> [#uses=1]8 9define i32 @test() nounwind {10; CHECK-LABEL: define i32 @test(11; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {12; CHECK-NEXT: [[ENTRY:.*:]]13; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @H, align 414; CHECK-NEXT: [[TMP1:%.*]] = call i32 (...) @foo() #[[ATTR0]]15; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 016; CHECK-NEXT: br i1 [[TMP2]], label %[[BB:.*]], label %[[ENTRY_BB1_CRIT_EDGE:.*]]17; CHECK: [[ENTRY_BB1_CRIT_EDGE]]:18; CHECK-NEXT: [[DOTPRE:%.*]] = add i32 [[TMP0]], 4219; CHECK-NEXT: br label %[[BB1:.*]]20; CHECK: [[BB]]:21; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[TMP0]], 4222; CHECK-NEXT: store i32 [[TMP3]], ptr @G, align 423; CHECK-NEXT: br label %[[BB1]]24; CHECK: [[BB1]]:25; CHECK-NEXT: [[DOTPRE_PHI:%.*]] = phi i32 [ [[DOTPRE]], %[[ENTRY_BB1_CRIT_EDGE]] ], [ [[TMP3]], %[[BB]] ]26; CHECK-NEXT: store i32 [[DOTPRE_PHI]], ptr @H, align 427; CHECK-NEXT: ret i32 028;29entry:30 %0 = load i32, ptr @H, align 4 ; <i32> [#uses=2]31 %1 = call i32 (...) @foo() nounwind ; <i32> [#uses=1]32 %2 = icmp ne i32 %1, 0 ; <i1> [#uses=1]33 br i1 %2, label %bb, label %bb134 35bb: ; preds = %entry36 %3 = add i32 %0, 42 ; <i32> [#uses=1]37 store i32 %3, ptr @G, align 438 br label %bb139 40bb1: ; preds = %bb, %entry41 %4 = add i32 %0, 42 ; <i32> [#uses=1]42 store i32 %4, ptr @H, align 443 br label %return44 45 46return: ; preds = %bb147 ret i32 048}49 50declare i32 @foo(...)51;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:52; MDEP: {{.*}}53; MSSA: {{.*}}54