[libcxx] [flang] [clang] [llvm] [libc] [compiler-rt] [lld] Fix ISel crash when lowering BUILD_VECTOR (PR #73186)

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 24 08:21:31 PST 2023


================
@@ -881,6 +881,23 @@ static bool isEndbrImm64(uint64_t Imm) {
   return false;
 }
 
+static bool needBWI(MVT VT) {
+  return (VT == MVT::v32i16 || VT == MVT::v32f16 || VT == MVT::v64i8);
+}
+
+static MVT getNarrowType(MVT VT) {
+  if (VT == MVT::v32i16)
+    return MVT::v16i16;
+  if (VT == MVT::v32f16)
+    return MVT::v16f16;
+  assert(VT == MVT::v64i8 && "Unexpected VT");
+  return MVT::v32i8;
+}
----------------
RKSimon wrote:

This can be done with:
```c
assert(needBWI(VT) && "Unexpected VT");
return VT.getHalfNumVectorElementsVT();
```
or we can just use getHalfNumVectorElementsVT directly and avoid the getNarrowType helper

https://github.com/llvm/llvm-project/pull/73186


More information about the cfe-commits mailing list