[llvm] 271b470 - [IndVars] Precommit test with redundant FPToSI.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 5 02:21:59 PDT 2022
Author: Florian Hahn
Date: 2022-07-05T10:21:33+01:00
New Revision: 271b470f3f1a9866d8420f5720dfeb10c596f244
URL: https://github.com/llvm/llvm-project/commit/271b470f3f1a9866d8420f5720dfeb10c596f244
DIFF: https://github.com/llvm/llvm-project/commit/271b470f3f1a9866d8420f5720dfeb10c596f244.diff
LOG: [IndVars] Precommit test with redundant FPToSI.
Test for #55505.
Added:
Modified:
llvm/test/Transforms/IndVarSimplify/floating-point-iv.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/IndVarSimplify/floating-point-iv.ll b/llvm/test/Transforms/IndVarSimplify/floating-point-iv.ll
index ca081e81b3ee1..87745f6997f03 100644
--- a/llvm/test/Transforms/IndVarSimplify/floating-point-iv.ll
+++ b/llvm/test/Transforms/IndVarSimplify/floating-point-iv.ll
@@ -368,3 +368,37 @@ backedge:
return: ; preds = %bb
ret void
}
+
+define void @pr55505_remove_redundant_fptosi_for_float_iv(i32 %index, ptr %dst) {
+; CHECK-LABEL: @pr55505_remove_redundant_fptosi_for_float_iv(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[FLOAT_IV_INT:%.*]] = phi i32 [ 1000, [[ENTRY:%.*]] ], [ [[FLOAT_IV_NEXT_INT:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[INDVAR_CONV:%.*]] = sitofp i32 [[FLOAT_IV_INT]] to float
+; CHECK-NEXT: [[CONV:%.*]] = fptosi float [[INDVAR_CONV]] to i32
+; CHECK-NEXT: [[IDXPROM:%.*]] = sext i32 [[CONV]] to i64
+; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i64 [[IDXPROM]]
+; CHECK-NEXT: store float [[INDVAR_CONV]], ptr [[ARRAYIDX]], align 4
+; CHECK-NEXT: [[FLOAT_IV_NEXT_INT]] = add nsw i32 [[FLOAT_IV_INT]], -1
+; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[FLOAT_IV_NEXT_INT]], 0
+; CHECK-NEXT: br i1 [[CMP]], label [[LOOP]], label [[EXIT:%.*]]
+; CHECK: exit:
+; CHECK-NEXT: ret void
+;
+entry:
+ br label %loop
+
+loop:
+ %float.iv = phi float [ 1.000000e+03, %entry ], [ %float.iv.next, %loop ]
+ %conv = fptosi float %float.iv to i32
+ %idxprom = sext i32 %conv to i64
+ %arrayidx = getelementptr inbounds i32, ptr %dst, i64 %idxprom
+ store float %float.iv, ptr %arrayidx, align 4
+ %float.iv.next = fadd float %float.iv, -1.000000e+00
+ %cmp = fcmp ogt float %float.iv.next, 0.000000e+00
+ br i1 %cmp, label %loop, label %exit
+
+exit:
+ ret void
+}
More information about the llvm-commits
mailing list