[llvm] 09fecbb - [TableGen] Simplify TypeInfer::expandOverloads. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 8 00:06:53 PDT 2023
Author: Craig Topper
Date: 2023-04-08T00:04:09-07:00
New Revision: 09fecbbf5409e321f5e45b8120c26b12b8b742e6
URL: https://github.com/llvm/llvm-project/commit/09fecbbf5409e321f5e45b8120c26b12b8b742e6
DIFF: https://github.com/llvm/llvm-project/commit/09fecbbf5409e321f5e45b8120c26b12b8b742e6.diff
LOG: [TableGen] Simplify TypeInfer::expandOverloads. NFC
Directly test the 5 overloaded types instead of doing extra
set creation and iteration.
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index a110497ed536..a781746cba0f 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -819,56 +819,41 @@ void TypeInfer::expandOverloads(TypeSetByHwMode &VTS) {
void TypeInfer::expandOverloads(TypeSetByHwMode::SetType &Out,
const TypeSetByHwMode::SetType &Legal) {
- std::set<MVT> Ovs;
- for (MVT T : Out) {
- if (!T.isOverloaded())
- continue;
-
- Ovs.insert(T);
- // MachineValueTypeSet allows iteration and erasing.
- Out.erase(T);
- }
-
- for (MVT Ov : Ovs) {
- switch (Ov.SimpleTy) {
- case MVT::iPTRAny:
- Out.insert(MVT::iPTR);
- return;
- case MVT::iAny:
- for (MVT T : MVT::integer_valuetypes())
- if (Legal.count(T))
- Out.insert(T);
- for (MVT T : MVT::integer_fixedlen_vector_valuetypes())
- if (Legal.count(T))
- Out.insert(T);
- for (MVT T : MVT::integer_scalable_vector_valuetypes())
- if (Legal.count(T))
- Out.insert(T);
- return;
- case MVT::fAny:
- for (MVT T : MVT::fp_valuetypes())
- if (Legal.count(T))
- Out.insert(T);
- for (MVT T : MVT::fp_fixedlen_vector_valuetypes())
- if (Legal.count(T))
- Out.insert(T);
- for (MVT T : MVT::fp_scalable_vector_valuetypes())
- if (Legal.count(T))
- Out.insert(T);
- return;
- case MVT::vAny:
- for (MVT T : MVT::vector_valuetypes())
- if (Legal.count(T))
- Out.insert(T);
- return;
- case MVT::Any:
- for (MVT T : MVT::all_valuetypes())
- if (Legal.count(T))
- Out.insert(T);
- return;
- default:
- break;
- }
+ if (Out.count(MVT::iPTRAny)) {
+ Out.erase(MVT::iPTRAny);
+ Out.insert(MVT::iPTR);
+ } else if (Out.count(MVT::iAny)) {
+ Out.erase(MVT::iAny);
+ for (MVT T : MVT::integer_valuetypes())
+ if (Legal.count(T))
+ Out.insert(T);
+ for (MVT T : MVT::integer_fixedlen_vector_valuetypes())
+ if (Legal.count(T))
+ Out.insert(T);
+ for (MVT T : MVT::integer_scalable_vector_valuetypes())
+ if (Legal.count(T))
+ Out.insert(T);
+ } else if (Out.count(MVT::fAny)) {
+ Out.erase(MVT::fAny);
+ for (MVT T : MVT::fp_valuetypes())
+ if (Legal.count(T))
+ Out.insert(T);
+ for (MVT T : MVT::fp_fixedlen_vector_valuetypes())
+ if (Legal.count(T))
+ Out.insert(T);
+ for (MVT T : MVT::fp_scalable_vector_valuetypes())
+ if (Legal.count(T))
+ Out.insert(T);
+ } else if (Out.count(MVT::vAny)) {
+ Out.erase(MVT::vAny);
+ for (MVT T : MVT::vector_valuetypes())
+ if (Legal.count(T))
+ Out.insert(T);
+ } else if (Out.count(MVT::Any)) {
+ Out.erase(MVT::Any);
+ for (MVT T : MVT::all_valuetypes())
+ if (Legal.count(T))
+ Out.insert(T);
}
}
More information about the llvm-commits
mailing list