Hi all,
I noticed that the static functions "positiveOffsetOpcode", "negativeOffsetOpcode" and
"ImmediateOffsetOpcode" (lib/Target/ARM/Thumb2InstrInfo.cpp) may return "0"
(PHI generic instruction) as default opcode.
Briefly. the static method is invoked during re-writing of frame indeces
(Prologue/Epilogue emission phase), and is used to determine the right load/store
instruction to handle the offset. This is done via switch statement in the
"XXXOffsetOpcode" static functions.
However, if none of the cases in the "switch" match, the default
opcode is 0; that is, the generic PHI instruction.
PHI instructions do not make sense in the Prologue/Epilogue emission
phase, and I think it would be more appropriate to default the "switch" to a
"llvm_unreachable" statement.
Best regards,
Lorenzo
Could you move the default case at the end of the switch statement? This makes it easier to follow the control-flow.
And please remove the exclamation mark !.