File: demand_shrink_nsw.ll

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (33 lines) | stat: -rw-r--r-- 1,179 bytes parent folder | download | duplicates (10)
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
27
28
29
30
31
32
33
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; 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.

define i32 @foo(i32 %arg) {
; CHECK-LABEL: @foo(
; CHECK-NEXT:    [[V33:%.*]] = and i32 [[ARG:%.*]], 223
; CHECK-NEXT:    [[V34:%.*]] = xor i32 [[V33]], 29
; CHECK-NEXT:    [[V35:%.*]] = add nuw nsw i32 [[V34]], 1362915575
; CHECK-NEXT:    [[V40:%.*]] = shl nuw nsw i32 [[V34]], 1
; CHECK-NEXT:    [[V41:%.*]] = and i32 [[V40]], 290
; CHECK-NEXT:    [[V42:%.*]] = sub nuw nsw i32 [[V35]], [[V41]]
; CHECK-NEXT:    [[V43:%.*]] = add nuw i32 [[V42]], 1533579450
; CHECK-NEXT:    [[V45:%.*]] = xor i32 [[V43]], 749011377
; CHECK-NEXT:    ret i32 [[V45]]
;
  %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
}