[llvm] SimplifyIndVar: teach widenLoopCompare about samesign (PR #125764)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 5 00:10:43 PST 2025
https://github.com/artagnon updated https://github.com/llvm/llvm-project/pull/125764
>From f999897b688ddf6a654e2330e9d5a71259c07056 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Tue, 4 Feb 2025 10:10:13 +0000
Subject: [PATCH 1/2] IndVarSimplify: pre-commit samesign tests
---
.../IndVarSimplify/iv-ext-samesign.ll | 721 ++++++++++++++++++
.../iv-zext-samesign-datalayout.ll | 62 --
2 files changed, 721 insertions(+), 62 deletions(-)
create mode 100644 llvm/test/Transforms/IndVarSimplify/iv-ext-samesign.ll
delete mode 100644 llvm/test/Transforms/IndVarSimplify/iv-zext-samesign-datalayout.ll
diff --git a/llvm/test/Transforms/IndVarSimplify/iv-ext-samesign.ll b/llvm/test/Transforms/IndVarSimplify/iv-ext-samesign.ll
new file mode 100644
index 00000000000000..48a48477397126
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/iv-ext-samesign.ll
@@ -0,0 +1,721 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt < %s -passes=indvars -S | FileCheck %s
+
+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"
+
+define i32 @iv_zext_zext_sgt_slt(i32 %iter.count, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_zext_zext_sgt_slt(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = add nsw i32 [[ITER_COUNT]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: [[INDVARS_IV_NEXT2:%.*]] = add i32 [[INDVARS_IV1:%.*]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV1]] = phi i32 [ [[INDVARS_IV_NEXT2]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[IV_OUTER:%.*]] = phi i32 [ [[IV_OUTER_1:%.*]], %[[PH]] ], [ [[ITER_COUNT]], %[[ENTRY]] ]
+; CHECK-NEXT: [[IV_OUTER_1]] = add nsw i32 [[IV_OUTER]], -1
+; CHECK-NEXT: [[EXT_OUTER:%.*]] = zext nneg i32 [[IV_OUTER_1]] to i64
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[EXT_OUTER]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp sgt i32 [[IV_OUTER]], 1
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[INDVARS_IV1]] to i64
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = zext nneg i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp sgt i32 %iv.outer, 1
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = zext nneg i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp slt i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_zext_zext_gt_slt(i32 %iter.count, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_zext_zext_gt_slt(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV1:%.*]] = phi i64 [ [[INDVARS_IV_NEXT2:%.*]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], 1
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp slt i64 [[INDVARS_IV_NEXT]], [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: br i1 [[EXIT_COND_INNER]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = zext nneg i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp samesign ugt i32 %iv.outer, 1
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = zext nneg i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp slt i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_zext_zext_gt_slt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_zext_zext_gt_slt_exitlimit(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], i32 [[EXIT_LIMIT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV1:%.*]] = phi i64 [ [[INDVARS_IV_NEXT2:%.*]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], [[EXIT_LIMIT]]
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp slt i64 [[INDVARS_IV_NEXT]], [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: br i1 [[EXIT_COND_INNER]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = zext nneg i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp samesign ugt i32 %iv.outer, %exit.limit
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = zext nneg i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp slt i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_zext_zext_sgt_lt(i32 %iter.count, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_zext_zext_sgt_lt(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = add nsw i32 [[ITER_COUNT]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: [[INDVARS_IV_NEXT2:%.*]] = add i32 [[INDVARS_IV1:%.*]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV1]] = phi i32 [ [[INDVARS_IV_NEXT2]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[IV_OUTER:%.*]] = phi i32 [ [[IV_OUTER_1:%.*]], %[[PH]] ], [ [[ITER_COUNT]], %[[ENTRY]] ]
+; CHECK-NEXT: [[IV_OUTER_1]] = add nsw i32 [[IV_OUTER]], -1
+; CHECK-NEXT: [[EXT_OUTER:%.*]] = zext nneg i32 [[IV_OUTER_1]] to i64
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[EXT_OUTER]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp sgt i32 [[IV_OUTER]], 1
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[INDVARS_IV1]] to i64
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = zext nneg i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp sgt i32 %iv.outer, 1
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = zext nneg i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp samesign ult i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_zext_zext_sgt_lt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_zext_zext_sgt_lt_exitlimit(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], i32 [[EXIT_LIMIT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[IV_OUTER:%.*]] = phi i32 [ [[IV_OUTER_1:%.*]], %[[PH]] ], [ [[ITER_COUNT]], %[[ENTRY]] ]
+; CHECK-NEXT: [[IV_OUTER_1]] = add nsw i32 [[IV_OUTER]], -1
+; CHECK-NEXT: [[EXT_OUTER:%.*]] = zext nneg i32 [[IV_OUTER_1]] to i64
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[EXT_OUTER]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp sgt i32 [[IV_OUTER]], [[EXIT_LIMIT]]
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[IV_OUTER_1]] to i64
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp samesign ult i64 [[INDVARS_IV_NEXT]], [[TMP1]]
+; CHECK-NEXT: br i1 [[EXIT_COND_INNER]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = zext nneg i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp sgt i32 %iv.outer, %exit.limit
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = zext nneg i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp samesign ult i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_zext_zext_gt_lt(i32 %iter.count, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_zext_zext_gt_lt(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = add nsw i32 [[ITER_COUNT]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: [[INDVARS_IV_NEXT2:%.*]] = add i32 [[INDVARS_IV1:%.*]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV1]] = phi i32 [ [[INDVARS_IV_NEXT2]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[IV_OUTER:%.*]] = phi i32 [ [[IV_OUTER_1:%.*]], %[[PH]] ], [ [[ITER_COUNT]], %[[ENTRY]] ]
+; CHECK-NEXT: [[IV_OUTER_1]] = add nsw i32 [[IV_OUTER]], -1
+; CHECK-NEXT: [[EXT_OUTER:%.*]] = zext nneg i32 [[IV_OUTER_1]] to i64
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[EXT_OUTER]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[IV_OUTER]], 1
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[INDVARS_IV1]] to i64
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = zext nneg i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp samesign ugt i32 %iv.outer, 1
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = zext nneg i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp samesign ult i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_sext_sext_sgt_slt(i32 %iter.count, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_sext_sext_sgt_slt(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = add nsw i32 [[ITER_COUNT]], -1
+; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: [[INDVARS_IV_NEXT2:%.*]] = add i32 [[INDVARS_IV1:%.*]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV3:%.*]] = phi i64 [ [[INDVARS_IV_NEXT4:%.*]], %[[PH]] ], [ [[TMP1]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV1]] = phi i32 [ [[INDVARS_IV_NEXT2]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT4]] = add nsw i64 [[INDVARS_IV3]], -1
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT4]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp sgt i64 [[INDVARS_IV3]], 1
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[INDVARS_IV1]] to i64
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = sext i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp sgt i32 %iv.outer, 1
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = sext i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp slt i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_sext_sext_gt_slt(i32 %iter.count, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_sext_sext_gt_slt(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV1:%.*]] = phi i64 [ [[INDVARS_IV_NEXT2:%.*]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], 1
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp slt i64 [[INDVARS_IV_NEXT]], [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: br i1 [[EXIT_COND_INNER]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = sext i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp samesign ugt i32 %iv.outer, 1
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = sext i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp slt i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_sext_sext_gt_slt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_sext_sext_gt_slt_exitlimit(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], i32 [[EXIT_LIMIT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV1:%.*]] = phi i64 [ [[INDVARS_IV_NEXT2:%.*]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], [[EXIT_LIMIT]]
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp slt i64 [[INDVARS_IV_NEXT]], [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: br i1 [[EXIT_COND_INNER]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = sext i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp samesign ugt i32 %iv.outer, %exit.limit
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = sext i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp slt i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_sext_sext_sgt_lt(i32 %iter.count, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_sext_sext_sgt_lt(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = add nsw i32 [[ITER_COUNT]], -1
+; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: [[INDVARS_IV_NEXT2:%.*]] = add i32 [[INDVARS_IV1:%.*]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV3:%.*]] = phi i64 [ [[INDVARS_IV_NEXT4:%.*]], %[[PH]] ], [ [[TMP1]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV1]] = phi i32 [ [[INDVARS_IV_NEXT2]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT4]] = add nsw i64 [[INDVARS_IV3]], -1
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT4]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp sgt i64 [[INDVARS_IV3]], 1
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[INDVARS_IV1]] to i64
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = sext i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp sgt i32 %iv.outer, 1
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = sext i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp samesign ult i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_sext_sext_sgt_lt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_sext_sext_sgt_lt_exitlimit(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], i32 [[EXIT_LIMIT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: [[TMP4:%.*]] = sext i32 [[EXIT_LIMIT]] to i64
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV1:%.*]] = phi i64 [ [[INDVARS_IV_NEXT2:%.*]], %[[PH]] ], [ [[TMP1]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp sgt i64 [[INDVARS_IV1]], [[TMP4]]
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: [[TMP2:%.*]] = trunc nsw i64 [[INDVARS_IV_NEXT2]] to i32
+; CHECK-NEXT: [[TMP3:%.*]] = zext i32 [[TMP2]] to i64
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp samesign ult i64 [[INDVARS_IV_NEXT]], [[TMP3]]
+; CHECK-NEXT: br i1 [[EXIT_COND_INNER]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = sext i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp sgt i32 %iv.outer, %exit.limit
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = sext i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp samesign ult i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
+
+define i32 @iv_sext_sext_gt_lt(i32 %iter.count, ptr %ptr) {
+; CHECK-LABEL: define i32 @iv_sext_sext_gt_lt(
+; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: [[TMP0:%.*]] = add nsw i32 [[ITER_COUNT]], -1
+; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
+; CHECK: [[PH_LOOPEXIT:.*]]:
+; CHECK-NEXT: br label %[[PH:.*]]
+; CHECK: [[PH]]:
+; CHECK-NEXT: [[INDVARS_IV_NEXT2:%.*]] = add i32 [[INDVARS_IV1:%.*]], -1
+; CHECK-NEXT: br label %[[OUTER_LOOP]]
+; CHECK: [[OUTER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV3:%.*]] = phi i64 [ [[INDVARS_IV_NEXT4:%.*]], %[[PH]] ], [ [[TMP1]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV1]] = phi i32 [ [[INDVARS_IV_NEXT2]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
+; CHECK-NEXT: [[INDVARS_IV_NEXT4]] = add nsw i64 [[INDVARS_IV3]], -1
+; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT4]]
+; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
+; CHECK-NEXT: [[TMP2:%.*]] = trunc nsw i64 [[INDVARS_IV3]] to i32
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP2]], 1
+; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
+; CHECK: [[INNER_LOOP_PREHEADER]]:
+; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[INDVARS_IV1]] to i64
+; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
+; CHECK: [[INNER_LOOP]]:
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
+; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
+; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]
+; CHECK-NEXT: br i1 [[EXITCOND]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
+; CHECK: [[EXIT:.*:]]
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ br label %outer.loop
+
+ph:
+ br label %outer.loop
+
+outer.loop:
+ %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
+ %iv.outer.1 = add nsw i32 %iv.outer, -1
+ %ext.outer = sext i32 %iv.outer.1 to i64
+ %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
+ store double poison, ptr %gep.outer
+ %exit.cond.outer = icmp samesign ugt i32 %iv.outer, 1
+ br i1 %exit.cond.outer, label %inner.loop, label %ph
+
+inner.loop:
+ %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
+ %ext.inner = sext i32 %iv.inner to i64
+ %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
+ store double poison, ptr %gep.inner
+ %iv.next = add nuw nsw i32 %iv.inner, 1
+ %exit.cond.inner = icmp samesign ult i32 %iv.next, %iv.outer.1
+ br i1 %exit.cond.inner, label %inner.loop, label %ph
+
+exit:
+ ret i32 0
+}
diff --git a/llvm/test/Transforms/IndVarSimplify/iv-zext-samesign-datalayout.ll b/llvm/test/Transforms/IndVarSimplify/iv-zext-samesign-datalayout.ll
deleted file mode 100644
index 94dd4d18324e1e..00000000000000
--- a/llvm/test/Transforms/IndVarSimplify/iv-zext-samesign-datalayout.ll
+++ /dev/null
@@ -1,62 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
-; RUN: opt < %s -passes=indvars -S | FileCheck %s
-
-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"
-
-define i32 @iv_zext_samesign(i32 %iter.count, ptr %ptr) {
-; CHECK-LABEL: define i32 @iv_zext_samesign(
-; CHECK-SAME: i32 [[ITER_COUNT:%.*]], ptr [[PTR:%.*]]) {
-; CHECK-NEXT: [[ENTRY:.*]]:
-; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[ITER_COUNT]] to i64
-; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
-; CHECK: [[PH_LOOPEXIT:.*]]:
-; CHECK-NEXT: br label %[[PH:.*]]
-; CHECK: [[PH]]:
-; CHECK-NEXT: br label %[[OUTER_LOOP]]
-; CHECK: [[OUTER_LOOP]]:
-; CHECK-NEXT: [[INDVARS_IV1:%.*]] = phi i64 [ [[INDVARS_IV_NEXT2:%.*]], %[[PH]] ], [ [[TMP0]], %[[ENTRY]] ]
-; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
-; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
-; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
-; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
-; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], 1
-; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
-; CHECK: [[INNER_LOOP_PREHEADER]]:
-; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
-; CHECK: [[INNER_LOOP]]:
-; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
-; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
-; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
-; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
-; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp slt i64 [[INDVARS_IV_NEXT]], [[INDVARS_IV_NEXT2]]
-; CHECK-NEXT: br i1 [[EXIT_COND_INNER]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
-; CHECK: [[EXIT:.*:]]
-; CHECK-NEXT: ret i32 0
-;
-entry:
- br label %outer.loop
-
-ph:
- br label %outer.loop
-
-outer.loop:
- %iv.outer = phi i32 [ %iv.outer.1, %ph ], [ %iter.count, %entry ]
- %iv.outer.1 = add nsw i32 %iv.outer, -1
- %ext.outer = zext nneg i32 %iv.outer.1 to i64
- %gep.outer = getelementptr double, ptr %ptr, i64 %ext.outer
- store double poison, ptr %gep.outer
- %exit.cond.outer = icmp samesign ugt i32 %iv.outer, 1
- br i1 %exit.cond.outer, label %inner.loop, label %ph
-
-inner.loop:
- %iv.inner = phi i32 [ %iv.next, %inner.loop ], [ 0, %outer.loop ]
- %ext.inner = zext nneg i32 %iv.inner to i64
- %gep.inner = getelementptr double, ptr %ptr, i64 %ext.inner
- store double poison, ptr %gep.inner
- %iv.next = add nuw nsw i32 %iv.inner, 1
- %exit.cond.inner = icmp slt i32 %iv.next, %iv.outer.1
- br i1 %exit.cond.inner, label %inner.loop, label %ph
-
-exit:
- ret i32 0
-}
>From a6e387e69d22b6fda8d0853b9466fc192e96eff2 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Tue, 4 Feb 2025 15:24:33 +0000
Subject: [PATCH 2/2] SimplifyIndVar: teach widenLoopCompare about samesign
There is still some way to go to optimize optimally with samesign.
---
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 5 +++--
.../IndVarSimplify/iv-ext-samesign.ll | 21 +++++++------------
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index e41a1adadfcc5b..7b9c5c77cbe986 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -1614,7 +1614,8 @@ bool WidenIV::widenLoopCompare(WidenIV::NarrowIVDefUse DU) {
// (A) == icmp slt i32 sext(%narrow), sext(%val)
// == icmp slt i32 zext(%narrow), sext(%val)
bool IsSigned = getExtendKind(DU.NarrowDef) == ExtendKind::Sign;
- if (!(DU.NeverNegative || IsSigned == Cmp->isSigned()))
+ bool CmpPreferredSign = Cmp->hasSameSign() ? IsSigned : Cmp->isSigned();
+ if (!DU.NeverNegative && IsSigned != CmpPreferredSign)
return false;
Value *Op = Cmp->getOperand(Cmp->getOperand(0) == DU.NarrowDef ? 1 : 0);
@@ -1627,7 +1628,7 @@ bool WidenIV::widenLoopCompare(WidenIV::NarrowIVDefUse DU) {
// Widen the other operand of the compare, if necessary.
if (CastWidth < IVWidth) {
- Value *ExtOp = createExtendInst(Op, WideType, Cmp->isSigned(), Cmp);
+ Value *ExtOp = createExtendInst(Op, WideType, CmpPreferredSign, Cmp);
DU.NarrowUse->replaceUsesOfWith(Op, ExtOp);
}
return true;
diff --git a/llvm/test/Transforms/IndVarSimplify/iv-ext-samesign.ll b/llvm/test/Transforms/IndVarSimplify/iv-ext-samesign.ll
index 48a48477397126..2f08208a546e75 100644
--- a/llvm/test/Transforms/IndVarSimplify/iv-ext-samesign.ll
+++ b/llvm/test/Transforms/IndVarSimplify/iv-ext-samesign.ll
@@ -79,8 +79,7 @@ define i32 @iv_zext_zext_gt_slt(i32 %iter.count, ptr %ptr) {
; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
-; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
-; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], 1
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i64 [[INDVARS_IV1]], 1
; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
; CHECK: [[INNER_LOOP_PREHEADER]]:
; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
@@ -127,6 +126,7 @@ define i32 @iv_zext_zext_gt_slt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr
; CHECK-SAME: i32 [[ITER_COUNT:%.*]], i32 [[EXIT_LIMIT:%.*]], ptr [[PTR:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[EXIT_LIMIT]] to i64
; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
; CHECK: [[PH_LOOPEXIT:.*]]:
; CHECK-NEXT: br label %[[PH:.*]]
@@ -137,8 +137,7 @@ define i32 @iv_zext_zext_gt_slt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr
; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
-; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
-; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], [[EXIT_LIMIT]]
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i64 [[INDVARS_IV1]], [[TMP1]]
; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
; CHECK: [[INNER_LOOP_PREHEADER]]:
; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
@@ -436,8 +435,7 @@ define i32 @iv_sext_sext_gt_slt(i32 %iter.count, ptr %ptr) {
; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
-; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
-; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], 1
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i64 [[INDVARS_IV1]], 1
; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
; CHECK: [[INNER_LOOP_PREHEADER]]:
; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
@@ -484,6 +482,7 @@ define i32 @iv_sext_sext_gt_slt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr
; CHECK-SAME: i32 [[ITER_COUNT:%.*]], i32 [[EXIT_LIMIT:%.*]], ptr [[PTR:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*]]:
; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[ITER_COUNT]] to i64
+; CHECK-NEXT: [[TMP1:%.*]] = sext i32 [[EXIT_LIMIT]] to i64
; CHECK-NEXT: br label %[[OUTER_LOOP:.*]]
; CHECK: [[PH_LOOPEXIT:.*]]:
; CHECK-NEXT: br label %[[PH:.*]]
@@ -494,8 +493,7 @@ define i32 @iv_sext_sext_gt_slt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr
; CHECK-NEXT: [[INDVARS_IV_NEXT2]] = add nsw i64 [[INDVARS_IV1]], -1
; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT2]]
; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
-; CHECK-NEXT: [[TMP1:%.*]] = trunc nsw i64 [[INDVARS_IV1]] to i32
-; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP1]], [[EXIT_LIMIT]]
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i64 [[INDVARS_IV1]], [[TMP1]]
; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
; CHECK: [[INNER_LOOP_PREHEADER]]:
; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
@@ -617,15 +615,13 @@ define i32 @iv_sext_sext_sgt_lt_exitlimit(i32 %iter.count, i32 %exit.limit, ptr
; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp sgt i64 [[INDVARS_IV1]], [[TMP4]]
; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
; CHECK: [[INNER_LOOP_PREHEADER]]:
-; CHECK-NEXT: [[TMP2:%.*]] = trunc nsw i64 [[INDVARS_IV_NEXT2]] to i32
-; CHECK-NEXT: [[TMP3:%.*]] = zext i32 [[TMP2]] to i64
; CHECK-NEXT: br label %[[INNER_LOOP:.*]]
; CHECK: [[INNER_LOOP]]:
; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[INNER_LOOP_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[INNER_LOOP]] ]
; CHECK-NEXT: [[GEP_INNER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV]]
; CHECK-NEXT: store double poison, ptr [[GEP_INNER]], align 8
; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
-; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp samesign ult i64 [[INDVARS_IV_NEXT]], [[TMP3]]
+; CHECK-NEXT: [[EXIT_COND_INNER:%.*]] = icmp samesign ult i64 [[INDVARS_IV_NEXT]], [[INDVARS_IV_NEXT2]]
; CHECK-NEXT: br i1 [[EXIT_COND_INNER]], label %[[INNER_LOOP]], label %[[PH_LOOPEXIT]]
; CHECK: [[EXIT:.*:]]
; CHECK-NEXT: ret i32 0
@@ -676,8 +672,7 @@ define i32 @iv_sext_sext_gt_lt(i32 %iter.count, ptr %ptr) {
; CHECK-NEXT: [[INDVARS_IV_NEXT4]] = add nsw i64 [[INDVARS_IV3]], -1
; CHECK-NEXT: [[GEP_OUTER:%.*]] = getelementptr double, ptr [[PTR]], i64 [[INDVARS_IV_NEXT4]]
; CHECK-NEXT: store double poison, ptr [[GEP_OUTER]], align 8
-; CHECK-NEXT: [[TMP2:%.*]] = trunc nsw i64 [[INDVARS_IV3]] to i32
-; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i32 [[TMP2]], 1
+; CHECK-NEXT: [[EXIT_COND_OUTER:%.*]] = icmp samesign ugt i64 [[INDVARS_IV3]], 1
; CHECK-NEXT: br i1 [[EXIT_COND_OUTER]], label %[[INNER_LOOP_PREHEADER:.*]], label %[[PH]]
; CHECK: [[INNER_LOOP_PREHEADER]]:
; CHECK-NEXT: [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[INDVARS_IV1]] to i64
More information about the llvm-commits
mailing list