diff --git a/llvm/test/Transforms/Inline/AArch64/ext.ll b/llvm/test/Transforms/Inline/AArch64/ext.ll --- a/llvm/test/Transforms/Inline/AArch64/ext.ll +++ b/llvm/test/Transforms/Inline/AArch64/ext.ll @@ -1,9 +1,23 @@ ; REQUIRES: asserts -; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %s 2>&1 | FileCheck %s - -target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" -target triple = "aarch64--linux-gnu" - +; RUN: split-file --no-leading-lines %s %t +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/1 2>&1 | FileCheck %t/1 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/2 2>&1 | FileCheck %t/2 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/3 2>&1 | FileCheck %t/3 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/4 2>&1 | FileCheck %t/4 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/5 2>&1 | FileCheck %t/5 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/6 2>&1 | FileCheck %t/6 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/7 2>&1 | FileCheck %t/7 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/8 2>&1 | FileCheck %t/8 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/9 2>&1 | FileCheck %t/9 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/10 2>&1 | FileCheck %t/10 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/11 2>&1 | FileCheck %t/11 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/12 2>&1 | FileCheck %t/12 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/13 2>&1 | FileCheck %t/13 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/14 2>&1 | FileCheck %t/14 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/15 2>&1 | FileCheck %t/15 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/16 2>&1 | FileCheck %t/16 + +;--- 1 define i32 @outer1(i32* %ptr, i32 %i) { %C = call i32 @inner1(i32* %ptr, i32 %i) ret i32 %C @@ -20,6 +34,7 @@ ret i32 %L } +;--- 2 define i32 @outer2(i32* %ptr, i32 %i) { %C = call i32 @inner2(i32* %ptr, i32 %i) ret i32 %C @@ -36,6 +51,7 @@ ret i32 %L } +;--- 3 define i32 @outer3(i32* %ptr, i16 %i) { %C = call i32 @inner3(i32* %ptr, i16 %i) ret i32 %C @@ -52,6 +68,7 @@ ret i32 %L } +;--- 4 define i16 @outer4(i8* %ptr) { %C = call i16 @inner4(i8* %ptr) ret i16 %C @@ -67,6 +84,7 @@ ret i16 %E } +;--- 5 define i16 @outer5(i8* %ptr) { %C = call i16 @inner5(i8* %ptr) ret i16 %C @@ -82,6 +100,7 @@ ret i16 %E } +;--- 6 define i32 @outer6(i8* %ptr) { %C = call i32 @inner6(i8* %ptr) ret i32 %C @@ -97,6 +116,7 @@ ret i32 %E } +;--- 7 define i32 @outer7(i8* %ptr) { %C = call i32 @inner7(i8* %ptr) ret i32 %C @@ -112,6 +132,7 @@ ret i32 %E } +;--- 8 define i32 @outer8(i16* %ptr) { %C = call i32 @inner8(i16* %ptr) ret i32 %C @@ -127,6 +148,7 @@ ret i32 %E } +;--- 9 define i32 @outer9(i16* %ptr) { %C = call i32 @inner9(i16* %ptr) ret i32 %C @@ -142,6 +164,7 @@ ret i32 %E } +;--- 10 define i64 @outer10(i8* %ptr) { %C = call i64 @inner10(i8* %ptr) ret i64 %C @@ -157,6 +180,7 @@ ret i64 %E } +;--- 11 define i64 @outer11(i8* %ptr) { %C = call i64 @inner11(i8* %ptr) ret i64 %C @@ -172,6 +196,7 @@ ret i64 %E } +;--- 12 define i64 @outer12(i16* %ptr) { %C = call i64 @inner12(i16* %ptr) ret i64 %C @@ -187,6 +212,7 @@ ret i64 %E } +;--- 13 define i64 @outer13(i16* %ptr) { %C = call i64 @inner13(i16* %ptr) ret i64 %C @@ -202,6 +228,7 @@ ret i64 %E } +;--- 14 define i64 @outer14(i32* %ptr) { %C = call i64 @inner14(i32* %ptr) ret i64 %C @@ -217,6 +244,7 @@ ret i64 %E } +;--- 15 define i64 @outer15(i32* %ptr) { %C = call i64 @inner15(i32* %ptr) ret i64 %C @@ -232,6 +260,7 @@ ret i64 %E } +;--- 16 define i64 @outer16(i32 %V1, i64 %V2) { %C = call i64 @inner16(i32 %V1, i64 %V2) ret i64 %C diff --git a/llvm/test/Transforms/Inline/AArch64/gep-cost.ll b/llvm/test/Transforms/Inline/AArch64/gep-cost.ll --- a/llvm/test/Transforms/Inline/AArch64/gep-cost.ll +++ b/llvm/test/Transforms/Inline/AArch64/gep-cost.ll @@ -1,24 +1,15 @@ ; REQUIRES: asserts -; RUN: opt -inline -mtriple=aarch64--linux-gnu -mcpu=kryo -S -debug-only=inline-cost < %s 2>&1 | FileCheck %s - -target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" -target triple = "aarch64--linux-gnu" +; RUN: split-file --no-leading-lines %s %t +; RUN: opt -inline -mtriple=aarch64--linux-gnu -mcpu=kryo -S -debug-only=inline-cost < %t/1 2>&1 | FileCheck %t/1 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -mcpu=kryo -S -debug-only=inline-cost < %t/2 2>&1 | FileCheck %t/2 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -mcpu=kryo -S -debug-only=inline-cost < %t/3 2>&1 | FileCheck %t/3 +;--- 1 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 @@ -29,6 +20,12 @@ ret void } +;--- 2 +define void @outer2([4 x i32]* %ptr, i32 %i) { + call void @inner2([4 x i32]* %ptr, i32 %i) + ret void +} + ; 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 @@ -39,6 +36,12 @@ ret void } +;--- 3 +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 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. diff --git a/llvm/test/Transforms/Inline/AArch64/logical-and-or.ll b/llvm/test/Transforms/Inline/AArch64/logical-and-or.ll --- a/llvm/test/Transforms/Inline/AArch64/logical-and-or.ll +++ b/llvm/test/Transforms/Inline/AArch64/logical-and-or.ll @@ -1,9 +1,12 @@ ; REQUIRES: asserts -; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %s 2>&1 | FileCheck %s - -target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" -target triple = "aarch64--linux-gnu" - +; RUN: split-file --no-leading-lines %s %t +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/1 2>&1 | FileCheck %t/1 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/2 2>&1 | FileCheck %t/2 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/3 2>&1 | FileCheck %t/3 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/4 2>&1 | FileCheck %t/4 +; RUN: opt -inline -mtriple=aarch64--linux-gnu -S -debug-only=inline-cost < %t/5 2>&1 | FileCheck %t/5 + +;--- 1 ; FIXME: Once the 'or' or 'and' is simplified the second compare is dead, but ; the inline cost model has already added the cost. @@ -22,6 +25,7 @@ ret i1 %or.cond ; Simplifies to ret i1 true } +;--- 2 define i1 @outer2(i32 %a) { %C = call i1 @inner2(i32 1, i32 %a) ret i1 %C @@ -38,6 +42,7 @@ } +;--- 3 define i32 @outer3(i32 %a) { %C = call i32 @inner3(i32 4294967295, i32 %a) ret i32 %C @@ -52,6 +57,7 @@ } +;--- 4 define i32 @outer4(i32 %a) { %C = call i32 @inner4(i32 0, i32 %a) ret i32 %C @@ -65,6 +71,7 @@ ret i32 %and.cond ; Simplifies to ret i32 0 } +;--- 5 define i1 @outer5(i32 %a) { %C = call i1 @inner5(i32 0, i32 %a) ret i1 %C diff --git a/llvm/test/Transforms/Inline/PowerPC/ext.ll b/llvm/test/Transforms/Inline/PowerPC/ext.ll --- a/llvm/test/Transforms/Inline/PowerPC/ext.ll +++ b/llvm/test/Transforms/Inline/PowerPC/ext.ll @@ -1,9 +1,16 @@ ; REQUIRES: asserts -; RUN: opt -inline -S -debug-only=inline-cost < %s 2>&1 | FileCheck %s - -target datalayout = "E-m:e-i64:64-n32:64" -target triple = "powerpc64le-ibm-linux-gnu" - +; RUN: split-file --no-leading-lines %s %t +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/1 2>&1 | FileCheck %t/1 +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/2 2>&1 | FileCheck %t/2 +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/3 2>&1 | FileCheck %t/3 +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/4 2>&1 | FileCheck %t/4 +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/5 2>&1 | FileCheck %t/5 +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/6 2>&1 | FileCheck %t/6 +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/7 2>&1 | FileCheck %t/7 +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/8 2>&1 | FileCheck %t/8 +; RUN: opt -inline -mtriple=powerpc64le-ibm-linux-gnu -S -debug-only=inline-cost < %t/9 2>&1 | FileCheck %t/9 + +;--- 1 define i16 @outer1(i8* %ptr) { %C = call i16 @inner1(i8* %ptr) ret i16 %C @@ -19,6 +26,7 @@ ret i16 %E } +;--- 2 define i32 @outer2(i8* %ptr) { %C = call i32 @inner2(i8* %ptr) ret i32 %C @@ -34,6 +42,7 @@ ret i32 %E } +;--- 3 define i32 @outer3(i16* %ptr) { %C = call i32 @inner3(i16* %ptr) ret i32 %C @@ -49,6 +58,7 @@ ret i32 %E } +;--- 4 define i32 @outer4(i16* %ptr) { %C = call i32 @inner4(i16* %ptr) ret i32 %C @@ -64,6 +74,7 @@ ret i32 %E } +;--- 5 define i64 @outer5(i8* %ptr) { %C = call i64 @inner5(i8* %ptr) ret i64 %C @@ -79,6 +90,7 @@ ret i64 %E } +;--- 6 define i64 @outer6(i16* %ptr) { %C = call i64 @inner6(i16* %ptr) ret i64 %C @@ -94,6 +106,7 @@ ret i64 %E } +;--- 7 define i64 @outer7(i16* %ptr) { %C = call i64 @inner7(i16* %ptr) ret i64 %C @@ -109,6 +122,7 @@ ret i64 %E } +;--- 8 define i64 @outer8(i32* %ptr) { %C = call i64 @inner8(i32* %ptr) ret i64 %C @@ -124,6 +138,7 @@ ret i64 %E } +;--- 9 define i64 @outer9(i32* %ptr) { %C = call i64 @inner9(i32* %ptr) ret i64 %C diff --git a/llvm/test/Transforms/Inline/X86/ext.ll b/llvm/test/Transforms/Inline/X86/ext.ll --- a/llvm/test/Transforms/Inline/X86/ext.ll +++ b/llvm/test/Transforms/Inline/X86/ext.ll @@ -1,9 +1,20 @@ ; REQUIRES: asserts -; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %s 2>&1 | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-unknown" - +; RUN: split-file --no-leading-lines %s %t +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/1 2>&1 | FileCheck %t/1 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/2 2>&1 | FileCheck %t/2 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/3 2>&1 | FileCheck %t/3 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/4 2>&1 | FileCheck %t/4 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/5 2>&1 | FileCheck %t/5 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/6 2>&1 | FileCheck %t/6 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/7 2>&1 | FileCheck %t/7 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/8 2>&1 | FileCheck %t/8 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/9 2>&1 | FileCheck %t/9 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/10 2>&1 | FileCheck %t/10 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/11 2>&1 | FileCheck %t/11 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/12 2>&1 | FileCheck %t/12 +; RUN: opt -inline -mtriple=x86_64-unknown-unknown -S -debug-only=inline-cost < %t/13 2>&1 | FileCheck %t/13 + +;--- 1 define i32 @outer1(i32* %ptr, i32 %i) { %C = call i32 @inner1(i32* %ptr, i32 %i) ret i32 %C @@ -20,6 +31,7 @@ ret i32 %L } +;--- 2 define i16 @outer2(i8* %ptr) { %C = call i16 @inner2(i8* %ptr) ret i16 %C @@ -35,6 +47,7 @@ ret i16 %E } +;--- 3 define i16 @outer3(i8* %ptr) { %C = call i16 @inner3(i8* %ptr) ret i16 %C @@ -50,6 +63,7 @@ ret i16 %E } +;--- 4 define i32 @outer4(i8* %ptr) { %C = call i32 @inner4(i8* %ptr) ret i32 %C @@ -65,6 +79,7 @@ ret i32 %E } +;--- 5 define i32 @outer5(i8* %ptr) { %C = call i32 @inner5(i8* %ptr) ret i32 %C @@ -80,6 +95,7 @@ ret i32 %E } +;--- 6 define i32 @outer6(i16* %ptr) { %C = call i32 @inner6(i16* %ptr) ret i32 %C @@ -95,6 +111,7 @@ ret i32 %E } +;--- 7 define i32 @outer7(i16* %ptr) { %C = call i32 @inner7(i16* %ptr) ret i32 %C @@ -110,6 +127,7 @@ ret i32 %E } +;--- 8 define i64 @outer8(i8* %ptr) { %C = call i64 @inner8(i8* %ptr) ret i64 %C @@ -125,6 +143,7 @@ ret i64 %E } +;--- 9 define i64 @outer9(i8* %ptr) { %C = call i64 @inner9(i8* %ptr) ret i64 %C @@ -140,6 +159,7 @@ ret i64 %E } +;--- 10 define i64 @outer10(i16* %ptr) { %C = call i64 @inner10(i16* %ptr) ret i64 %C @@ -155,6 +175,7 @@ ret i64 %E } +;--- 11 define i64 @outer11(i16* %ptr) { %C = call i64 @inner11(i16* %ptr) ret i64 %C @@ -170,6 +191,7 @@ ret i64 %E } +;--- 12 define i64 @outer12(i32* %ptr) { %C = call i64 @inner12(i32* %ptr) ret i64 %C @@ -185,6 +207,7 @@ ret i64 %E } +;--- 13 define i64 @outer13(i32* %ptr) { %C = call i64 @inner13(i32* %ptr) ret i64 %C