From e68e4cbcc50ba7ab8df5e09023f15e6cc2223bef Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 13 Jan 2020 15:32:45 -0800 Subject: [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 --- llvm/lib/CodeGen/MachineOperand.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib/CodeGen/MachineOperand.cpp') diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index 0ea495b..7b8f011 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -930,13 +930,13 @@ void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST, } case MachineOperand::MO_ShuffleMask: OS << "shufflemask("; - const Constant* C = getShuffleMask(); - const int NumElts = C->getType()->getVectorNumElements(); - + ArrayRef Mask = getShuffleMask(); StringRef Separator; - for (int I = 0; I != NumElts; ++I) { - OS << Separator; - C->getAggregateElement(I)->printAsOperand(OS, false, MST); + for (int Elt : Mask) { + if (Elt == -1) + OS << Separator << "undef"; + else + OS << Separator << Elt; Separator = ", "; } -- cgit v1.1