Page MenuHomePhabricator

AMDGPU: Consistently check for immediates in SIInstrInfo::FoldImmediate

Authored by nhaehnle on Nov 22 2017, 4:20 AM.



The PeepholeOptimizer pass calls this function solely based on checking
DefMI->isMoveImmediate(), which only checks the MoveImm bit of the
instruction description. So it's up to FoldImmediate itself to properly
check that DefMI *actually* moves from an immediate.

I don't have a separate test case for this, but the next patch introduces
a test case which happens to crash without this change.

This error is caught by the assertion in MachineOperand::getImm().

Change-Id: I88e7cdbcf54d75e1a296822e6fe5f9a5f095bbf8

Diff Detail


Event Timeline

nhaehnle created this revision.Nov 22 2017, 4:20 AM
This revision is now accepted and ready to land.Nov 22 2017, 11:05 AM
This revision was automatically updated to reflect the committed changes.