This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Check for implicit defs before constant folding instruction
ClosedPublic

Authored by arsenm on Aug 9 2023, 7:12 AM.

Details

Reviewers
jhuber6
Pierre-vh
rampitec
foad
cdevadas
Group Reviewers
Restricted Project
Summary

Can't delete the constant folded instruction if scc is used.

In the original testcase, an un-constant folded and made it all the
way to SIFoldOperands. I think this is because a urem with known
bounds emitted during memcpy lowering wasn't appropriately simplified
since it was emitted so late. We should probably try to avoid that in
the first place.

Many GlobalISel tests show regressions for two reasons. First, it's
not setting dead flags in some cases. The reason we care about the
dead flags is compensating for failure to constant fold common
operations in the first place.

Fixes #63986

Diff Detail

Event Timeline

arsenm created this revision.Aug 9 2023, 7:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 7:12 AM
arsenm requested review of this revision.Aug 9 2023, 7:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 7:12 AM
Herald added a subscriber: wdng. · View Herald Transcript
foad accepted this revision.Aug 11 2023, 6:57 AM

LGTM.

Many GlobalISel tests show regressions for two reasons. First, it's
not setting dead flags in some cases. The reason we care about the
dead flags is compensating for failure to constant fold common
operations in the first place.

Remove this.

This revision is now accepted and ready to land.Aug 11 2023, 6:57 AM