This is an archive of the discontinued LLVM Phabricator instance.

Remove check for single use in ShrinkDemandedConstant
ClosedPublic

Authored by rampitec on Jan 7 2019, 1:12 PM.

Details

Summary

This removes check for single use from general ShrinkDemandedConstant
to the BE because of the AArch64 regression after D56289/rL350475.

After several hours of experiments I did not come up with a testcase
failing on any other targets if check is not performed.

Moreover, direct call to ShrinkDemandedConstant is not really needed
and superceed by SimplifyDemandedBits.

Diff Detail

Repository
rL LLVM

Event Timeline

rampitec created this revision.Jan 7 2019, 1:12 PM
fhahn added a comment.Jan 7 2019, 2:42 PM

Great thanks! IMO the caller of ShrinkDemandedConstant should make sure the demanded bits valid for all users, as the existing code in TargetLowering.cpp already should do.

fhahn accepted this revision.Jan 7 2019, 3:08 PM
fhahn added a reviewer: t.p.northover.

LGTM, thanks, but it would be good if someone more familiar with AMDGPU could also have a quick look.

This revision is now accepted and ready to land.Jan 7 2019, 3:08 PM

Doesn't SimplifyDemandedBits already call ShrinkDemandedConstant for AND/OR/XOR? And without an override of targetShrinkDemandedConstant, ShrinkDemandedConstant only works on those 3 nodes. So is an explicit call to ShrinkDemandedConstant even needed here?

arsenm requested changes to this revision.Jan 8 2019, 3:58 AM

Something seems wrong here. How/why is this valid on AArch64 in some situation? A test is really needed for whatever this regression is

This revision now requires changes to proceed.Jan 8 2019, 3:58 AM

Something seems wrong here. How/why is this valid on AArch64 in some situation? A test is really needed for whatever this regression is

AArch64 does not call this function directly. The common code does required checks. In fact if you look at rare uses of it in targets they are guarded by single use check. Anyway, I do not have these testcases.

Doesn't SimplifyDemandedBits already call ShrinkDemandedConstant for AND/OR/XOR? And without an override of targetShrinkDemandedConstant, ShrinkDemandedConstant only works on those 3 nodes. So is an explicit call to ShrinkDemandedConstant even needed here?

Good point. Turns out I can simply drop it.

rampitec updated this revision to Diff 180689.Jan 8 2019, 9:59 AM
rampitec retitled this revision from Check for single use in cvt_f32_ubyte combine instead of ShrinkDemandedConstant to Remove check for single use in ShrinkDemandedConstant.
rampitec edited the summary of this revision. (Show Details)

Removed call to ShrinkDemandedConstant completely.

arsenm accepted this revision.Jan 8 2019, 5:31 PM

LGTM

LGTM, thanks, but it would be good if someone more familiar with AMDGPU could also have a quick look.

Can you commit a regression testcase for this?

This revision is now accepted and ready to land.Jan 8 2019, 5:31 PM
This revision was automatically updated to reflect the committed changes.
fhahn added a comment.Jan 9 2019, 1:09 PM

LGTM

LGTM, thanks, but it would be good if someone more familiar with AMDGPU could also have a quick look.

Can you commit a regression testcase for this?

Thanks for the patch :) I've committed rL350684 with a test case where we have an op with multiple users and a constant can be shrunk.