61 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=gvn -S %s | FileCheck %s3 4; Make sure GVN correctly sets the modified status when doing PRE.5 6define i32 @test(i64 %v, ptr %ptr.1, ptr %ptr.2, i1 %c) {7; CHECK-LABEL: @test(8; CHECK-NEXT: entry:9; CHECK-NEXT: [[L_0:%.*]] = load i32, ptr [[PTR_1:%.*]], align 410; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]11; CHECK: if.then:12; CHECK-NEXT: ret i32 1013; CHECK: if.end:14; CHECK-NEXT: [[L_0_EXT:%.*]] = zext i32 [[L_0]] to i6415; CHECK-NEXT: [[C_2:%.*]] = icmp eq i64 [[L_0_EXT]], 1016; CHECK-NEXT: br i1 [[C_2]], label [[IF_2_END:%.*]], label [[IF_2_THEN:%.*]]17; CHECK: if.2.then:18; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[PTR_1]], i64 [[V:%.*]]19; CHECK-NEXT: [[L_2:%.*]] = load i32, ptr [[GEP_1]], align 420; CHECK-NEXT: [[DOTPRE:%.*]] = zext i32 [[L_2]] to i6421; CHECK-NEXT: br label [[IF_2_END]]22; CHECK: if.2.end:23; CHECK-NEXT: [[REP_0_EXT_PRE_PHI:%.*]] = phi i64 [ [[DOTPRE]], [[IF_2_THEN]] ], [ 10, [[IF_END]] ]24; CHECK-NEXT: [[REP_0:%.*]] = phi i32 [ [[L_2]], [[IF_2_THEN]] ], [ [[L_0]], [[IF_END]] ]25; CHECK-NEXT: [[L_3:%.*]] = load ptr, ptr [[PTR_2:%.*]], align 826; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, ptr [[PTR_1]], i64 [[REP_0_EXT_PRE_PHI]]27; CHECK-NEXT: [[L_4:%.*]] = load i32, ptr [[GEP_2]], align 428; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i32, ptr [[L_3]], i64 1029; CHECK-NEXT: [[L_5:%.*]] = load i32, ptr [[GEP_3]], align 430; CHECK-NEXT: [[R:%.*]] = add i32 [[L_4]], [[L_5]]31; CHECK-NEXT: ret i32 [[R]]32;33entry:34 %l.0 = load i32, ptr %ptr.1, align 435 br i1 %c, label %if.then, label %if.end36 37if.then: ; preds = %entry38 ret i32 1039 40if.end: ; preds = %entry41 %l.0.ext = zext i32 %l.0 to i6442 %c.2 = icmp eq i64 %l.0.ext, 1043 br i1 %c.2, label %if.2.end, label %if.2.then44 45if.2.then: ; preds = %if.end46 %gep.1 = getelementptr inbounds i32, ptr %ptr.1, i64 %v47 %l.2 = load i32, ptr %gep.1, align 448 br label %if.2.end49 50if.2.end: ; preds = %if.then7, %if.end51 %rep.0 = phi i32 [ %l.2, %if.2.then ], [ %l.0, %if.end ]52 %l.3 = load ptr, ptr %ptr.2, align 853 %rep.0.ext = zext i32 %rep.0 to i6454 %gep.2 = getelementptr inbounds i32, ptr %ptr.1, i64 %rep.0.ext55 %l.4 = load i32, ptr %gep.2, align 456 %gep.3 = getelementptr inbounds i32, ptr %l.3, i64 1057 %l.5 = load i32, ptr %gep.3, align 458 %r = add i32 %l.4, %l.559 ret i32 %r60}61