This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Fix verifier error with kill intrinsic
ClosedPublic

Authored by arsenm on Jul 6 2016, 10:33 AM.

Details

Summary

Don't create a terminator in the middle of the block.
We should probably get rid of this intrinsic.

Diff Detail

Event Timeline

arsenm updated this revision to Diff 62909.Jul 6 2016, 10:33 AM
arsenm retitled this revision from to AMDGPU: Fix verifier error with kill intrinsic.
arsenm updated this object.
arsenm added a subscriber: llvm-commits.
arsenm updated this revision to Diff 63016.Jul 6 2016, 7:27 PM

Use custom inserter to make sure kill is a terminator instruction so the post-RA pass doesn't need to worry about splitting the block

nhaehnle edited edge metadata.Jul 7 2016, 9:16 AM

I haven't looked at the changes in detail yet, but I'm fine with the general approach.

The reference to SI_KILL in SIWholeQuadMode should probably be removed with this change.

arsenm updated this revision to Diff 63089.Jul 7 2016, 10:09 AM
arsenm edited edge metadata.

Stop checking SI_KILL in SIWholeQuadMode

nhaehnle accepted this revision.Jul 9 2016, 10:09 AM
nhaehnle edited edge metadata.

Some small remarks, apart from that LGTM.

lib/Target/AMDGPU/SILowerControlFlow.cpp
212

The function now logically operates on a block level, so I'd change it to take MBB as a parameter instead of MI.

217

I think the first argument to shouldSkip should be the successor MBB.

That said, shouldSkip itself is a bit broken as a heuristic since it doesn't seem to follow successors itself, so perhaps it makes sense to fix this separately.

235

The SkipBB shouldn't have any successors, should it?

This revision is now accepted and ready to land.Jul 9 2016, 10:09 AM
arsenm closed this revision.Jul 12 2016, 12:14 PM

r275203

lib/Target/AMDGPU/SILowerControlFlow.cpp
217

Yes, shouldSkip makes no sense as it is. I'm working on shouldSkip separately, moving it to a separate pass so this will all be changing anyway

235

I was treating it as a fall through block but I guess it shouldn't need it