[PATCH] D50426: [NFC][MustExecute] Rework API to start making better analysis
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 14 00:47:22 PDT 2018
mkazantsev added inline comments.
================
Comment at: lib/Analysis/MustExecute.cpp:29
+ assert(CurLoop && "Should calculate the info first!");
+ assert(CurLoop->getHeader() == BB && "Currently we only support header!");
+ return HeaderMayThrow;
----------------
reames wrote:
> mkazantsev wrote:
> > reames wrote:
> > > Bad API. A better adapter implementation:
> > > if (getHeader() == BB)
> > > return HeaderMayThrow;
> > > else
> > > return MayThrow;
> > What you suggested contradicts the method's specification. It is not supposed to give false-positive answers.
> Er, I disagree. "may" always allows a conservative answer.
>
> A valid answer to the question "may X happen"? Is *always* yes.
>
> (To avoid confusion: this is not normal english usage, it is specifically jargon used within the compiler field. "may" and "must" have very specific meaning. For examples, see may alias and must alias)
I would agree if there was no context. But this method has a comment which clearly states what it returns.
https://reviews.llvm.org/D50426
More information about the llvm-commits
mailing list