This patch removed duplicate code for matching patterns
which are now handled in SimplifyUsingDistributiveLaws()
(after r211261)
Differential Revision: http://reviews.llvm.org/D4253
llvm-svn: 211768
diff --git a/llvm/test/Transforms/InstSimplify/2010-12-20-Distribute.ll b/llvm/test/Transforms/InstCombine/distribute.ll
similarity index 78%
rename from llvm/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
rename to llvm/test/Transforms/InstCombine/distribute.ll
index 9ea0a5e..e6360f8 100644
--- a/llvm/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
+++ b/llvm/test/Transforms/InstCombine/distribute.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -instsimplify -S | FileCheck %s
+; RUN: opt < %s -instcombine -S | FileCheck %s
define i32 @factorize(i32 %x, i32 %y) {
; CHECK-LABEL: @factorize(
@@ -28,27 +28,32 @@
%r = or i32 %x, %b
%z = and i32 %l, %r
ret i32 %z
-; CHECK: ret i32 %r
+; CHECK: %z = or i32 %b, %x
+; CHECK: ret i32 %z
}
define i32 @factorize4(i32 %x, i32 %y) {
; CHECK-LABEL: @factorize4(
+; ((Y << 1) * X) - (X * Y) -> (X * (Y * 2 - Y)) -> (X * Y)
%sh = shl i32 %y, 1
%ml = mul i32 %sh, %x
%mr = mul i32 %x, %y
%s = sub i32 %ml, %mr
ret i32 %s
-; CHECK: ret i32 %mr
+; CHECK: %s = mul i32 %y, %x
+; CHECK: ret i32 %s
}
define i32 @factorize5(i32 %x, i32 %y) {
; CHECK-LABEL: @factorize5(
+; ((Y * 2) * X) - (X * Y) -> (X * Y)
%sh = mul i32 %y, 2
%ml = mul i32 %sh, %x
%mr = mul i32 %x, %y
%s = sub i32 %ml, %mr
ret i32 %s
-; CHECK: ret i32 %mr
+; CHECK: %s = mul i32 %y, %x
+; CHECK: ret i32 %s
}
define i32 @expand(i32 %x) {
@@ -58,5 +63,6 @@
%b = or i32 %a, 2
%c = and i32 %b, 1
ret i32 %c
+; CHECK: %a = and i32 %x, 1
; CHECK: ret i32 %a
}