From e077e3a6483efcb2099670537a6d7168629b2eb3 Mon Sep 17 00:00:00 2001 From: "chenglin.bi" Date: Fri, 22 Apr 2022 00:12:06 +0800 Subject: [PATCH] [InstCombine] add baseline test for (X * C2) << C1 --> X * (C2 << C1) without one use; NFC --- llvm/test/Transforms/InstCombine/apint-shift.ll | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/apint-shift.ll b/llvm/test/Transforms/InstCombine/apint-shift.ll index a1f164cca32e..039f263101f5 100644 --- a/llvm/test/Transforms/InstCombine/apint-shift.ll +++ b/llvm/test/Transforms/InstCombine/apint-shift.ll @@ -23,6 +23,21 @@ define i55 @test6a(i55 %A) { ret i55 %C } +declare void @use(i55 %0) + +define i55 @test6a_negative_oneuse(i55 %A) { +; CHECK-LABEL: @test6a_negative_oneuse( +; CHECK-NEXT: [[B:%.*]] = mul i55 [[A:%.*]], 3 +; CHECK-NEXT: [[C:%.*]] = mul i55 [[A]], 6 +; CHECK-NEXT: call void @use(i55 [[B]]) +; CHECK-NEXT: ret i55 [[C]] +; + %B = mul i55 %A, 3 + %C = shl i55 %B, 1 + call void @use(i55 %B) + ret i55 %C +} + ; (X * C2) << C1 --> X * (C2 << C1) define <2 x i55> @test6a_vec(<2 x i55> %A) {