xref: /llvm-project/llvm/test/Transforms/Reassociate/negation1.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; Test that we can turn things like A*B + X - A*B -> X.
5
6define i32 @test1(i32 %a, i32 %b, i32 %x) {
7; CHECK-LABEL: @test1(
8; CHECK-NEXT:    ret i32 [[X:%.*]]
9;
10  %c = mul i32 %a, %b
11  %d = add i32 %c, %x
12  %c1 = mul i32 %a, %b
13  %f = sub i32 %d, %c1
14  ret i32 %f
15}
16
17