r210338 - Replacing r210333 with an improved solution; we should never reach this code with any other loop hint options.
David Blaikie
dblaikie at gmail.com
Fri Jun 6 08:20:54 PDT 2014
On Fri, Jun 6, 2014 at 8:01 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> Author: aaronballman
> Date: Fri Jun 6 10:01:47 2014
> New Revision: 210338
>
> URL: http://llvm.org/viewvc/llvm-project?rev=210338&view=rev
> Log:
> Replacing r210333 with an improved solution; we should never reach this code with any other loop hint options.
>
> Modified:
> cfe/trunk/lib/Sema/SemaStmtAttr.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaStmtAttr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAttr.cpp?rev=210338&r1=210337&r2=210338&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaStmtAttr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaStmtAttr.cpp Fri Jun 6 10:01:47 2014
> @@ -69,7 +69,7 @@ static Attr *handleLoopHintAttr(Sema &S,
> .Case("interleave_count", LoopHintAttr::InterleaveCount)
> .Default(LoopHintAttr::Vectorize);
>
> - int ValueInt = 0;
> + int ValueInt;
> if (Option == LoopHintAttr::Vectorize || Option == LoopHintAttr::Interleave) {
> if (!ValueInfo) {
> S.Diag(ValueLoc->Loc, diag::err_pragma_loop_invalid_keyword)
> @@ -102,7 +102,8 @@ static Attr *handleLoopHintAttr(Sema &S,
> << /*MissingValue=*/false << ValueInt;
> return nullptr;
> }
> - }
> + } else
> + llvm_unreachable("Unknown loop hint option");
Alternatively you could just make the previous "else if" an "else" and
assert the condition inside it? Not a big deal either way, though -
Clang should compile it to basically the same thing (a check at -O0,
optimized away above that)
>
> return LoopHintAttr::CreateImplicit(S.Context, Option, ValueInt,
> A.getRange());
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list