From: Pete Couperus Date: Mon, 20 May 2019 18:09:37 +0000 (+0000) Subject: [TableGen] - Type comparison LE should be LT or equal. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=594d5b198e4b881dae6cc99c997ac3c87fd54fb9;p=llvm [TableGen] - Type comparison LE should be LT or equal. Differential Revision: https://reviews.llvm.org/D61705 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361183 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index 0b1687d3e92..4b491bf3c92 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -507,22 +507,14 @@ bool TypeInfer::EnforceSmallerThan(TypeSetByHwMode &Small, (A.getScalarSizeInBits() == B.getScalarSizeInBits() && A.getSizeInBits() < B.getSizeInBits()); }; - auto LE = [](MVT A, MVT B) -> bool { + auto LE = [<](MVT A, MVT B) -> bool { // This function is used when removing elements: when a vector is compared // to a non-vector, it should return false (to avoid removal). if (A.isVector() != B.isVector()) return false; - // Note on the < comparison below: - // X86 has patterns like - // (set VR128X:$dst, (v16i8 (X86vtrunc (v4i32 VR128X:$src1)))), - // where the truncated vector is given a type v16i8, while the source - // vector has type v4i32. They both have the same size in bits. - // The minimal type in the result is obviously v16i8, and when we remove - // all types from the source that are smaller-or-equal than v8i16, the - // only source type would also be removed (since it's equal in size). - return A.getScalarSizeInBits() <= B.getScalarSizeInBits() || - A.getSizeInBits() < B.getSizeInBits(); + return LT(A, B) || (A.getScalarSizeInBits() == B.getScalarSizeInBits() && + A.getSizeInBits() == B.getSizeInBits()); }; for (unsigned M : Modes) {