This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Rewrite and simplify helper function. NFC.
ClosedPublic

Authored by frasercrmck on Dec 27 2020, 11:58 PM.

Diff Detail

Event Timeline

frasercrmck created this revision.Dec 27 2020, 11:58 PM
frasercrmck requested review of this revision.Dec 27 2020, 11:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 27 2020, 11:58 PM
luismarques accepted this revision.Dec 28 2020, 9:18 AM

LGTM.

(Now, that C++ has lambdas, etc, I wonder if using a standard find algorithm would be even simpler/cleaner?)

This revision is now accepted and ready to land.Dec 28 2020, 9:18 AM

(Now, that C++ has lambdas, etc, I wonder if using a standard find algorithm would be even simpler/cleaner?)

I played around with it but couldn't find a use of find_if which worked with enumerate that I was happier with. You still have to grab iterators, check against end and deref to return the index so imho it's not much clearer to read. Plus I got a bit scared about whether enumerate is to be stable when called twice on the same range: once for find_if and once for end..

This revision was automatically updated to reflect the committed changes.