From feb879a7184fa7c0003d60636ca9b0f89e2a55c8 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Sun, 5 Jun 2016 21:17:00 +0000 Subject: [PATCH] Add test case for InstCombiner::commonIRemTransforms; NFC The PHI case in commonIRemTransforms was untested; add a trivial test case. llvm-svn: 271856 --- test/Transforms/InstCombine/rem.ll | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/Transforms/InstCombine/rem.ll b/test/Transforms/InstCombine/rem.ll index 227344f16f2..8011316fe73 100644 --- a/test/Transforms/InstCombine/rem.ll +++ b/test/Transforms/InstCombine/rem.ll @@ -231,3 +231,26 @@ define <2 x i64> @test20(<2 x i64> %X, <2 x i1> %C) { %R = urem <2 x i64> %V, ret <2 x i64> %R } + +define i32 @test21(i1 %c0, i32* %val) { +; CHECK-LABEL: @test21( +entry: + br i1 %c0, label %if.then, label %if.end + +if.then: +; CHECK: if.then: +; CHECK-NEXT: %v = load volatile i32, i32* %val, align 4 +; CHECK-NEXT: %phitmp = srem i32 %v, 5 + + %v = load volatile i32, i32* %val + br label %if.end + +if.end: +; CHECK: if.end: +; CHECK-NEXT: %lhs = phi i32 [ %phitmp, %if.then ], [ 0, %entry ] +; CHECK-NEXT: ret i32 %lhs + + %lhs = phi i32 [ %v, %if.then ], [ 5, %entry ] + %rem = srem i32 %lhs, 5 + ret i32 %rem +}