[llvm] 20835cf - [TTI] Refactor emitGetActiveLaneMask
Sjoerd Meijer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 17 01:54:43 PDT 2020
Author: Sjoerd Meijer
Date: 2020-06-17T09:53:58+01:00
New Revision: 20835cff272e2096a57aa5de53f6923f24a42049
URL: https://github.com/llvm/llvm-project/commit/20835cff272e2096a57aa5de53f6923f24a42049
DIFF: https://github.com/llvm/llvm-project/commit/20835cff272e2096a57aa5de53f6923f24a42049.diff
LOG: [TTI] Refactor emitGetActiveLaneMask
Refactor TTI hook emitGetActiveLaneMask and remove the unused arguments
as suggested in D79100.
Added:
Modified:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
llvm/lib/Target/ARM/ARMTargetTransformInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 247b8a6c1991..52da77dd35fc 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -529,9 +529,8 @@ class TargetTransformInfo {
const LoopAccessInfo *LAI) const;
/// Query the target whether lowering of the llvm.get.active.lane.mask
- /// intrinsic is supported and if emitting it is desired for this loop.
- bool emitGetActiveLaneMask(Loop *L, LoopInfo *LI, ScalarEvolution &SE,
- bool TailFolded) const;
+ /// intrinsic is supported.
+ bool emitGetActiveLaneMask() const;
/// @}
@@ -1290,8 +1289,7 @@ class TargetTransformInfo::Concept {
preferPredicateOverEpilogue(Loop *L, LoopInfo *LI, ScalarEvolution &SE,
AssumptionCache &AC, TargetLibraryInfo *TLI,
DominatorTree *DT, const LoopAccessInfo *LAI) = 0;
- virtual bool emitGetActiveLaneMask(Loop *L, LoopInfo *LI, ScalarEvolution &SE,
- bool TailFolded) = 0;
+ virtual bool emitGetActiveLaneMask() = 0;
virtual bool isLegalAddImmediate(int64_t Imm) = 0;
virtual bool isLegalICmpImmediate(int64_t Imm) = 0;
virtual bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV,
@@ -1571,9 +1569,8 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
const LoopAccessInfo *LAI) override {
return Impl.preferPredicateOverEpilogue(L, LI, SE, AC, TLI, DT, LAI);
}
- bool emitGetActiveLaneMask(Loop *L, LoopInfo *LI, ScalarEvolution &SE,
- bool TailFolded) override {
- return Impl.emitGetActiveLaneMask(L, LI, SE, TailFolded);
+ bool emitGetActiveLaneMask() override {
+ return Impl.emitGetActiveLaneMask();
}
bool isLegalAddImmediate(int64_t Imm) override {
return Impl.isLegalAddImmediate(Imm);
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index f8bfc4bfdb90..2f6faa719d91 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -141,8 +141,7 @@ class TargetTransformInfoImplBase {
return false;
}
- bool emitGetActiveLaneMask(Loop *L, LoopInfo *LI, ScalarEvolution &SE,
- bool TailFold) const {
+ bool emitGetActiveLaneMask() const {
return false;
}
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 1e36aae36ee0..3e190a08a0a2 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -462,9 +462,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
return BaseT::preferPredicateOverEpilogue(L, LI, SE, AC, TLI, DT, LAI);
}
- bool emitGetActiveLaneMask(Loop *L, LoopInfo *LI, ScalarEvolution &SE,
- bool TailFold) {
- return BaseT::emitGetActiveLaneMask(L, LI, SE, TailFold);
+ bool emitGetActiveLaneMask() {
+ return BaseT::emitGetActiveLaneMask();
}
int getInstructionLatency(const Instruction *I) {
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 116ff5ac167c..642c15efcb09 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -313,9 +313,8 @@ bool TargetTransformInfo::preferPredicateOverEpilogue(
return TTIImpl->preferPredicateOverEpilogue(L, LI, SE, AC, TLI, DT, LAI);
}
-bool TargetTransformInfo::emitGetActiveLaneMask(Loop *L, LoopInfo *LI,
- ScalarEvolution &SE, bool TailFolded) const {
- return TTIImpl->emitGetActiveLaneMask(L, LI, SE, TailFolded);
+bool TargetTransformInfo::emitGetActiveLaneMask() const {
+ return TTIImpl->emitGetActiveLaneMask();
}
void TargetTransformInfo::getUnrollingPreferences(
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
index df84246aadb1..6d7a19073bf2 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -1412,12 +1412,14 @@ bool ARMTTIImpl::preferPredicateOverEpilogue(Loop *L, LoopInfo *LI,
return canTailPredicateLoop(L, LI, SE, DL, LAI);
}
-bool ARMTTIImpl::emitGetActiveLaneMask(Loop *L, LoopInfo *LI,
- ScalarEvolution &SE, bool TailFolded) const {
- // TODO: if this loop is tail-folded, we want to emit the
- // llvm.get.active.lane.mask intrinsic so that this can be picked up in the
- // MVETailPredication pass that needs to know the number of elements
- // processed by this vector loop.
+bool ARMTTIImpl::emitGetActiveLaneMask() const {
+ if (!ST->hasMVEIntegerOps())
+ return false;
+
+ // TODO: Intrinsic @llvm.get.active.lane.mask is supported.
+ // It is used in the MVETailPredication pass, which requires the number of
+ // elements processed by this vector loop to setup the tail-predicated
+ // loop.
return false;
}
void ARMTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
index 72243efb866c..d319aa88c714 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.h
@@ -250,8 +250,7 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
TTI::UnrollingPreferences &UP);
- bool emitGetActiveLaneMask(Loop *L, LoopInfo *LI, ScalarEvolution &SE,
- bool TailFolded) const;
+ bool emitGetActiveLaneMask() const;
bool shouldBuildLookupTablesForConstant(Constant *C) const {
// In the ROPI and RWPI relocation models we can't have pointers to global
More information about the llvm-commits
mailing list