• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -nary-reassociate -S | FileCheck %s
2; RUN: opt < %s -passes='nary-reassociate' -S | FileCheck %s
3
4target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
5
6declare void @foo(i32)
7
8; CHECK-LABEL: @bar(
9define void @bar(i32 %a, i32 %b, i32 %c) {
10  %1 = mul i32 %a, %c
11; CHECK: [[BASE:%[a-zA-Z0-9]+]] = mul i32 %a, %c
12  call void @foo(i32 %1)
13  %2 = mul i32 %a, %b
14  %3 = mul i32 %2, %c
15; CHECK: [[RESULT:%[a-zA-Z0-9]+]] = mul i32 [[BASE]], %b
16  call void @foo(i32 %3)
17; CHECK-NEXT: call void @foo(i32 [[RESULT]])
18  ret void
19}
20
21