[llvm] r304340 - Added missing break; added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 4 00:39:25 PDT 2017


The second one here shouldn't have been a fallthrough. But the next case
has the same 'if' as the first so it will also not return. So it isn't
functionally wrong.

~Craig

On Wed, May 31, 2017 at 1:25 PM, Galina Kistanova via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: gkistanova
> Date: Wed May 31 15:25:13 2017
> New Revision: 304340
>
> URL: http://llvm.org/viewvc/llvm-project?rev=304340&view=rev
> Log:
> Added missing break; added LLVM_FALLTHROUGH to address warning: this
> statement may fall through. NFC.
>
> Modified:
>     llvm/trunk/lib/Analysis/ConstantFolding.cpp
>
> Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> Analysis/ConstantFolding.cpp?rev=304340&r1=304339&r2=304340&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
> +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed May 31 15:25:13 2017
> @@ -1739,6 +1739,7 @@ Constant *ConstantFoldScalarCall(StringR
>          if ((Name == "round" && TLI->has(LibFunc_round)) ||
>              (Name == "roundf" && TLI->has(LibFunc_roundf)))
>            return ConstantFoldFP(round, V, Ty);
> +        break;
>        case 's':
>          if ((Name == "sin" && TLI->has(LibFunc_sin)) ||
>              (Name == "sinf" && TLI->has(LibFunc_sinf)))
> @@ -1807,6 +1808,7 @@ Constant *ConstantFoldScalarCall(StringR
>                  dyn_cast_or_null<ConstantFP>(
> Op->getAggregateElement(0U)))
>            return ConstantFoldSSEConvertToInt(FPOp->getValueAPF(),
>                                               /*roundTowardZero=*/false,
> Ty);
> +        LLVM_FALLTHROUGH;
>        case Intrinsic::x86_sse_cvttss2si:
>        case Intrinsic::x86_sse_cvttss2si64:
>        case Intrinsic::x86_sse2_cvttsd2si:
>
>
> _______________________________________________
> 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/20170604/1e53a69f/attachment.html>


More information about the llvm-commits mailing list