diff options
| author | Eli Friedman <efriedma@quicinc.com> | 2020-01-13 15:32:45 -0800 |
|---|---|---|
| committer | Eli Friedman <efriedma@quicinc.com> | 2020-01-13 16:55:41 -0800 |
| commit | e68e4cbcc50ba7ab8df5e09023f15e6cc2223bef (patch) | |
| tree | c060df72c78b35ee0942dac9e9408add9fb55168 /llvm/lib/CodeGen/MIRParser | |
| parent | 989bed989a41732d1b70314bd9063ccd6e74fe5c (diff) | |
| download | bcm5719-llvm-e68e4cbcc50ba7ab8df5e09023f15e6cc2223bef.tar.gz bcm5719-llvm-e68e4cbcc50ba7ab8df5e09023f15e6cc2223bef.zip | |
[GlobalISel] Change representation of shuffle masks in MachineOperand.
We're planning to remove the shufflemask operand from ShuffleVectorInst
(D72467); fix GlobalISel so it doesn't depend on that Constant.
The change to prelegalizercombiner-shuffle-vector.mir happens because
the input contains a literal "-1" in the mask (so the parser/verifier
weren't really handling it properly). We now treat it as equivalent to
"undef" in all contexts.
Differential Revision: https://reviews.llvm.org/D72663
Diffstat (limited to 'llvm/lib/CodeGen/MIRParser')
| -rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index fbb834c4ceb..b72c830d8e2 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -2421,23 +2421,13 @@ bool MIParser::parseShuffleMaskOperand(MachineOperand &Dest) { if (expectAndConsume(MIToken::lparen)) return error("expected syntax shufflemask(<integer or undef>, ...)"); - SmallVector<Constant *, 32> ShufMask; - LLVMContext &Ctx = MF.getFunction().getContext(); - Type *I32Ty = Type::getInt32Ty(Ctx); - - bool AllZero = true; - bool AllUndef = true; - + SmallVector<int, 32> ShufMask; do { if (Token.is(MIToken::kw_undef)) { - ShufMask.push_back(UndefValue::get(I32Ty)); - AllZero = false; + ShufMask.push_back(-1); } else if (Token.is(MIToken::IntegerLiteral)) { - AllUndef = false; const APSInt &Int = Token.integerValue(); - if (!Int.isNullValue()) - AllZero = false; - ShufMask.push_back(ConstantInt::get(I32Ty, Int.getExtValue())); + ShufMask.push_back(Int.getExtValue()); } else return error("expected integer constant"); @@ -2447,13 +2437,8 @@ bool MIParser::parseShuffleMaskOperand(MachineOperand &Dest) { if (expectAndConsume(MIToken::rparen)) return error("shufflemask should be terminated by ')'."); - if (AllZero || AllUndef) { - VectorType *VT = VectorType::get(I32Ty, ShufMask.size()); - Constant *C = AllZero ? Constant::getNullValue(VT) : UndefValue::get(VT); - Dest = MachineOperand::CreateShuffleMask(C); - } else - Dest = MachineOperand::CreateShuffleMask(ConstantVector::get(ShufMask)); - + ArrayRef<int> MaskAlloc = MF.allocateShuffleMask(ShufMask); + Dest = MachineOperand::CreateShuffleMask(MaskAlloc); return false; } |

