This is an archive of the discontinued LLVM Phabricator instance.

[ARM CGP] Fix ConvertTruncs
ClosedPublic

Authored by samparker on Feb 4 2019, 6:30 AM.

Details

Summary

ConvertTruncs is used to replace a trunc for an AND mask, however this function wasn't working as expected. By performing the change later, we can create a wide type integer mask instead of a narrow -1 value, which could then be simply removed (incorrectly). Because we now perform this action later, it's necessary to cache the trunc type before we perform the promotion.

Diff Detail

Event Timeline

samparker created this revision.Feb 4 2019, 6:30 AM
SjoerdMeijer added inline comments.Feb 13 2019, 6:06 AM
test/CodeGen/ARM/CGP/arm-cgp-casts.ll
626

Looks like this isn't checked... that is, if I am not mistaken, the CHECK prefix doesn't occur in the run lines?

I was initially expecting something with an AND here, but the whole point of course is that this gets optimised away? So just nitpicking on this test then.... Perhaps a CHECK udiv, followed by CHECK-NEXT mls to make this explicit, and/or possibly a CHECK-NOT and?

samparker marked an inline comment as done.Feb 13 2019, 6:11 AM
samparker added inline comments.
test/CodeGen/ARM/CGP/arm-cgp-casts.ll
626

bloody hell, if only FileCheck could tell me when I've been a buffoon...

samparker updated this revision to Diff 186824.Feb 14 2019, 5:26 AM

Updated the test labels. The AND that is used to convert the trunc still becomes a uxtb, so we just need to check that there's one after the division.

SjoerdMeijer accepted this revision.Feb 14 2019, 5:45 AM

Thanks, LGTM

This revision is now accepted and ready to land.Feb 14 2019, 5:45 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2019, 1:04 AM