1. Dec 30, 2019
    • Fangrui Song's avatar
      [ELF][PPC64] Improve "call lacks nop" diagnostic and make it compatible with GCC<5.5 and GCC<6.4 · bb87364f
      Fangrui Song authored
      GCC before r245813 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79439)
      did not emit nop after b/bl. This can happen with recursive calls.
      r245813 was back ported to GCC 5.5 and GCC 6.4.
      
      This is common, for example, libstdc++.a(locale.o) shipped with GCC 4.9
      and many objects in netlib lapack can cause lld to error.  gold allows
      such calls to the same section. Our __plt_foo symbol's `section` field
      is used for ThunkSection, so we can't implement a similar loosen rule
      easily. But we can make use of its `file` field which is currently NULL.
      
      Differential Revision: https://reviews.llvm.org/D71639
      bb87364f
    • Fangrui Song's avatar
      [ELF][PPC32] Implement IPLT code sequence for non-preemptible IFUNC · fb2944bd
      Fangrui Song authored
      Similar to D71509 (EM_PPC64), on EM_PPC, the IPLT code sequence should
      be similar to a PLT call stub. Unlike EM_PPC64, EM_PPC -msecure-plt has
      small/large PIC model differences.
      
      * -fpic/-fpie: R_PPC_PLTREL24 r_addend=0.  The call stub loads an address relative to `_GLOBAL_OFFSET_TABLE_`.
      * -fPIC/-fPIE: R_PPC_PLTREL24 r_addend=0x8000. (A partial linked object
        file may have an addend larger than 0x8000.) The call stub loads an address relative to .got2+0x8000.
      
      Just assume large PIC model for now. This patch makes:
      
        // clang -fuse-ld=lld -msecure-plt -fno-pie -no-pie a.c
        // clang -fuse-ld=lld -msecure-plt -fPIE -pie a.c
        #include <stdio.h>
        static void impl(void) { puts("meow"); }
        void thefunc(void) __attribute__((ifunc("resolver")));
        void *resolver(void) { return &impl; }
        int main(void) {
          thefunc();
          void (*theptr)(void) = &thefunc;
          theptr();
        }
      
      work on Linux glibc. -fpie will crash because the compiler and the
      linker do not agree on the value which r30 stores (_GLOBAL_OFFSET_TABLE_
      vs .got2+0x8000).
      
      Differential Revision: https://reviews.llvm.org/D71621
      fb2944bd
    • Fangrui Song's avatar
      [ELF][PPC64] Implement IPLT code sequence for non-preemptible IFUNC · 45acc35a
      Fangrui Song authored
      Non-preemptible IFUNC are placed in in.iplt (.glink on EM_PPC64).  If
      there is a non-GOT non-PLT relocation, for pointer equality, we change
      the type of the symbol from STT_IFUNC and STT_FUNC and bind it to the
      .glink entry.
      
      On EM_386, EM_X86_64, EM_ARM, and EM_AARCH64, the PLT code sequence
      loads the address from its associated .got.plt slot. An IPLT also has an
      associated .got.plt slot and can use the same code sequence.
      
      On EM_PPC64, the PLT code sequence is actually a bl instruction in
      .glink .  It jumps to `__glink_PLTresolve` (the PLT header). and
      `__glink_PLTresolve` computes the .plt slot (relocated by
      R_PPC64_JUMP_SLOT).
      
      An IPLT does not have an associated R_PPC64_JUMP_SLOT, so we cannot use
      `bl` in .iplt . Instead, create a call stub which has a similar code
      sequence as PPC64PltCallStub. We don't save the TOC pointer, so such
      scenarios will not work: a function pointer to a non-preemptible ifunc,
      which resolves to a function defined in another DSO. This is the
      restriction described by https://sourceware.org/glibc/wiki/GNU_IFUNC
      (though on many architectures it works in practice):
      
        Requirement (a): Resolver must be defined in the same translation unit as the implementations.
      
      If an ifunc is taken address but not called, technically we don't need
      an entry for it, but we currently do that.
      
      This patch makes
      
        // clang -fuse-ld=lld -fno-pie -no-pie a.c
        // clang -fuse-ld=lld -fPIE -pie a.c
        #include <stdio.h>
        static void impl(void) { puts("meow"); }
        void thefunc(void) __attribute__((ifunc("resolver")));
        void *resolver(void) { return &impl; }
        int main(void) {
          thefunc();
          void (*theptr)(void) = &thefunc;
          theptr();
        }
      
      work on Linux glibc and FreeBSD. Calling a function pointer pointing to
      a Non-preemptible IFUNC never worked before.
      
      Differential Revision: https://reviews.llvm.org/D71509
      45acc35a
    • Fangrui Song's avatar
      [SelectionDAT] Simplify SelectionDAGBuilder::visitInlineAsm · 6f9b4c68
      Fangrui Song authored
      Indirect C_Immediate or C_Other constraints have been excluded.
      
      Also simplify an unneeded change to indirect 'X' by D60942.
      6f9b4c68
    • Vladimir Vereschaka's avatar
      [CMake] Added remote test execution support into CrossWinToARMLinux CMake cache file. · eadc97b0
      Vladimir Vereschaka authored
      Added two confguration argument to provide a host name and SSH user name
      to run the tests on the remote target host.
      
      * REMOTE_TEST_HOST  - remote host name or address.
      * REMOTE_TEST_USER  - passwordless SSH account name.
      
      Differential Revision: https://reviews.llvm.org/D71625
      eadc97b0
    • QingShan Zhang's avatar
      [PowerPC] Exploit the rlwinm instructions for "and" with constant · 874a8004
      QingShan Zhang authored
      For now, PowerPC will using several instructions to get the constant and "and" it with the following case:
      
      define i32 @test1(i32 %a) {
        %and = and i32 %a, -2
        ret i32 %and
      }
      
      However, we could exploit it with the rotate mask instructions.
                     MB  ME
      +----------------------+
      |xxxxxxxxxxx00011111000|
      +----------------------+
       0         32         64
      Notice that, we can only do it if the MB is larger than 32 and MB <= ME as
      RLWINM will replace the content of [0 - 32) with [32 - 64) even we didn't rotate it.
      
      Differential Revision: https://reviews.llvm.org/D71829
      874a8004
    • Craig Topper's avatar
      [X86] Use APInt::isOneValue and ConstantSDNode::isOne. NFC · 266cd771
      Craig Topper authored
      These are implemented slightly more efficiently than comparing
      to 1 in the case that the value is more than 64 bits.
      266cd771
    • Craig Topper's avatar
      b2f19320
    • Craig Topper's avatar
      [X86] Remove dyn_casts to ConstantSDNode for operand 1 of... · 599d0709
      Craig Topper authored
      [X86] Remove dyn_casts to ConstantSDNode for operand 1 of X86ISD::VSRLI/VSRAI/VSRLI. Use getConstantOperandVal and APInt operations.
      
      These nodes should only ever be formed with an i8 TargetConstant
      so we don't need to check for it to be a constant. It's also
      always 8-bits so we don't need to use APInt compare functions.
      599d0709
    • Fangrui Song's avatar
      [SelectionDAG] Disallow indirect "i" constraint · 5edb40c0
      Fangrui Song authored
      This allows us to delete InlineAsm::Constraint_i workarounds in
      SelectionDAGISel::SelectInlineAsmMemoryOperand overrides and
      TargetLowering::getInlineAsmMemConstraint overrides.
      
      They were introduced to X86 in r237517 to prevent crashes for
      constraints like "=*imr". They were later copied to other targets.
      5edb40c0
    • Raphael Isemann's avatar
      [lldb][NFC] Simplify ClangASTContext::GetTypeForDecl · b1fb07dd
      Raphael Isemann authored
      Also removes the GetASTContext call from this code.
      b1fb07dd
    • Raphael Isemann's avatar
      [lldb][NFC] Make integer types functions in ClangASTContext not static · 6991d572
      Raphael Isemann authored
      These functions need a ClangASTContext instance that we would otherwise
      recalculate by calling GetASTContext (which is no longer necessary with
      this patch).
      6991d572
    • Stephen Kelly's avatar
      Fix formatting in previous commits · f7d9584c
      Stephen Kelly authored
      f7d9584c
    • Raphael Isemann's avatar
      [lldb][NFC] Delete static versions of ClangASTContext::CreateFunctionType · 0007f9da
      Raphael Isemann authored
      We can always call the member function version of this function.
      0007f9da
    • Craig Topper's avatar
      [X86] Make the AVX1 check lines in vec-strict-inttofp-256.ll test 'avx'... · c926d96f
      Craig Topper authored
      [X86] Make the AVX1 check lines in vec-strict-inttofp-256.ll test 'avx' instead of 'avx2'. Add AVX2 checks. NFC
      c926d96f
    • Kern Handa's avatar
      [mlir] Update mlir/CMakeLists.txt to install *.td files · cde071c4
      Kern Handa authored
      Currently when you build the `install` target, TableGen files don't get
      installed.
      
      TableGen files are needed when authoring new MLIR dialects, but right
      now they're missing when using the pre-built binaries.
      
      Differential Revision: https://reviews.llvm.org/D71958
      cde071c4
  2. Dec 29, 2019
  3. Dec 28, 2019