• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -reassociate -S < %s | FileCheck %s
3
4declare void @use(i32)
5
6define void @test1(i32 %x, i32 %y) {
7; CHECK-LABEL: @test1(
8; CHECK-NEXT:    [[TMP1:%.*]] = mul i32 [[Y:%.*]], [[X:%.*]]
9; CHECK-NEXT:    [[TMP2:%.*]] = mul i32 [[Y]], [[X]]
10; CHECK-NEXT:    [[TMP3:%.*]] = sub i32 [[TMP1]], [[TMP2]]
11; CHECK-NEXT:    call void @use(i32 [[TMP1]])
12; CHECK-NEXT:    call void @use(i32 [[TMP3]])
13; CHECK-NEXT:    ret void
14;
15
16  %1 = mul i32 %x, %y
17  %2 = mul i32 %y, %x
18  %3 = sub i32 %1, %2
19  call void @use(i32 %1)
20  call void @use(i32 %3)
21  ret void
22}
23