-
Notifications
You must be signed in to change notification settings - Fork 15.7k
[TableGen] Use TreePatternNode::getSimpleType instead of getType. NFC #174231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
These were the only uses of getType. Both of these calls are after HwMode has been expanded so we can use getSimpleTye like other code. Remove getType since it is now unused. While there, simplify the hasBFloatType to use getScalarType for the scalar and vector case.
|
@llvm/pr-subscribers-llvm-globalisel Author: Craig Topper (topperc) ChangesThese were the only uses of getType. Both of these calls are after HwMode has been expanded so we can use getSimpleType like other code. Remove getType since it is now unused. While there, simplify the hasBFloatType to use getScalarType for the scalar and vector case. Full diff: https://github.com/llvm/llvm-project/pull/174231.diff 3 Files Affected:
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
index f65f0e7ddbc98..a624f938e8564 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
@@ -681,9 +681,6 @@ class TreePatternNode : public RefCountedBase<TreePatternNode> {
// Type accessors.
unsigned getNumTypes() const { return Types.size(); }
- ValueTypeByHwMode getType(unsigned ResNo) const {
- return Types[ResNo].getValueTypeByHwMode();
- }
const std::vector<TypeSetByHwMode> &getExtTypes() const { return Types; }
const TypeSetByHwMode &getExtType(unsigned ResNo) const {
return Types[ResNo];
diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp
index d7f21f1c4e7ef..381e857fca822 100644
--- a/llvm/utils/TableGen/FastISelEmitter.cpp
+++ b/llvm/utils/TableGen/FastISelEmitter.cpp
@@ -175,10 +175,8 @@ struct OperandsSignature {
// Emit the type check.
TreePattern *TP = PredFn.getOrigPatFragRecord();
- ValueTypeByHwMode VVT = TP->getTree(0)->getType(0);
- assert(VVT.isSimple() &&
- "Cannot use variable value types with fast isel");
- OS << LS << "VT == " << getEnumName(VVT.getSimple().SimpleTy) << " && ";
+ MVT VT = TP->getTree(0)->getSimpleType(0);
+ OS << LS << "VT == " << getEnumName(VT) << " && ";
OS << PredFn.getFnName() << "(imm" << Idx << ')';
}
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index bd79c423a00e2..84024ec086808 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -2412,11 +2412,9 @@ void GlobalISelEmitter::emitRunCustomAction(raw_ostream &OS) {
bool hasBFloatType(const TreePatternNode &Node) {
for (unsigned I = 0, E = Node.getNumTypes(); I < E; I++) {
- auto Ty = Node.getType(I);
- for (auto T : Ty)
- if (T.second == MVT::bf16 ||
- (T.second.isVector() && T.second.getScalarType() == MVT::bf16))
- return true;
+ MVT VT = Node.getSimpleType(I);
+ if (VT.getScalarType() == MVT::bf16)
+ return true;
}
for (const TreePatternNode &C : Node.children())
if (hasBFloatType(C))
|
|
@llvm/pr-subscribers-tablegen Author: Craig Topper (topperc) ChangesThese were the only uses of getType. Both of these calls are after HwMode has been expanded so we can use getSimpleType like other code. Remove getType since it is now unused. While there, simplify the hasBFloatType to use getScalarType for the scalar and vector case. Full diff: https://github.com/llvm/llvm-project/pull/174231.diff 3 Files Affected:
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
index f65f0e7ddbc98..a624f938e8564 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.h
@@ -681,9 +681,6 @@ class TreePatternNode : public RefCountedBase<TreePatternNode> {
// Type accessors.
unsigned getNumTypes() const { return Types.size(); }
- ValueTypeByHwMode getType(unsigned ResNo) const {
- return Types[ResNo].getValueTypeByHwMode();
- }
const std::vector<TypeSetByHwMode> &getExtTypes() const { return Types; }
const TypeSetByHwMode &getExtType(unsigned ResNo) const {
return Types[ResNo];
diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp
index d7f21f1c4e7ef..381e857fca822 100644
--- a/llvm/utils/TableGen/FastISelEmitter.cpp
+++ b/llvm/utils/TableGen/FastISelEmitter.cpp
@@ -175,10 +175,8 @@ struct OperandsSignature {
// Emit the type check.
TreePattern *TP = PredFn.getOrigPatFragRecord();
- ValueTypeByHwMode VVT = TP->getTree(0)->getType(0);
- assert(VVT.isSimple() &&
- "Cannot use variable value types with fast isel");
- OS << LS << "VT == " << getEnumName(VVT.getSimple().SimpleTy) << " && ";
+ MVT VT = TP->getTree(0)->getSimpleType(0);
+ OS << LS << "VT == " << getEnumName(VT) << " && ";
OS << PredFn.getFnName() << "(imm" << Idx << ')';
}
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index bd79c423a00e2..84024ec086808 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -2412,11 +2412,9 @@ void GlobalISelEmitter::emitRunCustomAction(raw_ostream &OS) {
bool hasBFloatType(const TreePatternNode &Node) {
for (unsigned I = 0, E = Node.getNumTypes(); I < E; I++) {
- auto Ty = Node.getType(I);
- for (auto T : Ty)
- if (T.second == MVT::bf16 ||
- (T.second.isVector() && T.second.getScalarType() == MVT::bf16))
- return true;
+ MVT VT = Node.getSimpleType(I);
+ if (VT.getScalarType() == MVT::bf16)
+ return true;
}
for (const TreePatternNode &C : Node.children())
if (hasBFloatType(C))
|
s-barannikov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…llvm#174231) These were the only uses of getType. Both of these calls are after HwMode has been expanded so we can use getSimpleType like other code. Remove getType since it is now unused. While there, simplify the hasBFloatType to use getScalarType for the scalar and vector case.
These were the only uses of getType. Both of these calls are after HwMode has been expanded so we can use getSimpleType like other code.
Remove getType since it is now unused.
While there, simplify the hasBFloatType to use getScalarType for the scalar and vector case.