This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Make infinite loop clear, NFC
ClosedPublic

Authored by dexonsmith on Jun 30 2016, 7:40 PM.

Details

Summary

Change a while loop that was checking for nullptr on an
iterator-to-pointer conversion to an infinite for loop. Now it's clear
that the condition doesn't terminate.

The only change in behaviour is if an invalid iterator (holding nullptr)
was passed into AMDGPUCFGStructurizer::reversePredicateSetter. There
are only two callers, and they both dereference the iterator before
sending it in, so rather than adding an early return to avoid the loop
I've just asserted (using a static_cast, to avoid an implicit conversion
to pointer).

Diff Detail

Event Timeline

dexonsmith updated this revision to Diff 62456.Jun 30 2016, 7:40 PM
dexonsmith retitled this revision from to AMDGPU: Make infinite loop clear, NFC.
dexonsmith updated this object.
dexonsmith added a reviewer: arsenm.
dexonsmith added a subscriber: llvm-commits.

Is this the right fix, or is the infinite loop accidental?

arsenm accepted this revision.Jul 8 2016, 12:01 PM
arsenm edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 8 2016, 12:01 PM

Committed in r274902. Thanks!

dexonsmith closed this revision.Jul 8 2016, 12:08 PM