File: demand_shrink_nsw.ll

package info (click to toggle)
llvm-toolchain-6.0 1:6.0-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 594,652 kB
  • sloc: cpp: 3,044,500; ansic: 595,051; asm: 271,890; python: 128,923; objc: 106,554; sh: 21,854; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,214; cs: 2,027; xml: 686; php: 212; csh: 117
file content (26 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
; RUN: opt -instcombine -o - -S %s | FileCheck %s

; The constant at %v35 should be shrunk, but this must lead to the nsw flag of
; %v43 getting removed so that %v44 is not illegally optimized away.
; CHECK-LABEL: @foo
; CHECK: %v35 = add nuw nsw i32 %v34, 1362915575
; ...
; CHECK: add nuw i32 %v42, 1533579450
; CHECK-NEXT: %v44 = or i32 %v43, -2147483648
; CHECK-NEXT: %v45 = xor i32 %v44, 749011377
; CHECK-NEXT: ret i32 %v45
define i32 @foo(i32 %arg) {
  %v33 = and i32 %arg, 223
  %v34 = xor i32 %v33, 29
  %v35 = add nuw i32 %v34, 3510399223
  %v37 = or i32 %v34, 1874836915
  %v38 = and i32 %v34, 221
  %v39 = xor i32 %v38, 1874836915
  %v40 = xor i32 %v37, %v39
  %v41 = shl nsw nuw i32 %v40, 1
  %v42 = sub i32 %v35, %v41
  %v43 = add nsw i32 %v42, 1533579450
  %v44 = or i32 %v43, -2147483648
  %v45 = xor i32 %v44, 749011377
  ret i32 %v45
}