From 7551fd5ef8fdc450483b987d6cd44b76b0671ad9 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 30 Jul 2020 14:16:18 -0400 Subject: [PATCH] [InstCombine] update test checks; NFC --- .../test/Transforms/InstCombine/distribute.ll | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/llvm/test/Transforms/InstCombine/distribute.ll b/llvm/test/Transforms/InstCombine/distribute.ll index e6360f8ba64e..c598b975ce80 100644 --- a/llvm/test/Transforms/InstCombine/distribute.ll +++ b/llvm/test/Transforms/InstCombine/distribute.ll @@ -1,68 +1,75 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s define i32 @factorize(i32 %x, i32 %y) { ; CHECK-LABEL: @factorize( +; CHECK-NEXT: ret i32 [[X:%.*]] +; ; (X | 1) & (X | 2) -> X | (1 & 2) -> X %l = or i32 %x, 1 %r = or i32 %x, 2 %z = and i32 %l, %r ret i32 %z -; CHECK: ret i32 %x } define i32 @factorize2(i32 %x) { ; CHECK-LABEL: @factorize2( +; CHECK-NEXT: ret i32 [[X:%.*]] +; ; 3*X - 2*X -> X %l = mul i32 3, %x %r = mul i32 2, %x %z = sub i32 %l, %r ret i32 %z -; CHECK: ret i32 %x } define i32 @factorize3(i32 %x, i32 %a, i32 %b) { ; CHECK-LABEL: @factorize3( +; CHECK-NEXT: [[Z:%.*]] = or i32 [[B:%.*]], [[X:%.*]] +; CHECK-NEXT: ret i32 [[Z]] +; ; (X | (A|B)) & (X | B) -> X | ((A|B) & B) -> X | B %aORb = or i32 %a, %b %l = or i32 %x, %aORb %r = or i32 %x, %b %z = and i32 %l, %r ret i32 %z -; CHECK: %z = or i32 %b, %x -; CHECK: ret i32 %z } define i32 @factorize4(i32 %x, i32 %y) { ; CHECK-LABEL: @factorize4( +; CHECK-NEXT: [[S:%.*]] = mul i32 [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: ret i32 [[S]] +; ; ((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: %s = mul i32 %y, %x -; CHECK: ret i32 %s } define i32 @factorize5(i32 %x, i32 %y) { ; CHECK-LABEL: @factorize5( +; CHECK-NEXT: [[S:%.*]] = mul i32 [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: ret i32 [[S]] +; ; ((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: %s = mul i32 %y, %x -; CHECK: ret i32 %s } define i32 @expand(i32 %x) { ; CHECK-LABEL: @expand( +; CHECK-NEXT: [[A:%.*]] = and i32 [[X:%.*]], 1 +; CHECK-NEXT: ret i32 [[A]] +; ; ((X & 1) | 2) & 1 -> ((X & 1) & 1) | (2 & 1) -> (X & 1) | 0 -> X & 1 %a = and i32 %x, 1 %b = or i32 %a, 2 %c = and i32 %b, 1 ret i32 %c -; CHECK: %a = and i32 %x, 1 -; CHECK: ret i32 %a } -- 2.34.1