Skip to content

Commit 23d591e

Browse files
committed
[NFC][LSR] Add test case that from https://reviews.llvm.org/D98147#2623549
With that patch, this test fails with an assertion ``` opt: /repositories/llvm-project/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5169: BasicBlock::iterator (anonymous namespace)::LSRInstance::AdjustInsertPositionForExpand(BasicBlock::iterator, const (anonymous namespace)::LSRFixup &, const (anonymous namespace)::LSRUse &, llvm::SCEVExpander &) const: Assertion `!isa<PHINode>(LowestIP) && !LowestIP->isEHPad() && !isa<DbgInfoIntrinsic>(LowestIP) && "Insertion point must be a normal instruction"' failed. ```
1 parent 2468fdd commit 23d591e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -S -loop-reduce < %s | FileCheck %s
3+
4+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5+
target triple = "x86_64-unknown-linux-gnu"
6+
7+
declare void @maybe_throws()
8+
declare void @use1(i1)
9+
10+
define void @is_not_null(i8* %baseptr) local_unnamed_addr align 2 personality i8* undef {
11+
; CHECK-LABEL: @is_not_null(
12+
; CHECK-NEXT: preheader:
13+
; CHECK-NEXT: br label [[HEADER:%.*]]
14+
; CHECK: header:
15+
; CHECK-NEXT: [[PTR:%.*]] = phi i8* [ [[INCPTR:%.*]], [[LATCH:%.*]] ], [ [[BASEPTR:%.*]], [[PREHEADER:%.*]] ]
16+
; CHECK-NEXT: invoke void @maybe_throws()
17+
; CHECK-NEXT: to label [[LATCH]] unwind label [[LPAD:%.*]]
18+
; CHECK: lpad:
19+
; CHECK-NEXT: [[TMP0:%.*]] = landingpad { i8*, i32 }
20+
; CHECK-NEXT: catch i8* null
21+
; CHECK-NEXT: [[PTR_IS_NOT_NULL:%.*]] = icmp ne i8* [[PTR]], null
22+
; CHECK-NEXT: call void @use1(i1 [[PTR_IS_NOT_NULL]])
23+
; CHECK-NEXT: ret void
24+
; CHECK: latch:
25+
; CHECK-NEXT: [[INCPTR]] = getelementptr inbounds i8, i8* [[PTR]], i64 1
26+
; CHECK-NEXT: br label [[HEADER]]
27+
;
28+
preheader:
29+
br label %header
30+
31+
header:
32+
%ptr = phi i8* [ %incptr, %latch ], [ %baseptr, %preheader ]
33+
invoke void @maybe_throws() to label %latch unwind label %lpad
34+
35+
lpad:
36+
landingpad { i8*, i32 } catch i8* null
37+
%ptr_is_not_null = icmp ne i8* %ptr, null
38+
call void @use1(i1 %ptr_is_not_null)
39+
ret void
40+
41+
latch:
42+
%incptr = getelementptr inbounds i8, i8* %ptr, i64 1
43+
br label %header
44+
}

0 commit comments

Comments
 (0)