HomePhabricator

[DAGCombine] Fix unchecked calls to DAGCombiner::*ExtPromoteOperand

Description

[DAGCombine] Fix unchecked calls to DAGCombiner::*ExtPromoteOperand

Other calls to DAGCombiner::*PromoteOperand check the result, but here it could cause an assertion in getNode.
Falling back to any extend in this case instead of failing outright seems correct to me.

No test case because:
The failure was triggered by an out of tree backend. In order to trigger it, a backend would need to overload
TargetLowering::IsDesirableToPromoteOp to return true for a type for which ISD::SIGN_EXTEND_INREG is marked
illegal. In tree, only X86 overloads and sometimes returns true for MVT::i16 yet it marks
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i16 , Legal);.

Patch by Jacob Young!

Differential Revision: https://reviews.llvm.org/D33633