diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2019-09-05 13:09:42 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2019-09-05 13:09:42 +0000 |
commit | 33671ceffa63e566308bf8777802833ca87719af (patch) | |
tree | 90415cb6f24bd3a0b2502a445d58d4227ba6af97 /llvm/lib | |
parent | 215910eeb2e13173b04bb8325cb20bf6fb011810 (diff) | |
download | bcm5719-llvm-33671ceffa63e566308bf8777802833ca87719af.tar.gz bcm5719-llvm-33671ceffa63e566308bf8777802833ca87719af.zip |
[LLVM][Alignment] Convert isLegalNTStore/isLegalNTLoad to llvm::Align
Summary:
This is patch is part of a serie to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67223
llvm-svn: 371063
Diffstat (limited to 'llvm/lib')
4 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp index c463d82fca0..bce2c700de9 100644 --- a/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -302,12 +302,12 @@ bool TargetTransformInfo::isLegalMaskedLoad(Type *DataType) const { } bool TargetTransformInfo::isLegalNTStore(Type *DataType, - unsigned Alignment) const { + llvm::Align Alignment) const { return TTIImpl->isLegalNTStore(DataType, Alignment); } bool TargetTransformInfo::isLegalNTLoad(Type *DataType, - unsigned Alignment) const { + llvm::Align Alignment) const { return TTIImpl->isLegalNTLoad(DataType, Alignment); } diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp index a4972b0172e..7c5d54af34f 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -3275,7 +3275,7 @@ bool X86TTIImpl::isLegalMaskedStore(Type *DataType) { return isLegalMaskedLoad(DataType); } -bool X86TTIImpl::isLegalNTLoad(Type *DataType, unsigned Alignment) { +bool X86TTIImpl::isLegalNTLoad(Type *DataType, llvm::Align Alignment) { unsigned DataSize = DL.getTypeStoreSize(DataType); // The only supported nontemporal loads are for aligned vectors of 16 or 32 // bytes. Note that 32-byte nontemporal vector loads are supported by AVX2 @@ -3286,7 +3286,7 @@ bool X86TTIImpl::isLegalNTLoad(Type *DataType, unsigned Alignment) { return false; } -bool X86TTIImpl::isLegalNTStore(Type *DataType, unsigned Alignment) { +bool X86TTIImpl::isLegalNTStore(Type *DataType, llvm::Align Alignment) { unsigned DataSize = DL.getTypeStoreSize(DataType); // SSE4A supports nontemporal stores of float and double at arbitrary diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.h b/llvm/lib/Target/X86/X86TargetTransformInfo.h index 25d9c33eb16..7545ef502bb 100644 --- a/llvm/lib/Target/X86/X86TargetTransformInfo.h +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.h @@ -186,8 +186,8 @@ public: bool canMacroFuseCmp(); bool isLegalMaskedLoad(Type *DataType); bool isLegalMaskedStore(Type *DataType); - bool isLegalNTLoad(Type *DataType, unsigned Alignment); - bool isLegalNTStore(Type *DataType, unsigned Alignment); + bool isLegalNTLoad(Type *DataType, llvm::Align Alignment); + bool isLegalNTStore(Type *DataType, llvm::Align Alignment); bool isLegalMaskedGather(Type *DataType); bool isLegalMaskedScatter(Type *DataType); bool isLegalMaskedExpandLoad(Type *DataType); diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp index e5f9407e155..abd19391c0c 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp @@ -739,7 +739,8 @@ bool LoopVectorizationLegality::canVectorizeInstrs() { Type *VecTy = VectorType::get(T, /*NumElements=*/2); assert(VecTy && "did not find vectorized version of stored type"); unsigned Alignment = getLoadStoreAlignment(ST); - if (!TTI->isLegalNTStore(VecTy, Alignment)) { + assert(Alignment && "Alignment should be set"); + if (!TTI->isLegalNTStore(VecTy, llvm::Align(Alignment))) { reportVectorizationFailure( "nontemporal store instruction cannot be vectorized", "nontemporal store instruction cannot be vectorized", @@ -755,7 +756,8 @@ bool LoopVectorizationLegality::canVectorizeInstrs() { Type *VecTy = VectorType::get(I.getType(), /*NumElements=*/2); assert(VecTy && "did not find vectorized version of load type"); unsigned Alignment = getLoadStoreAlignment(LD); - if (!TTI->isLegalNTLoad(VecTy, Alignment)) { + assert(Alignment && "Alignment should be set"); + if (!TTI->isLegalNTLoad(VecTy, llvm::Align(Alignment))) { reportVectorizationFailure( "nontemporal load instruction cannot be vectorized", "nontemporal load instruction cannot be vectorized", |