aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/nsw.ll
blob: 821cebed30bba047068dc80115a464a96e3be613 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
; RUN: opt < %s -instcombine -S | FileCheck %s

; CHECK: define i32 @foo
; %y = sub i32 0, %x
; %z = sdiv i32 %y, 337
; ret i32 %y
define i32 @foo(i32 %x) {
  %y = sub i32 0, %x
  %z = sdiv i32 %y, 337
  ret i32 %y
}

; CHECK: define i32 @bar
; %y = sdiv i32 %x, -337
; ret i32 %y
define i32 @bar(i32 %x) {
  %y = sub nsw i32 0, %x
  %z = sdiv i32 %y, 337
  ret i32 %y
}