File: analysis-invalidation.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (67 lines) | stat: -rw-r--r-- 2,650 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
; RUN: opt -passes='require<demanded-bits>,constraint-elimination,require<demanded-bits>' -disable-verify -verify-analysis-invalidation=false -debug-pass-manager -disable-output %s 2>&1 | FileCheck %s

; Check that constraint-elimination properly invalidates anlyses.

; FIXME: ssub simplification currently doesn't properly set the change status
;        after modifying the IR, which causes DemandedBits to be preserved.

; CHECK:      Running pass: RequireAnalysisPass
; CHECK-NEXT: Running analysis: DemandedBitsAnalysis on ssub_no_overflow_due_to_or_conds
; CHECK-NEXT: Running analysis: AssumptionAnalysis on ssub_no_overflow_due_to_or_conds
; CHECK-NEXT: Running analysis: TargetIRAnalysis on ssub_no_overflow_due_to_or_conds
; CHECK-NEXT: Running analysis: DominatorTreeAnalysis on ssub_no_overflow_due_to_or_conds
; CHECK-NEXT: Running pass: ConstraintEliminationPass on ssub_no_overflow_due_to_or_conds
; CHECK-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis on ssub_no_overflow_due_to_or_conds
; CHECK-NEXT: Invalidating analysis: DemandedBitsAnalysis on ssub_no_overflow_due_to_or_conds
; CHECK-NEXT: Running pass: RequireAnalysisPass
; CHECK-NEXT: Running analysis: DemandedBitsAnalysis on ssub_no_overflow_due_to_or_conds

; CHECK-NEXT: Running pass: RequireAnalysisPass
; CHECK-NEXT: Running analysis: DemandedBitsAnalysis on uge_zext
; CHECK-NEXT: Running analysis: AssumptionAnalysis on uge_zext
; CHECK-NEXT: Running analysis: TargetIRAnalysis on uge_zext
; CHECK-NEXT: Running analysis: DominatorTreeAnalysis on uge_zext
; CHECK-NEXT: Running pass: ConstraintEliminationPass on uge_zext
; CHECK-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis on uge_zext
; CHECK-NEXT: Invalidating analysis: DemandedBitsAnalysis on uge_zext
; CHECK-NEXT: Running pass: RequireAnalysisPass
; CHECK-NEXT: Running analysis: DemandedBitsAnalysis on uge_zext

declare { i8, i1 } @llvm.ssub.with.overflow.i8(i8, i8)

define i8 @ssub_no_overflow_due_to_or_conds(i8 %a, i8 %b) {
entry:
  %c.1 = icmp sle i8 %b, %a
  %c.2 = icmp slt i8 %a, 0
  %or.cond = or i1 %c.2, %c.1
  br i1 %or.cond, label %exit.fail, label %math

math:
  %op = tail call { i8, i1 } @llvm.ssub.with.overflow.i8(i8 %b, i8 %a)
  %status = extractvalue { i8, i1 } %op, 1
  br i1 %status, label %exit.fail, label %exit.ok

exit.ok:
  %res = extractvalue { i8, i1 } %op, 0
  ret i8 %res

exit.fail:
  ret i8 0
}

declare void @use_res({ i8, i1 })


define i1 @uge_zext(i8 %x, i16 %y) {
entry:
  %x.ext = zext i8 %x to i16
  %c.1 = icmp uge i16 %x.ext, %y
  br i1 %c.1, label %bb1, label %bb2

bb1:
  %t.1 = icmp uge i16 %x.ext, %y
  ret i1 %t.1

bb2:
  ret i1 false
}