1 ; RUN: opt -S -reassociate -dce < %s | FileCheck %s
4 ; Reassociate should clear optional flags like nsw when reassociating.
7 ; CHECK: %z = add i64 %b, 2
8 define i64 @test0(i64 %a, i64 %b) {
10 %y = add nsw i64 %x, %b
11 %z = sub nsw i64 %y, %a
15 ; CHECK-LABEL: @test1(
16 ; CHECK: %y = mul i64 %a, 6
17 ; CHECK: %z = sub nsw i64 %y, %a
18 define i64 @test1(i64 %a, i64 %b) {
19 %x = add nsw i64 %a, %a
20 %y = mul nsw i64 %x, 3
21 %z = sub nsw i64 %y, %a
26 ; CHECK: %s = add nsw i32 %x, %y
27 define i32 @test2(i32 %x, i32 %y) {
28 %s = add nsw i32 %x, %y