commute.ll 406 B

12345678910111213141516171819
  1. ; RUN: opt -reassociate -S < %s | FileCheck %s
  2. declare void @use(i32)
  3. define void @test1(i32 %x, i32 %y) {
  4. ; CHECK-LABEL: test1
  5. ; CHECK: mul i32 %y, %x
  6. ; CHECK: mul i32 %y, %x
  7. ; CHECK: sub i32 %1, %2
  8. ; CHECK: call void @use(i32 %{{.*}})
  9. ; CHECK: call void @use(i32 %{{.*}})
  10. %1 = mul i32 %x, %y
  11. %2 = mul i32 %y, %x
  12. %3 = sub i32 %1, %2
  13. call void @use(i32 %1)
  14. call void @use(i32 %3)
  15. ret void
  16. }