1. Aug 20, 2019
  2. Aug 19, 2019
    • Fangrui Song's avatar
      [ELF] Simplify processRelocAux and allow a corner-case error · ec4540d8
      Fangrui Song authored
      After D66007/r369262, if the control flow reaches `if (sym.isUndefined())`, we know:
      
      * The relocation is not a link-time constant => symbol is preemptable => Undefined or SharedSymbol
      * Not an undef weak.
      * -no-pie.
      * The symbol type is neither STT_OBJECT nor STT_FUNC.
      
      ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o can satisfy
      these conditions. Delete the isUndefined() test so that we error
      `symbol '...' has no type`, because we don't know the type to make the
      decision to create copy relocation/canonical PLT.
      
      llvm-svn: 369271
      ec4540d8
    • Zoe Carver's avatar
      [libc++] reverts commit a5f5aad5. · 471bbb6e
      Zoe Carver authored
      The commit being reverted caused segfaults when building
      with libc++ and GCC (and possibly other configurations).
      
      Differential Revision: https://reviews.llvm.org/D62868
      
      llvm-svn: 369270
      471bbb6e
    • Pavel Labath's avatar
      Filesystem/Windows: fix inconsistency in readNativeFileSlice API · 08c77b97
      Pavel Labath authored
      Summary:
      The windows version implementation of readNativeFileSlice, was trying to
      match the POSIX behavior of not treating EOF as an error, but it was
      only handling the case of reading from a pipe. Attempting to read past
      the end of a regular file returns a slightly different error code, which
      needs to be handled too. This patch adds ERROR_HANDLE_EOF to the list of
      error codes to be treated as an end of file, and adds some unit tests
      for the API.
      
      This issue was found while attempting to land D66224, which caused a bunch of
      lldb tests to start failing on windows.
      
      Reviewers: rnk, aganea
      
      Subscribers: kristina, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66344
      
      llvm-svn: 369269
      08c77b97
    • Roman Lebedev's avatar
      [TargetLowering] x s% C == 0 fold: vector divisor with INT_MIN handling · edfaee08
      Roman Lebedev authored
      Summary:
      The general fold is only valid for positive divisors.
      Which effectively means, it is invalid for `INT_MIN` divisors,
      and we currently bailout if we see them.
      
      But that is too strict, we can just fix-up the results.
      For that, let's do a second computation 'in parallel':
      ```
      Name: srem -> and
      Pre: isPowerOf2(C)
      %o = srem i8 %X, C
      %r = icmp eq %o, 0
        =>
      %n = and i8 %X, C-1
      %r = icmp eq %n, 0
      ```
      https://rise4fun.com/Alive/Sup
      
      And then just blend results: if the divisor was `INT_MIN`,
      pick the value we got via bit-test,
      else pick the value from general fold.
      
      There's interesting observation - `ISD::ROTR` is set to
      `LegalizeAction::Expand` before AVX512, so we should not
      treat `INT_MIN` divisor as even; and as it can be seen
      while `@test_srem_odd_even_one` improves on all run-lines,
      `@test_srem_odd_even_INT_MIN` only improves for AVX512.
      
      Reviewers: RKSimon, craig.topper, spatel
      
      Reviewed By: RKSimon
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66300
      
      llvm-svn: 369268
      edfaee08
    • Raphael Isemann's avatar
      [lldb][NFC] Stop using GetNumberOfMatches in CompletionRequest test · 6632ad58
      Raphael Isemann authored
      This function is just a wrapper for GetNumberOfResults and will
      be removed soon. This patch just changes all calls to GetNumberOfResults
      where possible (which is currently just the unit test).
      
      llvm-svn: 369267
      6632ad58
    • Serge Guelton's avatar
      [nfc] Silent gcc warning · a023d6b7
      Serge Guelton authored
      llvm-svn: 369266
      a023d6b7
    • George Rimar's avatar
      [llvm-objdump] - Restore lost comment. · 42336682
      George Rimar authored
      It was removed by mistake in r369263 (D66417).
      
      llvm-svn: 369265
      42336682
    • Amaury Sechet's avatar
      Automatically generate AVX512 test cases. NFC · 81301541
      Amaury Sechet authored
      llvm-svn: 369264
      81301541
    • George Rimar's avatar
      [Object/COFF.h] - Stop returning std::error_code in a few methods. NFCI. · 9d5e8a47
      George Rimar authored
      There are 4 methods that return std::error_code now,
      though they do not have to because they are always succeed.
      I refactored them.
      
      This allows to simplify the code in tools a bit.
      
      llvm-svn: 369263
      9d5e8a47
    • Fangrui Song's avatar
      [ELF] Move (copy relocation/canonical PLT) before error checking · ac0e6c65
      Fangrui Song authored
      In processRelocAux(), we handle errors before copy relocation/canonical PLT.
      This makes error checking a bit complex because we have to check for
      conditions that will be allowed by copy relocation/canonical PLT.
      
      Instead, move copy relocation/canonical PLT before error checking. This
      simplifies the previous clumsy error checking code
      
      `config->shared || (config->pie && expr == R_ABS && type != target->symbolicRel)`
      
      to the simple `config->isPic`. Some diagnostics can be reported in
      different ways. The code motion changes diagnostics for some contrived
      test cases:
      
      * copy-rel-pie-error.s -> copy-rel-pie2.s:
        It was rejected before but accepted now. ld.bfd also accepts the case.
      * copy-errors.s: "cannot preempt symbol" changes to "symbol 'bar' has no type"
      * got32{,x}-i386.s: the suggestion changes from "-fPIC or -Wl,-z,notext" to "-fPIE"
      * x86-64-dyn-rel-error5.s: one diagnostic changes for -pie case
      
      Reviewed By: peter.smith
      
      Differential Revision: https://reviews.llvm.org/D66007
      
      llvm-svn: 369262
      ac0e6c65
    • Jinsong Ji's avatar
      [PeepholeOptimizer] Don't assume bitcast def always has input · 0776da52
      Jinsong Ji authored
      Summary:
      If we have a MI marked with bitcast bits, but without input operands,
      PeepholeOptimizer might crash with assert.
      
      eg:
      If we apply the changes in PPCInstrVSX.td as in this patch:
      
      [(set v4i32:$XT, (bitconvert (v16i8 immAllOnesV)))]>;
      
      We will get assert in PeepholeOptimizer.
      
      ```
      llvm-lit llvm-project/llvm/test/CodeGen/PowerPC/build-vector-tests.ll -v
      
      llvm-project/llvm/include/llvm/CodeGen/MachineInstr.h:417: const
      llvm::MachineOperand &llvm::MachineInstr::getOperand(unsigned int)
      const: Assertion `i < getNumOperands() && "getOperand() out of range!"'
      failed.
      ```
      
      The fix is to abort if we found out of bound access.
      
      Reviewers: qcolombet, MatzeB, hfinkel, arsenm
      
      Reviewed By: qcolombet
      
      Subscribers: wdng, arsenm, steven.zhang, wuzish, nemanjai, hiraditya, kbarton, MaskRay, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65542
      
      llvm-svn: 369261
      0776da52
    • Fangrui Song's avatar
      [ELF][Hexagon] Improve error message for unknown relocations · c8a1dfc4
      Fangrui Song authored
      Like rLLD354040
      
      Previously, for unknown relocation types, in -no-pie/-pie mode, we got something like:
      
          foo.o: unrecognized relocation ...
      
      In -shared mode:
      
          error: can't create dynamic relocation ... against symbol: yyy in readonly segment
      
      Delete the default case from Hexagon::getRelExpr and add the error there. We will get consistent error message like `error: unknown relocation (1024) against symbol foo`
      
      Reviewed By: sidneym
      
      Differential Revision: https://reviews.llvm.org/D66275
      
      llvm-svn: 369260
      c8a1dfc4
    • Aaron Ballman's avatar
      Don't keep stale pointers to LoopInfos. · b6ab533b
      Aaron Ballman authored
      CGLoopInfo was keeping pointers to parent loop LoopInfos, but when the loop info vector grew, it reallocated the storage and invalidated all of the parent pointers, causing use-after-free. Manage the lifetimes of the LoopInfos separately so that the pointers aren't stale.
      
      Patch by Bevin Hansson.
      
      llvm-svn: 369259
      b6ab533b
    • Sid Manning's avatar
      [lld][Hexagon] Add GOTREL relocations. · a0a4c6b7
      Sid Manning authored
      Add GOTREL relocation support. (S + A - GOT)
      
      Differential Revision: https://reviews.llvm.org/D66260
      
      llvm-svn: 369258
      a0a4c6b7
    • Alex Bradbury's avatar
      [RISCV] Don't force absolute FK_Data_X fixups to relocs · 1c1f8f21
      Alex Bradbury authored
      The current behavior of shouldForceRelocation forces relocations for the
      majority of fixups when relaxation is enabled. This makes sense for
      fixups which incorporate symbols but is unnecessary for simple data
      fixups where the fixup target is already resolved to an absolute value.
      
      Differential Revision: https://reviews.llvm.org/D63404
      Patch by Edward Jones.
      
      llvm-svn: 369257
      1c1f8f21
    • David Stenberg's avatar
      [DebugInfo] Allow bundled calls in the MIR's call site info · 88df53e6
      David Stenberg authored
      Summary:
      Extend the MIR parser and writer so that the call site information can
      refer to calls that are bundled.
      
      Reviewers: aprantl, asowda, NikolaPrica, djtodoro, ivanbaev, vsk
      
      Reviewed By: aprantl
      
      Subscribers: arsenm, hiraditya, llvm-commits
      
      Tags: #debug-info, #llvm
      
      Differential Revision: https://reviews.llvm.org/D66145
      
      llvm-svn: 369256
      88df53e6
    • Sanjay Patel's avatar
      [SLP] add test that requires shuffle of scalars; NFC · 0f9b5f86
      Sanjay Patel authored
      llvm-svn: 369255
      0f9b5f86
    • Fangrui Song's avatar
      6520ba3e
    • Sven van Haastregt's avatar
      [OpenCL] Add generic type handling for builtin functions · b21a3654
      Sven van Haastregt authored
      Generic types are an abstraction of type sets.  It mimics the way
      functions are defined in the OpenCL specification.  For example,
      floatN can abstract all the vector sizes of the float type.
      
      This allows to
       * stick more closely to the specification, which uses generic types;
       * factorize definitions of functions with numerous prototypes in the
         tablegen file; and
       * reduce the memory impact of functions with many overloads.
      
      Patch by Pierre Gondois and Sven van Haastregt.
      
      Differential Revision: https://reviews.llvm.org/D65456
      
      llvm-svn: 369253
      b21a3654
    • Raphael Isemann's avatar
      [lldb][NFC] Use CompletionRequest in Variable::AutoComplete · 06841321
      Raphael Isemann authored
      llvm-svn: 369252
      06841321
    • Anastasia Stulova's avatar
      [OpenCL] Fix addr space deduction for pointers/references to arrays. · eb801abd
      Anastasia Stulova authored
      Rewrite the logic for detecting if we are deducing addr space of
      a pointee type to take into account special logic for arrays. For
      pointers/references to arrays we can have any number of parentheses
      expressions as well as nested pointers.
      
      Differential Revision: https://reviews.llvm.org/D66137
      
      llvm-svn: 369251
      eb801abd
    • Sanjay Patel's avatar
      [SLP] reduce duplicated code; NFC · b38bac36
      Sanjay Patel authored
      llvm-svn: 369250
      b38bac36
    • Raphael Isemann's avatar
      [lldb][NFC] Add a few more completion tests to increase test coverage · fb443746
      Raphael Isemann authored
      These tests are mostly trying to reach the different completion functions
      in CommandCompletions.cpp (::ArchitectureNames, ::DiskFiles, ::Modules).
      
      llvm-svn: 369249
      fb443746
    • Fangrui Song's avatar
      [MC] Simplify ELFObjectWriter::recordRelocation. NFC · d9a071c5
      Fangrui Song authored
      llvm-svn: 369248
      d9a071c5