1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=indvars -S | FileCheck %s
4 declare void @foo(i16 noundef)
6 ; Function Attrs: mustprogress noreturn uwtable
7 define void @bar(i64 noundef %ptr) {
10 ; CHECK-NEXT: [[TMP0:%.*]] = trunc i64 [[PTR:%.*]] to i4
11 ; CHECK-NEXT: [[TMP1:%.*]] = zext i4 [[TMP0]] to i16
12 ; CHECK-NEXT: br label [[WHILE_BODY:%.*]]
14 ; CHECK-NEXT: tail call void @foo(i16 noundef signext [[TMP1]])
15 ; CHECK-NEXT: br label [[WHILE_BODY]]
20 while.body: ; preds = %entry, %while.body
21 %0 = phi i64 [ %ptr, %entry ], [ %add.ptr, %while.body ]
22 %1 = trunc i64 %0 to i16
23 %and = and i16 %1, 15 ; loop invariant
24 tail call void @foo(i16 noundef signext %and)
25 %add.ptr = add nsw i64 %0, 16