[llvm] 10045cb - Revert "[BitcodeReader] Fix DelayedShuffle handling for ConstantExpr shuffles."
Mitch Phillips via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 14:41:17 PDT 2020
Author: Mitch Phillips
Date: 2020-06-24T14:40:45-07:00
New Revision: 10045cbe01928d9281723c640c03984d540f9012
URL: https://github.com/llvm/llvm-project/commit/10045cbe01928d9281723c640c03984d540f9012
DIFF: https://github.com/llvm/llvm-project/commit/10045cbe01928d9281723c640c03984d540f9012.diff
LOG: Revert "[BitcodeReader] Fix DelayedShuffle handling for ConstantExpr shuffles."
Patch has a memory leak bug that broke the ASan buildbots. More info
available at: https://reviews.llvm.org/D80330
This reverts commit b5740105d270a2d76da8812cafb63e4b799ada73.
Added:
Modified:
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Removed:
llvm/test/Bitcode/vscale-shuffle.ll
################################################################################
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 1ee9f7b7a50c..a428416244f9 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2337,7 +2337,6 @@ Error BitcodeReader::parseConstants() {
uint64_t Op0Idx;
uint64_t Op1Idx;
uint64_t Op2Idx;
- unsigned CstNo;
};
std::vector<DelayedShufTy> DelayedShuffles;
while (true) {
@@ -2351,6 +2350,9 @@ Error BitcodeReader::parseConstants() {
case BitstreamEntry::Error:
return error("Malformed block");
case BitstreamEntry::EndBlock:
+ if (NextCstNo != ValueList.size())
+ return error("Invalid constant reference");
+
// Once all the constants have been read, go through and resolve forward
// references.
//
@@ -2363,7 +2365,6 @@ Error BitcodeReader::parseConstants() {
uint64_t Op0Idx = DelayedShuffle.Op0Idx;
uint64_t Op1Idx = DelayedShuffle.Op1Idx;
uint64_t Op2Idx = DelayedShuffle.Op2Idx;
- uint64_t CstNo = DelayedShuffle.CstNo;
Constant *Op0 = ValueList.getConstantFwdRef(Op0Idx, OpTy);
Constant *Op1 = ValueList.getConstantFwdRef(Op1Idx, OpTy);
Type *ShufTy =
@@ -2374,12 +2375,9 @@ Error BitcodeReader::parseConstants() {
SmallVector<int, 16> Mask;
ShuffleVectorInst::getShuffleMask(Op2, Mask);
Value *V = ConstantExpr::getShuffleVector(Op0, Op1, Mask);
- ValueList.assignValue(V, CstNo, DelayedShuffle.CurFullTy);
+ ValueList.assignValue(V, NextCstNo, DelayedShuffle.CurFullTy);
+ ++NextCstNo;
}
-
- if (NextCstNo != ValueList.size())
- return error("Invalid constant reference");
-
ValueList.resolveConstantForwardRefs();
return Error::success();
case BitstreamEntry::Record:
@@ -2735,8 +2733,7 @@ Error BitcodeReader::parseConstants() {
if (Record.size() < 3 || !OpTy)
return error("Invalid record");
DelayedShuffles.push_back(
- {OpTy, OpTy, CurFullTy, Record[0], Record[1], Record[2], NextCstNo});
- ++NextCstNo;
+ {OpTy, OpTy, CurFullTy, Record[0], Record[1], Record[2]});
continue;
}
case bitc::CST_CODE_CE_SHUFVEC_EX: { // [opty, opval, opval, opval]
@@ -2746,8 +2743,7 @@ Error BitcodeReader::parseConstants() {
if (Record.size() < 4 || !RTy || !OpTy)
return error("Invalid record");
DelayedShuffles.push_back(
- {OpTy, RTy, CurFullTy, Record[1], Record[2], Record[3], NextCstNo});
- ++NextCstNo;
+ {OpTy, RTy, CurFullTy, Record[1], Record[2], Record[3]});
continue;
}
case bitc::CST_CODE_CE_CMP: { // CE_CMP: [opty, opval, opval, pred]
diff --git a/llvm/test/Bitcode/vscale-shuffle.ll b/llvm/test/Bitcode/vscale-shuffle.ll
deleted file mode 100644
index 3f36209c7aaf..000000000000
--- a/llvm/test/Bitcode/vscale-shuffle.ll
+++ /dev/null
@@ -1,10 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis -disable-output
-; RUN: verify-uselistorder < %s
-
-define void @f() {
- %l = call <vscale x 16 x i8> @l(<vscale x 16 x i1> shufflevector (<vscale x 16 x i1> insertelement (<vscale x 16 x i1> undef, i1 true, i32 0), <vscale x 16 x i1> undef, <vscale x 16 x i32> zeroinitializer))
- %i = add <vscale x 2 x i64> undef, shufflevector (<vscale x 2 x i64> insertelement (<vscale x 2 x i64> undef, i64 1, i32 0), <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer)
- unreachable
-}
-
-declare <vscale x 16 x i8> @l(<vscale x 16 x i1>)
More information about the llvm-commits
mailing list