[PATCH] D23960: Avoid narrowing warnings in __bitset constructor

Dimitry Andric via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 2 13:56:12 PDT 2016


dim added a comment.

@mclow.lists, I tested code generation (on i386-freebsd) with this small sample program:

  #include <bitset>
  
  void f(const std::bitset<53>&);
  
  void g(void)
  {
    std::bitset<53> bs(0x1234567890abcdef);
    f(bs);
  }

The assembly doesn't change at all after this fix:

  g():                                  # @g()
          .cfi_startproc
  # BB#0:                                 # %entry
          pushl   %ebp
  .Ltmp0:
          .cfi_def_cfa_offset 8
  .Ltmp1:
          .cfi_offset %ebp, -8
          movl    %esp, %ebp
  .Ltmp2:
          .cfi_def_cfa_register %ebp
          andl    $-8, %esp
          subl    $16, %esp
          movl    $-1867788817, 8(%esp)   # imm = 0xFFFFFFFF90ABCDEF
          movl    $305419896, 12(%esp)    # imm = 0x12345678
          leal    8(%esp), %eax
          movl    %eax, (%esp)
          calll   f(std::__1::bitset<53u> const&)
          movl    %ebp, %esp
          popl    %ebp
          retl


https://reviews.llvm.org/D23960





More information about the cfe-commits mailing list