aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/nsw.ll
blob: afe6e35d96020baa5dca1fb9435dc81cc8f4831c (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 | llvm-dis | 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
}