2019-08-02 07:30:32 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
2019-04-17 12:52:47 +08:00
|
|
|
; RUN: opt -reassociate -S < %s | FileCheck %s
|
|
|
|
|
|
|
|
declare void @use(i32)
|
|
|
|
|
|
|
|
define void @test1(i32 %x, i32 %y) {
|
2019-08-02 07:30:32 +08:00
|
|
|
; CHECK-LABEL: @test1(
|
|
|
|
; CHECK-NEXT: [[TMP1:%.*]] = mul i32 [[Y:%.*]], [[X:%.*]]
|
|
|
|
; CHECK-NEXT: [[TMP2:%.*]] = mul i32 [[Y]], [[X]]
|
|
|
|
; CHECK-NEXT: [[TMP3:%.*]] = sub i32 [[TMP1]], [[TMP2]]
|
|
|
|
; CHECK-NEXT: call void @use(i32 [[TMP1]])
|
|
|
|
; CHECK-NEXT: call void @use(i32 [[TMP3]])
|
|
|
|
; CHECK-NEXT: ret void
|
|
|
|
;
|
2019-04-17 12:52:47 +08:00
|
|
|
|
|
|
|
%1 = mul i32 %x, %y
|
|
|
|
%2 = mul i32 %y, %x
|
|
|
|
%3 = sub i32 %1, %2
|
|
|
|
call void @use(i32 %1)
|
|
|
|
call void @use(i32 %3)
|
|
|
|
ret void
|
|
|
|
}
|