[llvm] r308076 - [TTI] Refine the cost of EXT in getUserCost()
Michael Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 02:17:51 PDT 2017
Hi,
This commit caused a number of code-size and compile-time degradations. Any chance to recover them?
Performance Regressions - code_size Δ Previous Current σ Δ (B) σ (B)
CTMark/sqlite3/sqlite3 <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605737=8> 15.43% 503892.0000 581656.0000 - 12.92% -
CTMark/lencod/lencod <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605732=8> 3.92% 636696.0000 661652.0000 - 26.59% -
CTMark/mafft/pairlocalalign <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605723=8> 3.34% 151352.0000 156404.0000 - 13.15% -
Performance Regressions - Compile Time Δ Previous Current σ Δ (B) σ (B)
CTMark/sqlite3/sqlite3-link <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605736=2> 17.62% 7.1298 8.3859 - 3.90% -
CTMark/sqlite3/sqlite3 <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605737=2> 12.75% 7.5996 8.5685 - 3.34% -
CTMark/mafft/pairlocalalign-link <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605740=2> 7.33% 2.7199 2.9194 - -14.12% -
CTMark/lencod/lencod-link <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605738=2> 4.42% 11.9191 12.4459 - 3.07% -
CTMark/mafft/pairlocalalign <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605723=2> 3.15% 5.1741 5.3370 - -16.96% -
CTMark/lencod/lencod <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605732=2> 2.25% 10.6467 10.8867 - -0.17% -
CTMark/7zip/7zip-benchmark <http://104.154.54.203/db_default/v4/nts/59530/graph?test.1605724=2> 1.18% 35.7458 36.1689 - 4.27% -
Details on green dragon:
http://104.154.54.203/db_default/v4/nts/59530 <http://104.154.54.203/db_default/v4/nts/59530>
Thanks,
Michael
> On Jul 15, 2017, at 6:12 AM, Haicheng Wu via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Author: haicheng
> Date: Fri Jul 14 19:12:16 2017
> New Revision: 308076
>
> URL: http://llvm.org/viewvc/llvm-project?rev=308076&view=rev
> Log:
> [TTI] Refine the cost of EXT in getUserCost()
>
> Now, getUserCost() only checks the src and dst types of EXT to decide it is free
> or not. This change first checks the types, then calls isExtFreeImpl(), and
> check if EXT can form ExtLoad at last. Currently, only AArch64 has customized
> implementation of isExtFreeImpl() to check if EXT can be folded into its use.
>
> Differential Revision: https://reviews.llvm.org/D34458
>
> Added:
> llvm/trunk/test/Transforms/Inline/AArch64/ext.ll
> llvm/trunk/test/Transforms/Inline/PowerPC/
> llvm/trunk/test/Transforms/Inline/PowerPC/ext.ll
> llvm/trunk/test/Transforms/Inline/PowerPC/lit.local.cfg
> llvm/trunk/test/Transforms/Inline/X86/ext.ll
> Modified:
> llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h
> llvm/trunk/include/llvm/Analysis/TargetTransformInfoImpl.h
> llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h
> llvm/trunk/include/llvm/Target/TargetLowering.h
> llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
> llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
>
> Modified: llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h?rev=308076&r1=308075&r2=308076&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h (original)
> +++ llvm/trunk/include/llvm/Analysis/TargetTransformInfo.h Fri Jul 14 19:12:16 2017
> @@ -155,6 +155,13 @@ public:
> int getGEPCost(Type *PointeeType, const Value *Ptr,
> ArrayRef<const Value *> Operands) const;
>
> + /// \brief Estimate the cost of a EXT operation when lowered.
> + ///
> + /// The contract for this function is the same as \c getOperationCost except
> + /// that it supports an interface that provides extra information specific to
> + /// the EXT operation.
> + int getExtCost(const Instruction *I, const Value *Src) const;
> +
> /// \brief Estimate the cost of a function call when lowered.
> ///
> /// The contract for this is the same as \c getOperationCost except that it
> @@ -849,6 +856,7 @@ public:
> virtual int getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) = 0;
> virtual int getGEPCost(Type *PointeeType, const Value *Ptr,
> ArrayRef<const Value *> Operands) = 0;
> + virtual int getExtCost(const Instruction *I, const Value *Src) = 0;
> virtual int getCallCost(FunctionType *FTy, int NumArgs) = 0;
> virtual int getCallCost(const Function *F, int NumArgs) = 0;
> virtual int getCallCost(const Function *F,
> @@ -1022,6 +1030,9 @@ public:
> ArrayRef<const Value *> Operands) override {
> return Impl.getGEPCost(PointeeType, Ptr, Operands);
> }
> + int getExtCost(const Instruction *I, const Value *Src) override {
> + return Impl.getExtCost(I, Src);
> + }
> int getCallCost(FunctionType *FTy, int NumArgs) override {
> return Impl.getCallCost(FTy, NumArgs);
> }
>
> Modified: llvm/trunk/include/llvm/Analysis/TargetTransformInfoImpl.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TargetTransformInfoImpl.h?rev=308076&r1=308075&r2=308076&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/TargetTransformInfoImpl.h (original)
> +++ llvm/trunk/include/llvm/Analysis/TargetTransformInfoImpl.h Fri Jul 14 19:12:16 2017
> @@ -120,6 +120,10 @@ public:
> return SI.getNumCases();
> }
>
> + int getExtCost(const Instruction *I, const Value *Src) {
> + return TTI::TCC_Basic;
> + }
> +
> unsigned getCallCost(FunctionType *FTy, int NumArgs) {
> assert(FTy && "FunctionType must be provided to this routine.");
>
> @@ -728,6 +732,8 @@ public:
> // nop on most sane targets.
> if (isa<CmpInst>(CI->getOperand(0)))
> return TTI::TCC_Free;
> + if (isa<SExtInst>(CI) || isa<ZExtInst>(CI) || isa<FPExtInst>(CI))
> + return static_cast<T *>(this)->getExtCost(CI, Operands.back());
> }
>
> return static_cast<T *>(this)->getOperationCost(
>
> Modified: llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h?rev=308076&r1=308075&r2=308076&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h Fri Jul 14 19:12:16 2017
> @@ -155,6 +155,18 @@ public:
> return BaseT::getGEPCost(PointeeType, Ptr, Operands);
> }
>
> + int getExtCost(const Instruction *I, const Value *Src) {
> + if (getTLI()->isExtFree(I))
> + return TargetTransformInfo::TCC_Free;
> +
> + if (isa<ZExtInst>(I) || isa<SExtInst>(I))
> + if (const LoadInst *LI = dyn_cast<LoadInst>(Src))
> + if (getTLI()->isExtLoad(LI, I, DL))
> + return TargetTransformInfo::TCC_Free;
> +
> + return TargetTransformInfo::TCC_Basic;
> + }
> +
> unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
> ArrayRef<const Value *> Arguments) {
> return BaseT::getIntrinsicCost(IID, RetTy, Arguments);
>
> Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=308076&r1=308075&r2=308076&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetLowering.h Fri Jul 14 19:12:16 2017
> @@ -2012,6 +2012,35 @@ public:
> return isExtFreeImpl(I);
> }
>
> + /// Return true if \p Load and \p Ext can form an ExtLoad.
> + /// For example, in AArch64
> + /// %L = load i8, i8* %ptr
> + /// %E = zext i8 %L to i32
> + /// can be lowered into one load instruction
> + /// ldrb w0, [x0]
> + bool isExtLoad(const LoadInst *Load, const Instruction *Ext,
> + const DataLayout &DL) const {
> + EVT VT = getValueType(DL, Ext->getType());
> + EVT LoadVT = getValueType(DL, Load->getType());
> +
> + // If the load has other users and the truncate is not free, the ext
> + // probably isn't free.
> + if (!Load->hasOneUse() && (isTypeLegal(LoadVT) || !isTypeLegal(VT)) &&
> + !isTruncateFree(Ext->getType(), Load->getType()))
> + return false;
> +
> + // Check whether the target supports casts folded into loads.
> + unsigned LType;
> + if (isa<ZExtInst>(Ext))
> + LType = ISD::ZEXTLOAD;
> + else {
> + assert(isa<SExtInst>(Ext) && "Unexpected ext type!");
> + LType = ISD::SEXTLOAD;
> + }
> +
> + return isLoadExtLegal(LType, VT, LoadVT);
> + }
> +
> /// Return true if any actual instruction that defines a value of type FromTy
> /// implicitly zero-extends the value to ToTy in the result register.
> ///
>
> Modified: llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetTransformInfo.cpp?rev=308076&r1=308075&r2=308076&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/TargetTransformInfo.cpp (original)
> +++ llvm/trunk/lib/Analysis/TargetTransformInfo.cpp Fri Jul 14 19:12:16 2017
> @@ -82,6 +82,11 @@ int TargetTransformInfo::getGEPCost(Type
> return TTIImpl->getGEPCost(PointeeType, Ptr, Operands);
> }
>
> +int TargetTransformInfo::getExtCost(const Instruction *I,
> + const Value *Src) const {
> + return TTIImpl->getExtCost(I, Src);
> +}
> +
> int TargetTransformInfo::getIntrinsicCost(
> Intrinsic::ID IID, Type *RetTy, ArrayRef<const Value *> Arguments) const {
> int Cost = TTIImpl->getIntrinsicCost(IID, RetTy, Arguments);
>
> Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=308076&r1=308075&r2=308076&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
> +++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Fri Jul 14 19:12:16 2017
> @@ -4847,25 +4847,7 @@ bool CodeGenPrepare::canFormExtLd(
> if (!HasPromoted && LI->getParent() == Inst->getParent())
> return false;
>
> - EVT VT = TLI->getValueType(*DL, Inst->getType());
> - EVT LoadVT = TLI->getValueType(*DL, LI->getType());
> -
> - // If the load has other users and the truncate is not free, this probably
> - // isn't worthwhile.
> - if (!LI->hasOneUse() && (TLI->isTypeLegal(LoadVT) || !TLI->isTypeLegal(VT)) &&
> - !TLI->isTruncateFree(Inst->getType(), LI->getType()))
> - return false;
> -
> - // Check whether the target supports casts folded into loads.
> - unsigned LType;
> - if (isa<ZExtInst>(Inst))
> - LType = ISD::ZEXTLOAD;
> - else {
> - assert(isa<SExtInst>(Inst) && "Unexpected ext type!");
> - LType = ISD::SEXTLOAD;
> - }
> -
> - return TLI->isLoadExtLegal(LType, VT, LoadVT);
> + return TLI->isExtLoad(LI, Inst, *DL);
> }
>
> /// Move a zext or sext fed by a load into the same basic block as the load,
>
> Added: llvm/trunk/test/Transforms/Inline/AArch64/ext.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/AArch64/ext.ll?rev=308076&view=auto
> ==============================================================================
> --- llvm/trunk/test/Transforms/Inline/AArch64/ext.ll (added)
> +++ llvm/trunk/test/Transforms/Inline/AArch64/ext.ll Fri Jul 14 19:12:16 2017
> @@ -0,0 +1,249 @@
> +; 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"
> +
> +define i32 @outer1(i32* %ptr, i32 %i) {
> + %C = call i32 @inner1(i32* %ptr, i32 %i)
> + ret i32 %C
> +}
> +
> +; sext can be folded into gep.
> +; CHECK: Analyzing call of inner1
> +; CHECK: NumInstructionsSimplified: 3
> +; CHECK: NumInstructions: 4
> +define i32 @inner1(i32* %ptr, i32 %i) {
> + %E = sext i32 %i to i64
> + %G = getelementptr inbounds i32, i32* %ptr, i64 %E
> + %L = load i32, i32* %G
> + ret i32 %L
> +}
> +
> +define i32 @outer2(i32* %ptr, i32 %i) {
> + %C = call i32 @inner2(i32* %ptr, i32 %i)
> + ret i32 %C
> +}
> +
> +; zext from i32 to i64 is free.
> +; CHECK: Analyzing call of inner2
> +; CHECK: NumInstructionsSimplified: 3
> +; CHECK: NumInstructions: 4
> +define i32 @inner2(i32* %ptr, i32 %i) {
> + %E = zext i32 %i to i64
> + %G = getelementptr inbounds i32, i32* %ptr, i64 %E
> + %L = load i32, i32* %G
> + ret i32 %L
> +}
> +
> +define i32 @outer3(i32* %ptr, i16 %i) {
> + %C = call i32 @inner3(i32* %ptr, i16 %i)
> + ret i32 %C
> +}
> +
> +; zext can be folded into gep.
> +; CHECK: Analyzing call of inner3
> +; CHECK: NumInstructionsSimplified: 3
> +; CHECK: NumInstructions: 4
> +define i32 @inner3(i32* %ptr, i16 %i) {
> + %E = zext i16 %i to i64
> + %G = getelementptr inbounds i32, i32* %ptr, i64 %E
> + %L = load i32, i32* %G
> + ret i32 %L
> +}
> +
> +define i16 @outer4(i8* %ptr) {
> + %C = call i16 @inner4(i8* %ptr)
> + ret i16 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner4
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i16 @inner4(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i16
> + ret i16 %E
> +}
> +
> +define i16 @outer5(i8* %ptr) {
> + %C = call i16 @inner5(i8* %ptr)
> + ret i16 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner5
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i16 @inner5(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = sext i8 %L to i16
> + ret i16 %E
> +}
> +
> +define i32 @outer6(i8* %ptr) {
> + %C = call i32 @inner6(i8* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner6
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner6(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i32
> + ret i32 %E
> +}
> +
> +define i32 @outer7(i8* %ptr) {
> + %C = call i32 @inner7(i8* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner7
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner7(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = sext i8 %L to i32
> + ret i32 %E
> +}
> +
> +define i32 @outer8(i16* %ptr) {
> + %C = call i32 @inner8(i16* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner8
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner8(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = zext i16 %L to i32
> + ret i32 %E
> +}
> +
> +define i32 @outer9(i16* %ptr) {
> + %C = call i32 @inner9(i16* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner9
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner9(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = sext i16 %L to i32
> + ret i32 %E
> +}
> +
> +define i64 @outer10(i8* %ptr) {
> + %C = call i64 @inner10(i8* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner10
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner10(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer11(i8* %ptr) {
> + %C = call i64 @inner11(i8* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner11
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner11(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = sext i8 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer12(i16* %ptr) {
> + %C = call i64 @inner12(i16* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner12
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner12(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = zext i16 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer13(i16* %ptr) {
> + %C = call i64 @inner13(i16* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner13
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner13(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = sext i16 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer14(i32* %ptr) {
> + %C = call i64 @inner14(i32* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner14
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner14(i32* %ptr) {
> + %L = load i32, i32* %ptr
> + %E = zext i32 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer15(i32* %ptr) {
> + %C = call i64 @inner15(i32* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner15
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner15(i32* %ptr) {
> + %L = load i32, i32* %ptr
> + %E = sext i32 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer16(i32 %V1, i64 %V2) {
> + %C = call i64 @inner16(i32 %V1, i64 %V2)
> + ret i64 %C
> +}
> +
> +; sext can be folded into shl.
> +; CHECK: Analyzing call of inner16
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 4
> +define i64 @inner16(i32 %V1, i64 %V2) {
> + %E = sext i32 %V1 to i64
> + %S = shl i64 %E, 3
> + %A = add i64 %V2, %S
> + ret i64 %A
> +}
>
> Added: llvm/trunk/test/Transforms/Inline/PowerPC/ext.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/PowerPC/ext.ll?rev=308076&view=auto
> ==============================================================================
> --- llvm/trunk/test/Transforms/Inline/PowerPC/ext.ll (added)
> +++ llvm/trunk/test/Transforms/Inline/PowerPC/ext.ll Fri Jul 14 19:12:16 2017
> @@ -0,0 +1,140 @@
> +; 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"
> +
> +define i16 @outer1(i8* %ptr) {
> + %C = call i16 @inner1(i8* %ptr)
> + ret i16 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner1
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i16 @inner1(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i16
> + ret i16 %E
> +}
> +
> +define i32 @outer2(i8* %ptr) {
> + %C = call i32 @inner2(i8* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner2
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner2(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i32
> + ret i32 %E
> +}
> +
> +define i32 @outer3(i16* %ptr) {
> + %C = call i32 @inner3(i16* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner3
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner3(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = zext i16 %L to i32
> + ret i32 %E
> +}
> +
> +define i32 @outer4(i16* %ptr) {
> + %C = call i32 @inner4(i16* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner4
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner4(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = sext i16 %L to i32
> + ret i32 %E
> +}
> +
> +define i64 @outer5(i8* %ptr) {
> + %C = call i64 @inner5(i8* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner5
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner5(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer6(i16* %ptr) {
> + %C = call i64 @inner6(i16* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner6
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner6(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = zext i16 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer7(i16* %ptr) {
> + %C = call i64 @inner7(i16* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner7
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner7(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = sext i16 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer8(i32* %ptr) {
> + %C = call i64 @inner8(i32* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner8
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner8(i32* %ptr) {
> + %L = load i32, i32* %ptr
> + %E = zext i32 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer9(i32* %ptr) {
> + %C = call i64 @inner9(i32* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner9
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner9(i32* %ptr) {
> + %L = load i32, i32* %ptr
> + %E = sext i32 %L to i64
> + ret i64 %E
> +}
>
> Added: llvm/trunk/test/Transforms/Inline/PowerPC/lit.local.cfg
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/PowerPC/lit.local.cfg?rev=308076&view=auto
> ==============================================================================
> --- llvm/trunk/test/Transforms/Inline/PowerPC/lit.local.cfg (added)
> +++ llvm/trunk/test/Transforms/Inline/PowerPC/lit.local.cfg Fri Jul 14 19:12:16 2017
> @@ -0,0 +1,3 @@
> +if not 'PowerPC' in config.root.targets:
> + config.unsupported = True
> +
>
> Added: llvm/trunk/test/Transforms/Inline/X86/ext.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/X86/ext.ll?rev=308076&view=auto
> ==============================================================================
> --- llvm/trunk/test/Transforms/Inline/X86/ext.ll (added)
> +++ llvm/trunk/test/Transforms/Inline/X86/ext.ll Fri Jul 14 19:12:16 2017
> @@ -0,0 +1,201 @@
> +; 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"
> +
> +define i32 @outer1(i32* %ptr, i32 %i) {
> + %C = call i32 @inner1(i32* %ptr, i32 %i)
> + ret i32 %C
> +}
> +
> +; zext from i32 to i64 is free.
> +; CHECK: Analyzing call of inner1
> +; CHECK: NumInstructionsSimplified: 3
> +; CHECK: NumInstructions: 4
> +define i32 @inner1(i32* %ptr, i32 %i) {
> + %E = zext i32 %i to i64
> + %G = getelementptr inbounds i32, i32* %ptr, i64 %E
> + %L = load i32, i32* %G
> + ret i32 %L
> +}
> +
> +define i16 @outer2(i8* %ptr) {
> + %C = call i16 @inner2(i8* %ptr)
> + ret i16 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner2
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i16 @inner2(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i16
> + ret i16 %E
> +}
> +
> +define i16 @outer3(i8* %ptr) {
> + %C = call i16 @inner3(i8* %ptr)
> + ret i16 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner3
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i16 @inner3(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = sext i8 %L to i16
> + ret i16 %E
> +}
> +
> +define i32 @outer4(i8* %ptr) {
> + %C = call i32 @inner4(i8* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner4
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner4(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i32
> + ret i32 %E
> +}
> +
> +define i32 @outer5(i8* %ptr) {
> + %C = call i32 @inner5(i8* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner5
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner5(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = sext i8 %L to i32
> + ret i32 %E
> +}
> +
> +define i32 @outer6(i16* %ptr) {
> + %C = call i32 @inner6(i16* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner6
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner6(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = zext i16 %L to i32
> + ret i32 %E
> +}
> +
> +define i32 @outer7(i16* %ptr) {
> + %C = call i32 @inner7(i16* %ptr)
> + ret i32 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner7
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i32 @inner7(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = sext i16 %L to i32
> + ret i32 %E
> +}
> +
> +define i64 @outer8(i8* %ptr) {
> + %C = call i64 @inner8(i8* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner8
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner8(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = zext i8 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer9(i8* %ptr) {
> + %C = call i64 @inner9(i8* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner9
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner9(i8* %ptr) {
> + %L = load i8, i8* %ptr
> + %E = sext i8 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer10(i16* %ptr) {
> + %C = call i64 @inner10(i16* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner10
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner10(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = zext i16 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer11(i16* %ptr) {
> + %C = call i64 @inner11(i16* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner11
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner11(i16* %ptr) {
> + %L = load i16, i16* %ptr
> + %E = sext i16 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer12(i32* %ptr) {
> + %C = call i64 @inner12(i32* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner12
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner12(i32* %ptr) {
> + %L = load i32, i32* %ptr
> + %E = zext i32 %L to i64
> + ret i64 %E
> +}
> +
> +define i64 @outer13(i32* %ptr) {
> + %C = call i64 @inner13(i32* %ptr)
> + ret i64 %C
> +}
> +
> +; It is an ExtLoad.
> +; CHECK: Analyzing call of inner13
> +; CHECK: NumInstructionsSimplified: 2
> +; CHECK: NumInstructions: 3
> +define i64 @inner13(i32* %ptr) {
> + %L = load i32, i32* %ptr
> + %E = sext i32 %L to i64
> + ret i64 %E
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170724/8b663aad/attachment.html>
More information about the llvm-commits
mailing list