[llvm] r345878 - Annotate possibly unintended fallthroughs in Hexagon MC code, NFC

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 12:40:01 PDT 2018


Yeah, those should be breaks. This doesn't fail because the values of Ga 
and Gb always hit some "case", but the intent is that those are breaks, 
not fall-throughs.

Thanks for finding this!

-Krzysztof


On 11/1/2018 2:32 PM, Reid Kleckner via llvm-commits wrote:
> Author: rnk
> Date: Thu Nov  1 12:32:04 2018
> New Revision: 345878
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=345878&view=rev
> Log:
> Annotate possibly unintended fallthroughs in Hexagon MC code, NFC
> 
> Clang's -Wimplicit-fallthrough check fires on these switch cases. GCC
> does not warn when a case body that ends in a switch falls through to a
> case label of an outer switch.
> 
> It's not clear if these fall throughs are truly intended.  The Hexagon
> tests pass regardless of whether these case blocks fall through or
> break.
> 
> For now, I have applied the intended fallthrough annotation macro with a
> FIXME comment to unblock enabling the warning. I will send a follow-up
> patch that converts them to breaks to the Hexagon maintainers.
> 
> Modified:
>      llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp
> 
> Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp?rev=345878&r1=345877&r2=345878&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp (original)
> +++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCDuplexInfo.cpp Thu Nov  1 12:32:04 2018
> @@ -127,6 +127,7 @@ unsigned HexagonMCInstrInfo::iClassOfDup
>       case HexagonII::HSIG_A:
>         return 0x4;
>       }
> +    LLVM_FALLTHROUGH; // FIXME: Intentional?
>     case HexagonII::HSIG_L2:
>       switch (Gb) {
>       default:
> @@ -138,6 +139,7 @@ unsigned HexagonMCInstrInfo::iClassOfDup
>       case HexagonII::HSIG_A:
>         return 0x5;
>       }
> +    LLVM_FALLTHROUGH; // FIXME: Intentional?
>     case HexagonII::HSIG_S1:
>       switch (Gb) {
>       default:
> @@ -151,6 +153,7 @@ unsigned HexagonMCInstrInfo::iClassOfDup
>       case HexagonII::HSIG_A:
>         return 0x6;
>       }
> +    LLVM_FALLTHROUGH; // FIXME: Intentional?
>     case HexagonII::HSIG_S2:
>       switch (Gb) {
>       default:
> @@ -166,6 +169,7 @@ unsigned HexagonMCInstrInfo::iClassOfDup
>       case HexagonII::HSIG_A:
>         return 0x7;
>       }
> +    LLVM_FALLTHROUGH; // FIXME: Intentional?
>     case HexagonII::HSIG_A:
>       switch (Gb) {
>       default:
> @@ -173,11 +177,13 @@ unsigned HexagonMCInstrInfo::iClassOfDup
>       case HexagonII::HSIG_A:
>         return 0x3;
>       }
> +    LLVM_FALLTHROUGH; // FIXME: Intentional?
>     case HexagonII::HSIG_Compound:
>       switch (Gb) {
>       case HexagonII::HSIG_Compound:
>         return 0xFFFFFFFF;
>       }
> +    break;
>     }
>     return 0xFFFFFFFF;
>   }
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


More information about the llvm-commits mailing list