[PATCH] D33779: [InlineCost] Add a test case for GEP cost
Haicheng Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 1 12:06:34 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304454: [InlineCost] Add a test case for GEP cost (authored by haicheng).
Changed prior to commit:
https://reviews.llvm.org/D33779?vs=101024&id=101073#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33779
Files:
llvm/trunk/test/Transforms/Inline/AArch64/gep-cost.ll
Index: llvm/trunk/test/Transforms/Inline/AArch64/gep-cost.ll
===================================================================
--- llvm/trunk/test/Transforms/Inline/AArch64/gep-cost.ll
+++ llvm/trunk/test/Transforms/Inline/AArch64/gep-cost.ll
@@ -4,11 +4,21 @@
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64--linux-gnu"
-define void @outer([4 x i32]* %ptr, i32 %i) {
+define void @outer1([4 x i32]* %ptr, i32 %i) {
call void @inner1([4 x i32]* %ptr, i32 %i)
+ ret void
+}
+
+define void @outer2([4 x i32]* %ptr, i32 %i) {
call void @inner2([4 x i32]* %ptr, i32 %i)
ret void
}
+
+define void @outer3([4 x i32]* %ptr, i32 %j) {
+ call void @inner3([4 x i32]* %ptr, i32 0, i32 %j)
+ ret void
+}
+
; The gep in inner1() is reg+reg, which is a legal addressing mode for AArch64.
; Thus, both the gep and ret can be simplified.
; CHECK: Analyzing call of inner1
@@ -19,12 +29,23 @@
ret void
}
-; The gep in inner2() is reg+imm+reg, which is not a legal addressing mode for
+; The gep in inner2() is reg+imm+reg, which is not a legal addressing mode for
; AArch64. Thus, only the ret can be simplified and not the gep.
; CHECK: Analyzing call of inner2
; CHECK: NumInstructionsSimplified: 1
; CHECK: NumInstructions: 2
define void @inner2([4 x i32]* %ptr, i32 %i) {
%G = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i32 1, i32 %i
ret void
}
+
+; The gep in inner3() is reg+reg because %i is a known constant from the
+; callsite. This case is a legal addressing mode for AArch64. Thus, both the
+; gep and ret can be simplified.
+; CHECK: Analyzing call of inner3
+; CHECK: NumInstructionsSimplified: 2
+; CHECK: NumInstructions: 2
+define void @inner3([4 x i32]* %ptr, i32 %i, i32 %j) {
+ %G = getelementptr inbounds [4 x i32], [4 x i32]* %ptr, i32 %i, i32 %j
+ ret void
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33779.101073.patch
Type: text/x-patch
Size: 1871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170601/a4303df6/attachment.bin>
More information about the llvm-commits
mailing list