This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] return Fail instead of SolfFail from addOperand()
ClosedPublic

Authored by rampitec on Nov 4 2019, 12:51 PM.

Details

Summary

addOperand() method of AMDGPU disassembler returns SoftFail
on error. All instances which may lead to that place are
an impossible encdoing, not something which is possible to
encode, but semantically incorrect as described for SoftFail.

Then tablegen generates a check of the following form:

if (Decode...(..) == MCDisassembler::Fail) { return MCDisassembler::Fail; }

Since we can only return Success and SoftFail that is dead
code as detected by the static code analyzer.

Solution: return Fail as it should be.

See https://bugs.llvm.org/show_bug.cgi?id=43886

Diff Detail

Event Timeline

rampitec created this revision.Nov 4 2019, 12:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2019, 12:51 PM
rampitec updated this revision to Diff 227769.Nov 4 2019, 1:13 PM

Added test. Current response to is crash.

rampitec added a reviewer: dp.Nov 4 2019, 3:46 PM
dp accepted this revision.Nov 5 2019, 2:45 AM

LGTM

This revision is now accepted and ready to land.Nov 5 2019, 2:45 AM
This revision was automatically updated to reflect the committed changes.