1. Oct 23, 2020
    • Paul C. Anagnostopoulos's avatar
    • Vedant Kumar's avatar
      [InstCombine] Remove dbg.values describing contents of dead allocas · 3419252a
      Vedant Kumar authored
      When InstCombine removes an alloca, it erases the dbg.{addr,declare}
      instructions which refer to the alloca. It would be better to instead
      remove all debug intrinsics which describe the contents of the dead
      alloca, namely all dbg.value(<dead alloca>, ..., DW_OP_deref)'s.
      
      This effectively undoes work performed in an InstCombine run earlier in
      the pipeline by LowerDbgDeclare, which inserts DW_OP_deref dbg.values
      before CallInst users of an alloca. The motivating example looks like:
      
      ```
        define void @foo(i32 %0) {
          %a = alloca i32              ; This alloca is erased.
          store i32 %0, i32* %a
          dbg.value(i32 %0, "arg0")    ; This dbg.value survives.
          dbg.value(i32* %a, "arg0", DW_OP_deref)
          call void @trivially_inlinable_no_op(i32* %a)
          ret void
        }
      ```
      
      If the DW_OP_deref dbg.value is not erased, it becomes dbg.value(undef)
      after inlining, making "arg0" unavailable. But we already have dbg.value
      descriptions of the alloca's value (from LowerDbgDeclare), so the
      DW_OP_deref dbg.value cannot serve its purpose of describing an
      initialization of the alloca by some callee. It invalidates other useful
      dbg.values, causing large gaps in location coverage, so we should delete
      it (even though doing so may cause stale dbg.values to appear, if
      there's a dead store to `%a` in @trivially_inlinable_no_op).
      
      OTOH, it wouldn't be correct to delete all dbg.value descriptions of an
      alloca. Note that it's possible to describe a variable that takes on
      different pointer values, e.g.:
      
      ```
        void use(int *);
        void t(int a, int b) {
          int *local = &a;     // dbg.value(i32* %a.addr, "local")
          local = &b;          // dbg.value(i32* undef, "local")
          use(&a);             //           (note: %b.addr is optimized out)
          local = &a;          // dbg.value(i32* %a.addr, "local")
        }
      ```
      
      In this example, the alloca for "b" is erased, but we need to describe
      the value of "local" as <unavailable> before the call to "use". This
      prevents "local" from appearing to be equal to "&a" at the callsite.
      
      rdar://66592859
      
      Differential Revision: https://reviews.llvm.org/D85555
      3419252a
    • Matt Arsenault's avatar
      AMDGPU: Cleanup MIR test · 549f326d
      Matt Arsenault authored
      Remove registers section and compact block/register numbers
      549f326d
    • Arthur Eubanks's avatar
      87520657
    • Fangrui Song's avatar
      [ELF] Set SHF_INFO_LINK for .rel[a].plt and .rel[a].dyn · a8f9f080
      Fangrui Song authored
      The ELF spec says
      
      > If the sh_flags field for this section header includes the attribute SHF_INFO_LINK, then this member represents a section header table index.
      
      Set SHF_INFO_LINK so that binary manipulation tools know that sh_info is
      a section header table index instead of (the number of local symbols in the case of SHT_SYMTAB/SHT_DYNSYM).
      We have already added SHF_INFO_LINK for --emit-relocs retained SHT_REL[A].
      
      For example, we can teach llvm-objcopy to preserve the section index of the sh_info referenced section if
      SHF_INFO_LINK is set. (GNU objcopy recognizes .rel[a].plt and updates
      sh_info even if SHF_INFO_LINK is not set).
      
      Reviewed By: grimar, psmith
      
      Differential Revision: https://reviews.llvm.org/D89828
      a8f9f080
    • Raphael Isemann's avatar
      Revert "[lldb] Explicitly use the configuration architecture when building test executables" · 5dc70332
      Raphael Isemann authored
      This reverts commit 41185226.
      
      Causes TestQuoting to fail on Windows.
      5dc70332
    • Nikita Popov's avatar
      [DomTree] Accept Value as Def (NFC) · 32b6e9a4
      Nikita Popov authored
      Non-instruction defs like arguments, constants or global values
      always dominate all instructions/uses inside the function. This
      case currently needs to be treated separately by the caller, see
      https://reviews.llvm.org/D89623#inline-832818 for an example.
      
      This patch makes the dominator tree APIs accept a Value instead of
      an Instruction and always returns true for the non-Instruction case.
      
      A complication here is that BasicBlocks are also Values. For that
      reason we can't support the dominates(Value *, BasicBlock *)
      variant, as it would conflict with dominates(BasicBlock *, BasicBlock *),
      which has different semantics. For the other two APIs we assert
      that the passed value is not a BasicBlock.
      
      Differential Revision: https://reviews.llvm.org/D89632
      32b6e9a4
    • Florian Hahn's avatar
      [SLP] Add tests with selects that can be turned into min/max. · d842b886
      Florian Hahn authored
      AArch64 does not have a flexible vector select instruction. In some
      cases, the selects can be turned into min/max however, for which there
      are dedicated vector instructions on AArch64.
      
      This patch adds some tests for such cases.
      d842b886
    • Tim Corringham's avatar
      [AMDGPU] Add amdgpu specific loop threshold metadata · 3c1273d7
      Tim Corringham authored
      Add new loop metadata amdgpu.loop.unroll.threshold to allow the initial AMDGPU
      specific unroll threshold value to be specified on a loop by loop basis.
      
      The intention is to be able to to allow more nuanced hints, e.g. specifying a
      low threshold value to indicate that a loop may be unrolled if cheap enough
      rather than using the all or nothing llvm.loop.unroll.disable metadata.
      
      Differential Revision: https://reviews.llvm.org/D84779
      3c1273d7
    • Arthur Eubanks's avatar
      [gn build] Add missing clangd dependencies · af3c51e3
      Arthur Eubanks authored
      Fixes
      $ ninja obj/build/rel/gen/clang-tools-extra/clangd/CompletionModel.CompletionModel.obj
      
      Some tablegen include files from clang/include/clang/AST and
      clang/include/clang/Sema need to be generated before CompletionModel is
      compiled.
      
      Reviewed By: thakis
      
      Differential Revision: https://reviews.llvm.org/D89657
      af3c51e3
    • Arthur Eubanks's avatar
      [Docs] Clarify that FunctionPasses can't add/remove declarations · 710676cf
      Arthur Eubanks authored
      In preparation for potential future concurrency, a FunctionPass
      shouldn't modify anything at the module level that other FunctionPasses
      can also modify.
      
      Reviewed By: asbirlea
      
      Differential Revision: https://reviews.llvm.org/D89890
      710676cf
    • Med Ismail Bennani's avatar
      [lldb/DWARF] Add support for DW_OP_implicit_value · efe62b63
      Med Ismail Bennani authored
      This patch completes https://reviews.llvm.org/D83560. Now that the
      compiler can emit `DW_OP_implicit_value` into DWARF expressions, lldb
      needed to learn reading these opcodes for variable inspection and
      expression evaluation.
      
      This implicit location descriptor specifies an immediate value with two
      operands: the length (ULEB128) followed by a block representing the value
      in the target memory representation.
      
      rdar://67406091
      
      Differential revision: https://reviews.llvm.org/D89842
      
      
      
      Signed-off-by: default avatarMed Ismail Bennani <medismail.bennani@gmail.com>
      efe62b63
    • Marco Antognini's avatar
      [OpenCL] Remove unused extensions · a779a169
      Marco Antognini authored
      Many non-language extensions are defined but also unused. This patch
      removes them with their tests as they do not require compiler support.
      
      The cl_khr_select_fprounding_mode extension is also removed because it
      has been deprecated since OpenCL 1.1 and Clang doesn't have any specific
      support for it.
      
      The cl_khr_context_abort extension is only referred to in "The OpenCL
      Specification", version 1.2 and 2.0, in Table 4.3, but no specification
      is provided in "The OpenCL Extension Specification" for these versions.
      Because it is both unused in Clang and lacks specification, this
      extension is removed.
      
      The following extensions are platform extensions that bring new OpenCL
      APIs but do not impact the kernel language nor require compiler support.
      They are therefore removed.
      
      - cl_khr_gl_sharing, introduced in OpenCL 1.0
      
      - cl_khr_icd, introduced in OpenCL 1.2
      
      - cl_khr_gl_event, introduced in OpenCL 1.1
      Note: this extension adds a new API to create cl_event but it also
      specifies that these can only be used by clEnqueueAcquireGLObjects.
      Hence, they cannot be used on the device side and the extension does
      not impact the kernel language.
      
      - cl_khr_d3d10_sharing, introduced in OpenCL 1.1
      
      - cl_khr_d3d11_sharing, introduced in OpenCL 1.2
      
      - cl_khr_dx9_media_sharing, introduced in OpenCL 1.2
      
      - cl_khr_image2d_from_buffer, introduced in OpenCL 1.2
      
      - cl_khr_initialize_memory, introduced in OpenCL 1.2
      
      - cl_khr_gl_depth_images, introduced in OpenCL 1.2
      Note: this extension is related to cl_khr_depth_images but only the
      latter adds new features to the kernel language.
      
      - cl_khr_spir, introduced in OpenCL 1.2
      
      - cl_khr_egl_event, introduced in OpenCL 1.2
      Note: this extension adds a new API to create cl_event but it also
      specifies that these can only be used by clEnqueueAcquire* API
      functions. Hence, they cannot be used on the device side and the
      extension does not impact the kernel language.
      
      - cl_khr_egl_image, introduced in OpenCL 1.2
      
      - cl_khr_terminate_context, introduced in OpenCL 1.2
      
      The minimum required OpenCL version used in OpenCLExtensions.def for
      these extensions is not always correct. Removing these address that
      issue.
      
      Reviewed By: Anastasia
      
      Differential Revision: https://reviews.llvm.org/D89372
      a779a169
  2. Oct 22, 2020