[llvm] r230169 - RewriteStatepointsForGC.cpp: Fix for -Asserts to mark isNullConstant() as LLVM_ATTRIBUTE_UNUSED. [-Wunused-function]

David Blaikie dblaikie at gmail.com
Sun Feb 22 15:39:35 PST 2015


On Sun, Feb 22, 2015 at 3:32 PM, NAKAMURA Takumi <geek4civic at gmail.com>
wrote:

> David, it'd be good idea to introduce the attribute to mark UNUSED
> only with -Asserts. Like "LLVM_ATTRIBUTE_USED_DEBUG"?
>

SGTM


>
> 2015-02-23 6:03 GMT+09:00 David Blaikie <dblaikie at gmail.com>:
> >
> >
> > On Sun, Feb 22, 2015 at 1:58 AM, NAKAMURA Takumi <geek4civic at gmail.com>
> > wrote:
> >>
> >> Author: chapuni
> >> Date: Sun Feb 22 03:58:19 2015
> >> New Revision: 230169
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=230169&view=rev
> >> Log:
> >> RewriteStatepointsForGC.cpp: Fix for -Asserts to mark isNullConstant()
> as
> >> LLVM_ATTRIBUTE_UNUSED. [-Wunused-function]
> >>
> >> Modified:
> >>     llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
> >>
> >> Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=230169&r1=230168&r2=230169&view=diff
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
> >> (original)
> >> +++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Sun Feb
> >> 22 03:58:19 2015
> >> @@ -300,7 +300,7 @@ analyzeParsePointLiveness(DominatorTree
> >>  }
> >>
> >>  /// True iff this value is the null pointer constant (of any pointer
> >> type)
> >> -static bool isNullConstant(Value *V) {
> >> +static bool LLVM_ATTRIBUTE_UNUSED isNullConstant(Value *V) {
> >
> >
> > I'm inclined to wrap such functions in 'ifndef NDEBUG' rather than use
> > LLVM_ATTRIBUTE_UNUSED to ensure that if this becomes unused in
> assertions,
> > we can remove it (rather than it lying around unused indefinitiely). How
> do
> > other people feel about this?
> >
> > Perhaps we could change LLVM_ATTRIBUTE_UNUSED to only expand to the
> > attribute in non-asserts builds so we'd still get the warning in an
> asserts
> > build that no longer called the function? (at which point maybe have a
> > different macro name for this purpose?)
> >
> >>
> >>    return isa<Constant>(V) && isa<PointerType>(V->getType()) &&
> >>           cast<Constant>(V)->isNullValue();
> >>  }
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150222/14d9db77/attachment.html>


More information about the llvm-commits mailing list