[PATCH] D80634: [SVE] Fix warnings in SelectInst::areInvalidOperands

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 00:30:32 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9c0ef044beb4: [SVE] Fix warnings in SelectInst::areInvalidOperands (authored by david-arm).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80634/new/

https://reviews.llvm.org/D80634

Files:
  llvm/lib/IR/Instructions.cpp
  llvm/test/CodeGen/AArch64/sve-bad-select.ll


Index: llvm/test/CodeGen/AArch64/sve-bad-select.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-bad-select.ll
@@ -0,0 +1,10 @@
+; RUN: not llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s 2>&1 | FileCheck %s
+
+define <vscale x 16 x i8> @badsel1_nxv16i8(<16 x i1> %p,
+                                           <vscale x 16 x i8> %dst,
+                                           <vscale x 16 x i8> %a) {
+  %sel = select <16 x i1> %p, <vscale x 16 x i8> %a, <vscale x 16 x i8> %dst
+  ret <vscale x 16 x i8> %sel
+}
+
+; CHECK: error: vector select requires selected vectors to have the same vector length as select condition
Index: llvm/lib/IR/Instructions.cpp
===================================================================
--- llvm/lib/IR/Instructions.cpp
+++ llvm/lib/IR/Instructions.cpp
@@ -81,7 +81,7 @@
     VectorType *ET = dyn_cast<VectorType>(Op1->getType());
     if (!ET)
       return "selected values for vector select must be vectors";
-    if (ET->getNumElements() != VT->getNumElements())
+    if (ET->getElementCount() != VT->getElementCount())
       return "vector select requires selected vectors to have "
                    "the same vector length as select condition";
   } else if (Op0->getType() != Type::getInt1Ty(Op0->getContext())) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80634.267134.patch
Type: text/x-patch
Size: 1340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200529/4a7793f6/attachment.bin>


More information about the llvm-commits mailing list