1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -licm %s | FileCheck %s --check-prefix=NO_ASSUME
3 ; RUN: opt -S -licm --enable-knowledge-retention %s | FileCheck %s --check-prefix=USE_ASSUME
4 ; ModuleID = '../pr23608.ll'
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 %struct.PyFrameObject = type { i32 }
10 @a = common global %struct.PyFrameObject* null, align 8
11 @__msan_origin_tls = external thread_local(initialexec) global i32
14 ; NO_ASSUME-LABEL: @fn1(
15 ; NO_ASSUME-NEXT: entry:
16 ; NO_ASSUME-NEXT: br label [[INDIRECTGOTO:%.*]]
17 ; NO_ASSUME: while.cond:
18 ; NO_ASSUME-NEXT: [[TMP:%.*]] = load %struct.PyFrameObject*, %struct.PyFrameObject** @a, align 8
19 ; NO_ASSUME-NEXT: [[F_IBLOCK:%.*]] = getelementptr inbounds [[STRUCT_PYFRAMEOBJECT:%.*]], %struct.PyFrameObject* [[TMP]], i64 0, i32 0
20 ; NO_ASSUME-NEXT: br label [[BB2:%.*]]
22 ; NO_ASSUME-NEXT: call void @__msan_warning_noreturn()
23 ; NO_ASSUME-NEXT: unreachable
25 ; NO_ASSUME-NEXT: [[TMP4:%.*]] = ptrtoint i32* [[F_IBLOCK]] to i64
26 ; NO_ASSUME-NEXT: [[TOBOOL:%.*]] = icmp eq i64 [[TMP4]], 0
27 ; NO_ASSUME-NEXT: br i1 [[TOBOOL]], label [[BB13:%.*]], label [[BB15:%.*]]
29 ; NO_ASSUME-NEXT: [[F_IBLOCK_LCSSA:%.*]] = phi i32* [ [[F_IBLOCK]], [[BB2]] ]
30 ; NO_ASSUME-NEXT: [[TMP4_LE:%.*]] = ptrtoint i32* [[F_IBLOCK_LCSSA]] to i64
31 ; NO_ASSUME-NEXT: [[TMP8_LE:%.*]] = inttoptr i64 [[TMP4_LE]] to i32*
32 ; NO_ASSUME-NEXT: call void @__msan_warning_noreturn()
33 ; NO_ASSUME-NEXT: unreachable
35 ; NO_ASSUME-NEXT: br i1 [[TOBOOL]], label [[WHILE_END:%.*]], label [[WHILE_COND:%.*]]
36 ; NO_ASSUME: while.end:
37 ; NO_ASSUME-NEXT: ret void
38 ; NO_ASSUME: indirectgoto:
39 ; NO_ASSUME-NEXT: indirectbr i8* null, [label [[INDIRECTGOTO]], label %while.cond]
41 ; USE_ASSUME-LABEL: @fn1(
42 ; USE_ASSUME-NEXT: entry:
43 ; USE_ASSUME-NEXT: br label [[INDIRECTGOTO:%.*]]
44 ; USE_ASSUME: while.cond:
45 ; USE_ASSUME-NEXT: [[TMP:%.*]] = load %struct.PyFrameObject*, %struct.PyFrameObject** @a, align 8
46 ; USE_ASSUME-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(i64* inttoptr (i64 and (i64 ptrtoint (%struct.PyFrameObject** @a to i64), i64 -70368744177665) to i64*), i64 8), "nonnull"(i64* inttoptr (i64 and (i64 ptrtoint (%struct.PyFrameObject** @a to i64), i64 -70368744177665) to i64*)), "align"(i64* inttoptr (i64 and (i64 ptrtoint (%struct.PyFrameObject** @a to i64), i64 -70368744177665) to i64*), i64 8) ]
47 ; USE_ASSUME-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(i32* inttoptr (i64 add (i64 and (i64 ptrtoint (%struct.PyFrameObject** @a to i64), i64 -70368744177665), i64 35184372088832) to i32*), i64 4), "nonnull"(i32* inttoptr (i64 add (i64 and (i64 ptrtoint (%struct.PyFrameObject** @a to i64), i64 -70368744177665), i64 35184372088832) to i32*)), "align"(i32* inttoptr (i64 add (i64 and (i64 ptrtoint (%struct.PyFrameObject** @a to i64), i64 -70368744177665), i64 35184372088832) to i32*), i64 8) ]
48 ; USE_ASSUME-NEXT: [[F_IBLOCK:%.*]] = getelementptr inbounds [[STRUCT_PYFRAMEOBJECT:%.*]], %struct.PyFrameObject* [[TMP]], i64 0, i32 0
49 ; USE_ASSUME-NEXT: br label [[BB2:%.*]]
51 ; USE_ASSUME-NEXT: call void @__msan_warning_noreturn()
52 ; USE_ASSUME-NEXT: unreachable
54 ; USE_ASSUME-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(%struct.PyFrameObject* [[TMP]], i64 4), "nonnull"(%struct.PyFrameObject* [[TMP]]), "align"(%struct.PyFrameObject* [[TMP]], i64 4) ]
55 ; USE_ASSUME-NEXT: [[TMP4:%.*]] = ptrtoint i32* [[F_IBLOCK]] to i64
56 ; USE_ASSUME-NEXT: [[TOBOOL:%.*]] = icmp eq i64 [[TMP4]], 0
57 ; USE_ASSUME-NEXT: br i1 [[TOBOOL]], label [[BB13:%.*]], label [[BB15:%.*]]
59 ; USE_ASSUME-NEXT: [[F_IBLOCK_LCSSA:%.*]] = phi i32* [ [[F_IBLOCK]], [[BB2]] ]
60 ; USE_ASSUME-NEXT: [[TMP4_LE:%.*]] = ptrtoint i32* [[F_IBLOCK_LCSSA]] to i64
61 ; USE_ASSUME-NEXT: [[TMP8_LE:%.*]] = inttoptr i64 [[TMP4_LE]] to i32*
62 ; USE_ASSUME-NEXT: call void @__msan_warning_noreturn()
63 ; USE_ASSUME-NEXT: unreachable
65 ; USE_ASSUME-NEXT: br i1 [[TOBOOL]], label [[WHILE_END:%.*]], label [[WHILE_COND:%.*]]
66 ; USE_ASSUME: while.end:
67 ; USE_ASSUME-NEXT: ret void
68 ; USE_ASSUME: indirectgoto:
69 ; USE_ASSUME-NEXT: indirectbr i8* null, [label [[INDIRECTGOTO]], label %while.cond]
72 br label %indirectgoto
74 while.cond: ; preds = %indirectgoto, %bb15
75 %tmp = load %struct.PyFrameObject*, %struct.PyFrameObject** @a, align 8
76 %_msld = load i64, i64* inttoptr (i64 and (i64 ptrtoint (%struct.PyFrameObject** @a to i64), i64 -70368744177665) to i64*), align 8
77 %tmp1 = load i32, i32* inttoptr (i64 add (i64 and (i64 ptrtoint (%struct.PyFrameObject** @a to i64), i64 -70368744177665), i64 35184372088832) to i32*), align 8
78 %f_iblock = getelementptr inbounds %struct.PyFrameObject, %struct.PyFrameObject* %tmp, i64 0, i32 0
81 bb: ; preds = %while.cond
82 call void @__msan_warning_noreturn()
85 bb2: ; preds = %while.cond
86 %tmp3 = load i32, i32* %f_iblock, align 4
87 %tmp4 = ptrtoint i32* %f_iblock to i64
88 %tmp8 = inttoptr i64 %tmp4 to i32*
89 %tobool = icmp eq i64 %tmp4, 0
90 br i1 %tobool, label %bb13, label %bb15
93 %.lcssa7 = phi i32* [ %tmp8, %bb2 ]
94 call void @__msan_warning_noreturn()
98 br i1 %tobool, label %while.end, label %while.cond
100 while.end: ; preds = %bb15
103 indirectgoto: ; preds = %indirectgoto, %entry
104 indirectbr i8* null, [label %indirectgoto, label %while.cond]
107 declare void @__msan_warning_noreturn()