[Mlir-commits] [mlir] 5d6b4aa - [mlir] Compare elements directly rather than creating pair first

Jacques Pienaar llvmlistbot at llvm.org
Wed Mar 24 14:39:41 PDT 2021


Author: Jacques Pienaar
Date: 2021-03-24T14:39:11-07:00
New Revision: 5d6b4aa80d6df62b924a12af030c5ded868ee4f1

URL: https://github.com/llvm/llvm-project/commit/5d6b4aa80d6df62b924a12af030c5ded868ee4f1
DIFF: https://github.com/llvm/llvm-project/commit/5d6b4aa80d6df62b924a12af030c5ded868ee4f1.diff

LOG: [mlir] Compare elements directly rather than creating pair first

This avoided some conversion overhead on a model in TypeUniquer when
converting from ArrayRef -> TypeRange.

Differential Revision: https://reviews.llvm.org/D99300

Added: 
    

Modified: 
    mlir/lib/IR/TypeDetail.h

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/TypeDetail.h b/mlir/lib/IR/TypeDetail.h
index 5240f766e61c..09bfbf0fcf37 100644
--- a/mlir/lib/IR/TypeDetail.h
+++ b/mlir/lib/IR/TypeDetail.h
@@ -62,7 +62,9 @@ struct FunctionTypeStorage : public TypeStorage {
   /// The hash key used for uniquing.
   using KeyTy = std::pair<TypeRange, TypeRange>;
   bool operator==(const KeyTy &key) const {
-    return key == KeyTy(getInputs(), getResults());
+    if (std::get<0>(key) == getInputs())
+      return std::get<1>(key) == getResults();
+    return false;
   }
 
   /// Construction.


        


More information about the Mlir-commits mailing list