[llvm] 447dcef - Revert "[SVE] Pass Scalable argument to VectorType::get in Bitcode Reader"

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 12:14:35 PST 2020


Author: Eli Friedman
Date: 2020-01-17T12:13:49-08:00
New Revision: 447dcef79001ab5b842677bbada68624aa27e583

URL: https://github.com/llvm/llvm-project/commit/447dcef79001ab5b842677bbada68624aa27e583
DIFF: https://github.com/llvm/llvm-project/commit/447dcef79001ab5b842677bbada68624aa27e583.diff

LOG: Revert "[SVE] Pass Scalable argument to VectorType::get in Bitcode Reader"

This reverts commit 5df53a22592729e631c4030f38c599b9f37095b7.

Caused test failures.

Added: 
    

Modified: 
    llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Removed: 
    llvm/test/Bitcode/vscale-round-trip.ll


################################################################################
diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 1a5bd023947c..1eefb1b889ab 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2630,13 +2630,12 @@ Error BitcodeReader::parseConstants() {
 
       Type *SelectorTy = Type::getInt1Ty(Context);
 
-      // The selector might be an i1, an <n x i1>, or a <vscale x n x i1>
+      // The selector might be an i1 or an <n x i1>
       // Get the type from the ValueList before getting a forward ref.
       if (VectorType *VTy = dyn_cast<VectorType>(CurTy))
         if (Value *V = ValueList[Record[0]])
           if (SelectorTy != V->getType())
-            SelectorTy = VectorType::get(SelectorTy,
-                                         VTy->getElementCount());
+            SelectorTy = VectorType::get(SelectorTy, VTy->getNumElements());
 
       V = ConstantExpr::getSelect(ValueList.getConstantFwdRef(Record[0],
                                                               SelectorTy),
@@ -2694,7 +2693,7 @@ Error BitcodeReader::parseConstants() {
       Constant *Op0 = ValueList.getConstantFwdRef(Record[0], OpTy);
       Constant *Op1 = ValueList.getConstantFwdRef(Record[1], OpTy);
       Type *ShufTy = VectorType::get(Type::getInt32Ty(Context),
-                                     OpTy->getElementCount());
+                                                 OpTy->getNumElements());
       Constant *Op2 = ValueList.getConstantFwdRef(Record[2], ShufTy);
       V = ConstantExpr::getShuffleVector(Op0, Op1, Op2);
       break;
@@ -2708,7 +2707,7 @@ Error BitcodeReader::parseConstants() {
       Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy);
       Constant *Op1 = ValueList.getConstantFwdRef(Record[2], OpTy);
       Type *ShufTy = VectorType::get(Type::getInt32Ty(Context),
-                                     RTy->getElementCount());
+                                                 RTy->getNumElements());
       Constant *Op2 = ValueList.getConstantFwdRef(Record[3], ShufTy);
       V = ConstantExpr::getShuffleVector(Op0, Op1, Op2);
       break;
@@ -4169,15 +4168,9 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
         return error("Invalid record");
       if (!Vec1->getType()->isVectorTy() || !Vec2->getType()->isVectorTy())
         return error("Invalid type for value");
-
-      ElementCount EC1 = cast<VectorType>(Vec1->getType())->getElementCount();
-
-      if (EC1 != cast<VectorType>(Vec2->getType())->getElementCount())
-        return error("Mismatch between argument types");
-
       I = new ShuffleVectorInst(Vec1, Vec2, Mask);
       FullTy = VectorType::get(FullTy->getVectorElementType(),
-                               EC1);
+                               Mask->getType()->getVectorNumElements());
       InstructionList.push_back(I);
       break;
     }

diff  --git a/llvm/test/Bitcode/vscale-round-trip.ll b/llvm/test/Bitcode/vscale-round-trip.ll
deleted file mode 100644
index 22790179fc07..000000000000
--- a/llvm/test/Bitcode/vscale-round-trip.ll
+++ /dev/null
@@ -1,49 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis | FileCheck %s
-
-target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
-target triple = "aarch64"
-
- at important_val = extern_weak dso_local global i32, align 4
-
-; CHECK-LABEL: define <vscale x 4 x i32> @const_shufflevector(
-; CHECK: <vscale x 4 x i32> shufflevector (<vscale x 4 x i32>
-
-define <vscale x 4 x i32> @const_shufflevector() {
-  ret <vscale x 4 x i32> shufflevector (<vscale x 4 x i32> zeroinitializer,
-                                        <vscale x 4 x i32> undef,
-                                        <vscale x 4 x i32> zeroinitializer)
-}
-
-; CHECK-LABEL: define <vscale x 4 x i32> @const_shufflevector_ex()
-; CHECK: <vscale x 4 x i32> shufflevector (<vscale x 2 x i32>
-
-define <vscale x 4 x i32> @const_shufflevector_ex() {
-  ret <vscale x 4 x i32> shufflevector (<vscale x 2 x i32> zeroinitializer,
-                                        <vscale x 2 x i32> undef,
-                                        <vscale x 4 x i32> zeroinitializer)
-}
-
-; CHECK-LABEL: define <vscale x 4 x i32> @non_const_shufflevector(
-; CHECK: %res = shufflevector <vscale x 4 x i32>
-
-define <vscale x 4 x i32> @non_const_shufflevector(<vscale x 4 x i32> %lhs,
-                                                   <vscale x 4 x i32> %rhs) {
-  %res = shufflevector <vscale x 4 x i32> %lhs,
-                       <vscale x 4 x i32> %rhs,
-                       <vscale x 4 x i32> zeroinitializer
-
-  ret <vscale x 4 x i32> %res
-}
-
-; CHECK-LABEL: define <vscale x 4 x i32> @const_select()
-; CHECK: <vscale x 4 x i32> select (<vscale x 4 x i1>
-
-define <vscale x 4 x i32> @const_select() {
-  ret <vscale x 4 x i32> select
-    (<vscale x 4 x i1> insertelement
-      (<vscale x 4 x i1> undef,
-       i1 icmp ne (i32* @important_val, i32* null),
-       i32 0),
-     <vscale x 4 x i32> zeroinitializer,
-     <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i32 0))
-}


        


More information about the llvm-commits mailing list