This is an archive of the discontinued LLVM Phabricator instance.

[PatternMatch][InstCombine] match a vector with constant expression element(s) as a constant expression
ClosedPublic

Authored by spatel on Jul 21 2022, 9:49 AM.

Details

Summary

The InstCombine test is reduced from issue #56601. Without the more liberal match for ConstantExpr, we try to rearrange constants in Negator forever.

Alternatively, we could adjust the definition of m_ImmConstant to be more conservative, but that's probably a larger patch, and I don't see any downside to changing m_ConstantExpr. We never capture and modify a ConstantExpr; transforms just want to avoid it.

Diff Detail

Event Timeline

spatel created this revision.Jul 21 2022, 9:49 AM
spatel requested review of this revision.Jul 21 2022, 9:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 9:49 AM
nikic accepted this revision.Jul 21 2022, 11:41 AM

LGTM. You can also drop an explicit contrainsConstantExpression() call in InstCombineCalls.

This revision is now accepted and ready to land.Jul 21 2022, 11:41 AM

LGTM. You can also drop an explicit contrainsConstantExpression() call in InstCombineCalls.

Thanks - will update with that change.

spatel updated this revision to Diff 446595.Jul 21 2022, 12:06 PM

Updated:
Drop an explicit call to containsConstantExpression() since the matcher covers it now.

This revision was landed with ongoing or failed builds.Jul 21 2022, 12:24 PM
This revision was automatically updated to reflect the committed changes.