[llvm] r305226 - Remove unneeded conditionals - the code is already conditional on the same condition

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 08:23:05 PDT 2017


Good call - r305919

On Wed, Jun 21, 2017 at 12:04 AM Justin Bogner <mail at justinbogner.com>
wrote:

> David Blaikie via llvm-commits <llvm-commits at lists.llvm.org> writes:
> > Author: dblaikie
> > Date: Mon Jun 12 15:09:53 2017
> > New Revision: 305226
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=305226&view=rev
> > Log:
> > Remove unneeded conditionals - the code is already conditional on the
> > same condition
> >
> > Modified:
> >     llvm/trunk/tools/llvm-stress/llvm-stress.cpp
> >
> > Modified: llvm/trunk/tools/llvm-stress/llvm-stress.cpp
> > URL:
> >
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-stress/llvm-stress.cpp?rev=305226&r1=305225&r2=305226&view=diff
> >
> ==============================================================================
> >
> > --- llvm/trunk/tools/llvm-stress/llvm-stress.cpp (original)
> > +++ llvm/trunk/tools/llvm-stress/llvm-stress.cpp Mon Jun 12 15:09:53 2017
> > @@ -405,17 +405,15 @@ struct ConstModifier: public Modifier {
> >
> >      if (Ty->isIntegerTy()) {
> >        switch (Ran->Rand() % 7) {
> > -      case 0: if (Ty->isIntegerTy())
> > -                return PT->push_back(ConstantInt::get(Ty,
> > -
> APInt::getAllOnesValue(Ty->getPrimitiveSizeInBits())));
> > -              llvm_unreachable("Unexpected state");
> > -      case 1: if (Ty->isIntegerTy())
> > -                return PT->push_back(ConstantInt::get(Ty,
> > -                  APInt::getNullValue(Ty->getPrimitiveSizeInBits())));
> > -              llvm_unreachable("Unexpected state");
> > +      case 0:
> > +        return PT->push_back(ConstantInt::get(
> > +            Ty, APInt::getAllOnesValue(Ty->getPrimitiveSizeInBits())));
> > +      case 1:
> > +        return PT->push_back(ConstantInt::get(
> > +            Ty, APInt::getNullValue(Ty->getPrimitiveSizeInBits())));
> >        case 2: case 3: case 4: case 5:
> > -      case 6: if (Ty->isIntegerTy())
> > -                PT->push_back(ConstantInt::get(Ty, Ran->Rand()));
> > +      case 6:
>
> Might be worth clang-formatting while you're here. It's really odd that
> 2-5 are all on a line together but 6 is on its own.
>
> > +        PT->push_back(ConstantInt::get(Ty, Ran->Rand()));
> >        }
> >      }
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170621/c61cf716/attachment.html>


More information about the llvm-commits mailing list