[llvm] 563e302 - [X86] Fix -Wstring-conversion in X86InstrInfo.cpp (NFC)

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 04:37:32 PDT 2023


On Thu, Apr 27, 2023 at 5:54 AM Jie Fu via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Jie Fu
> Date: 2023-04-27T17:52:57+08:00
> New Revision: 563e3028c90fda3d2db6103d75b29d35520abfc6
>
> URL: https://github.com/llvm/llvm-project/commit/563e3028c90fda3d2db6103d75b29d35520abfc6
> DIFF: https://github.com/llvm/llvm-project/commit/563e3028c90fda3d2db6103d75b29d35520abfc6.diff
>
> LOG: [X86] Fix -Wstring-conversion in X86InstrInfo.cpp (NFC)
>
> /Users/jiefu/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp:9794:12: error: implicit conversion turns string literal into bool: 'const char[25]' to 'bool' [-Werror,-Wstring-conversion]
>     assert("It should not reach here");
>     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> /Applications/Xcode13.1/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert'
>     (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0)
>                       ~ ^
> 1 error generated.
>
> Added:
>
>
> Modified:
>     llvm/lib/Target/X86/X86InstrInfo.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
> index c499410928cb..aa823e6e7d4c 100644
> --- a/llvm/lib/Target/X86/X86InstrInfo.cpp
> +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
> @@ -9791,7 +9791,7 @@ genAlternativeDpCodeSequence(MachineInstr &Root, const TargetInstrInfo &TII,
>    unsigned MaddOpc = 0;
>    switch (Opc) {
>    default:
> -    assert("It should not reach here");
> +    assert(false && "It should not reach here");

FWIW, this is what llvm_unreachable is intended for.

~Aaron

>      break;
>    // vpdpwssd xmm2,xmm3,xmm1
>    // -->
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list