Home | History | Annotate | Download | only in Reassociate
      1 ; RUN: opt -S -reassociate < %s | FileCheck %s
      2 ; rdar://8944681
      3 
      4 ; Reassociate should clear optional flags like nsw when reassociating.
      5 
      6 ; CHECK-LABEL: @test0(
      7 ; CHECK: %y = add i64 %b, %a
      8 ; CHECK: %z = add i64 %y, %c
      9 define i64 @test0(i64 %a, i64 %b, i64 %c) {
     10   %y = add nsw i64 %c, %b
     11   %z = add i64 %y, %a
     12   ret i64 %z
     13 }
     14 
     15 ; CHECK-LABEL: @test1(
     16 ; CHECK: %y = add i64 %b, %a
     17 ; CHECK: %z = add i64 %y, %c
     18 define i64 @test1(i64 %a, i64 %b, i64 %c) {
     19   %y = add i64 %c, %b
     20   %z = add nsw i64 %y, %a
     21   ret i64 %z
     22 }
     23 
     24 ; PR9215
     25 ; CHECK: %s = add nsw i32 %y, %x
     26 define i32 @test2(i32 %x, i32 %y) {
     27   %s = add nsw i32 %x, %y
     28   ret i32 %s
     29 }
     30