xref: /llvm-project/llvm/test/Transforms/IndVarSimplify/pr64891.ll (revision eecb99c5f66c8491766628a2925587e20f3b1dbd)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2; RUN: opt -S -passes=indvars < %s | FileCheck %s
3
4target datalayout = "n8:16:32:64"
5
6; Just make sure this doesn't crash.
7; SCEVExpander produces a degenerate phi node for the widened IV here,
8; where the "increment" instruction folds to a poison value.
9define i32 @main() {
10; CHECK-LABEL: define i32 @main() {
11; CHECK-NEXT:  entry:
12; CHECK-NEXT:    br label [[LOOP:%.*]]
13; CHECK:       loop:
14; CHECK-NEXT:    br label [[LOOP]]
15;
16entry:
17  %div = sdiv i32 1, 0
18  %trunc = trunc i32 %div to i16
19  br label %loop
20
21loop:
22  %phi = phi i16 [ 0, %entry ], [ %or, %loop ]
23  %or = or disjoint i16 %phi, %trunc
24  %phi.ext = sext i16 %phi to i64
25  %add.ptr = getelementptr i8, ptr null, i64 %phi.ext
26  br label %loop
27}
28