xref: /llvm-project/llvm/test/Transforms/Reassociate/shift-factor.ll (revision 0676acb6fd8d5e22fde16e6ec977ceac08427ab0)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=reassociate,instcombine -S | FileCheck %s
3
4; There should be exactly one shift and one add left.
5
6define i32 @test1(i32 %X, i32 %Y) {
7; CHECK-LABEL: @test1(
8; CHECK-NEXT:    [[REASS_ADD:%.*]] = add i32 [[Y:%.*]], [[X:%.*]]
9; CHECK-NEXT:    [[REASS_MUL:%.*]] = shl i32 [[REASS_ADD]], 1
10; CHECK-NEXT:    ret i32 [[REASS_MUL]]
11;
12  %t2 = shl i32 %X, 1
13  %t6 = shl i32 %Y, 1
14  %t4 = add i32 %t6, %t2
15  ret i32 %t4
16}
17
18