InstSimplify: ((X % Y) % Y) -> (X % Y)

Patch by Sonam Kumari!

Differential Revision: http://reviews.llvm.org/D5350

llvm-svn: 217937
diff --git a/llvm/test/Transforms/InstSimplify/rem.ll b/llvm/test/Transforms/InstSimplify/rem.ll
index 80fa8e7..b757ccd 100644
--- a/llvm/test/Transforms/InstSimplify/rem.ll
+++ b/llvm/test/Transforms/InstSimplify/rem.ll
@@ -15,3 +15,12 @@
   ret i32 %rem
 ; CHECK: ret i32 0
 }
+
+define i32 @select3(i32 %x, i32 %n) {
+; CHECK-LABEL: @select3(
+; CHECK-NEXT: %mod = srem i32 %x, %n
+; CHECK-NEXT: ret i32 %mod
+ %mod = srem i32 %x, %n
+ %mod1 = srem i32 %mod, %n
+ ret i32 %mod1
+}