[llvm] cdc5e00 - [LV] Add test case to scalarize ptrtoint instructions.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 06:33:08 PDT 2023
Author: Florian Hahn
Date: 2023-10-27T14:32:54+01:00
New Revision: cdc5e00e73cb868f4e4d2c73f600c150b6544c6d
URL: https://github.com/llvm/llvm-project/commit/cdc5e00e73cb868f4e4d2c73f600c150b6544c6d
DIFF: https://github.com/llvm/llvm-project/commit/cdc5e00e73cb868f4e4d2c73f600c150b6544c6d.diff
LOG: [LV] Add test case to scalarize ptrtoint instructions.
Extra test for https://github.com/llvm/llvm-project/pull/69013
Added:
Modified:
llvm/test/Transforms/LoopVectorize/interleave-and-scalarize-only.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/LoopVectorize/interleave-and-scalarize-only.ll b/llvm/test/Transforms/LoopVectorize/interleave-and-scalarize-only.ll
index 541dc9a70c819ce..028e0b7b39cbadd 100644
--- a/llvm/test/Transforms/LoopVectorize/interleave-and-scalarize-only.ll
+++ b/llvm/test/Transforms/LoopVectorize/interleave-and-scalarize-only.ll
@@ -267,3 +267,43 @@ exit:
%count.0 = trunc i32 %add.lcssa to i16
ret i16 %count.0
}
+
+define void @scalarize_ptrtoint(ptr %src, ptr %dst) {
+; CHECK: vector.body:
+; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
+; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0
+; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 1
+; CHECK-NEXT: [[TMP2:%.*]] = getelementptr ptr, ptr %src, i64 [[TMP0]]
+; CHECK-NEXT: [[TMP3:%.*]] = getelementptr ptr, ptr %src, i64 [[TMP1]]
+; CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[TMP2]], align 8
+; CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP3]], align 8
+; CHECK-NEXT: [[TMP6:%.*]] = ptrtoint ptr [[TMP4]] to i64
+; CHECK-NEXT: [[TMP7:%.*]] = ptrtoint ptr [[TMP5]] to i64
+; CHECK-NEXT: [[TMP8:%.*]] = add i64 [[TMP6]], 10
+; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[TMP7]], 10
+; CHECK-NEXT: [[TMP10:%.*]] = inttoptr i64 [[TMP8]] to ptr
+; CHECK-NEXT: [[TMP11:%.*]] = inttoptr i64 [[TMP9]] to ptr
+; CHECK-NEXT: store ptr [[TMP10]], ptr %dst, align 8
+; CHECK-NEXT: store ptr [[TMP11]], ptr %dst, align 8
+; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 2
+; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], 0
+; CHECK-NEXT: br i1 [[TMP12]], label %middle.block, label %vector.body
+
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
+ %gep = getelementptr ptr, ptr %src, i64 %iv
+ %l = load ptr, ptr %gep, align 8
+ %cast = ptrtoint ptr %l to i64
+ %add = add i64 %cast, 10
+ %cast.2 = inttoptr i64 %add to ptr
+ store ptr %cast.2, ptr %dst, align 8
+ %iv.next = add i64 %iv, 1
+ %ec = icmp eq i64 %iv.next, 0
+ br i1 %ec, label %exit, label %loop
+
+exit:
+ ret void
+}
More information about the llvm-commits
mailing list