Skip to content

Commit 629bff8

Browse files
committed
Precommit test for pr77798
Test shows assertion failure through SCEV's usage of multiplicative inverse.
1 parent f46f646 commit 629bff8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
; RUN: opt -S -passes='indvars' -verify-scev < %s | FileCheck %s
2+
3+
; REQUIRES: asserts
4+
; XFAIL: *
5+
6+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
7+
target triple = "x86_64-unknown-linux-gnu"
8+
9+
; We should not crash on multiplicative inverse called within SCEV's binomial
10+
; coefficient function.
11+
define i32 @pr87798() {
12+
; CHECK-LABEL: pr87798
13+
bb:
14+
br label %bb1
15+
16+
bb1: ; preds = %bb1, %bb
17+
%phi = phi i32 [ 0, %bb ], [ %add4, %bb1 ]
18+
%phi2 = phi i32 [ 0, %bb ], [ %add, %bb1 ]
19+
%phi3 = phi i32 [ 0, %bb ], [ %add5, %bb1 ]
20+
%add = add i32 %phi2, %phi3
21+
%mul = mul i32 %phi2, %phi3
22+
%add4 = add i32 %mul, %phi
23+
%and = and i32 %phi, 1
24+
%add5 = add i32 %phi3, 1
25+
br i1 true, label %preheader, label %bb1
26+
27+
preheader: ; preds = %bb1
28+
%phi9 = phi i32 [ %and, %bb1 ]
29+
br label %loop
30+
31+
loop: ; preds = %preheader, %loop
32+
br label %loop
33+
34+
bb7: ; No predecessors!
35+
%zext = zext i32 %phi9 to i64
36+
ret i32 0
37+
}

0 commit comments

Comments
 (0)