1. Dec 13, 2019
    • Nikita Popov's avatar
      Reapply [LVI] Normalize pointer behavior · 21fbd558
      Nikita Popov authored
      This is a rebase of the change over D70376, which fixes an LVI cache
      invalidation issue that also affected this patch.
      
      -----
      
      Related to D69686. As noted there, LVI currently behaves differently
      for integer and pointer values: For integers, the block value is always
      valid inside the basic block, while for pointers it is only valid at
      the end of the basic block. I believe the integer behavior is the
      correct one, and CVP relies on it via its getConstantRange() uses.
      
      The reason for the special pointer behavior is that LVI checks whether
      a pointer is dereferenced in a given basic block and marks it as
      non-null in that case. Of course, this information is valid only after
      the dereferencing instruction, or in conservative approximation,
      at the end of the block.
      
      This patch changes the treatment of dereferencability: Instead of
      including it inside the block value, we instead treat it as something
      similar to an assume (it essentially is a non-nullness assume) and
      incorporate this information in intersectAssumeOrGuardBlockValueConstantRange()
      if the context instruction is the terminator of the basic block.
      This happens either when determining an edge-value internally in LVI,
      or when a terminator was explicitly passed to getValueAt(). The latter
      case makes this change not fully NFC, because we can now fold
      terminator icmps based on the dereferencability information in the
      same block. This is the reason why I changed one JumpThreading test
      (it would optimize the condition away without the change).
      
      Of course, we do not want to recompute dereferencability on each
      intersectAssume call, so we need a new cache for this. The
      dereferencability analysis requires walking the entire basic block
      and computing underlying objects of all memory operands. This was
      previously done separately for each queried pointer value. In the
      new implementation (both because this makes the caching simpler,
      and because it is faster), I instead only walk the full BB once and
      cache all the dereferenced pointers. So the traversal is now performed
      only once per BB, instead of once per queried pointer value.
      
      I think the overall model now makes more sense than before, and there
      will be no more pitfalls due to differing integer/pointer behavior.
      
      Differential Revision: https://reviews.llvm.org/D69914
      21fbd558
    • Muhammad Omair Javaid's avatar
      [lldb] Remove xpasses after pr44037 fix committed · 5536c62f
      Muhammad Omair Javaid authored
      This patch removes xpass decorator from tests which were failing due to
      pr44037.
      
      pr44037 was fixed by rev 6ce1a897
      5536c62f
    • Rui Ueyama's avatar
      Revert an accidental commit af5ca40b · 69da7e29
      Rui Ueyama authored
      69da7e29
    • Rui Ueyama's avatar
      Update the man page · 6faf8bdc
      Rui Ueyama authored
      Add a description about the compression level of the debug info.
      
      Differential Revision: https://reviews.llvm.org/D71385
      6faf8bdc
    • Rui Ueyama's avatar
      temporary · af5ca40b
      Rui Ueyama authored
      af5ca40b
    • Andrew Gaul's avatar
      Correct inf typo · 4daa8d1d
      Andrew Gaul authored
      Reviewers: krasimir
      
      Reviewed By: krasimir
      
      Subscribers: Jim, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D57732
      4daa8d1d
    • Stephan T. Lavavej's avatar
      [libcxx] [test] Fix valarray UB and MSVC warnings. · bf7dc572
      Stephan T. Lavavej authored
      [libcxx] [test] Calling min and max on an empty valarray is UB.
      
      libcxx/test/std/numerics/numarray/template.valarray/valarray.members/min.pass.cpp
      libcxx/test/std/numerics/numarray/template.valarray/valarray.members/max.pass.cpp
      
      The calls `v1.min();` and `v1.max();` were emitting nodiscard warnings
      with MSVC's STL. Upon closer inspection, these calls were triggering
      undefined behavior. N4842 [valarray.members] says:
      
      "T min() const;
      8 Preconditions: size() > 0 is true.
      T max() const;
      10 Preconditions: size() > 0 is true."
      
      As these tests already provide coverage for non-empty valarrays
      (immediately above), I've simply deleted the code for empty valarrays.
      
      [libcxx] [test] Add macros to msvc_stdlib_force_include.h (NFC).
      
      libcxx/test/support/msvc_stdlib_force_include.h
      
      These macros are being used by:
      libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
      Defining them to nothing allows that test to pass.
      
      [libcxx] [test] Silence MSVC warning C5063 for is_constant_evaluated (NFC).
      
      libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp
      
      This test is intentionally writing code that MSVC intentionally warns
      about, so the warning should be silenced.
      
      Additionally, comment an endif for clarity.
      
      [libcxx] [test] Silence MSVC warning C4127 (NFC).
      
      libcxx/test/support/charconv_test_helpers.h
      
      MSVC avoids emitting this warning when it sees a single constexpr value
      being tested, but this condition is a mix of compile-time and run-time.
      Using push-disable-pop is the least intrusive way to silence this.
      
      [libcxx] [test] Silence MSVC truncation warning (NFC).
      
      libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
      
      This test is intentionally truncating float to int, which MSVC
      intentionally warns about, so push-disable-pop is necessary.
      
      [libcxx] [test] Avoid truncation warnings in erase_if tests (NFC).
      
      libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp
      libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
      libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
      libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp
      
      These tests use maps with `short` keys and values, emitting MSVC
      truncation warnings from `int`. Adding `static_cast` to `key_type`
      and `mapped_type` avoids these warnings.
      
      As these tests require C++20 mode (or newer), for brevity I've changed
      the multimap tests to use emplace to initialize the test data.
      This has no effect on the erase_if testing.
      bf7dc572
    • Douglas Yung's avatar
    • Nate Voorhies's avatar
      [NFC][AArch64] Fix typo. · bc16666d
      Nate Voorhies authored
      Summary: Coaleascer should be coalescer.
      
      Reviewers: qcolombet, Jim
      
      Reviewed By: Jim
      
      Subscribers: Jim, kristof.beyls, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70731
      bc16666d
    • Eric Fiselier's avatar
      9b540192
    • Eric Fiselier's avatar
      [libc++] Cleanup and enable multiple warnings. · f97936fa
      Eric Fiselier authored
      Too many warnings are being disabled too quickly. Warnings are
      important to keeping libc++ correct. This patch re-enables two
      warnings: -Wconstant-evaluated and -Wdeprecated-copy.
      
      In future, all warnings disabled for the test suite should require
      an attached bug. The bug should state the plan for re-enabling that
      warning, or a strong case why it should remain disabled.
      f97936fa
    • Eric Christopher's avatar
      Temporarily revert "NFC: DebugInfo: Refactor RangeSpanList to be a struct,... · a8154e5e
      Eric Christopher authored
      Temporarily revert "NFC: DebugInfo: Refactor RangeSpanList to be a struct, like DebugLocStream::List"
      as it was causing bot and build failures.
      
      This reverts commit 8e048962.
      a8154e5e
    • Julian Lettner's avatar
      [iOS sim] Simplify iossim_run.py script · cdb45605
      Julian Lettner authored
      cdb45605
    • Nathan Ridge's avatar
      [clangd] Fix Windows test failure by adding -fno-delayed-template-parsing to LocateSymbol.Ambiguous · 4f732a3d
      Nathan Ridge authored
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D71444
      4f732a3d
    • Douglas Yung's avatar
      b71475ff
    • David Blaikie's avatar
      NFC: DebugInfo: Refactor RangeSpanList to be a struct, like DebugLocStream::List · 8e048962
      David Blaikie authored
      Move these data structures closer together so their emission code can
      eventually share more of its implementation.
      8e048962
    • David Blaikie's avatar
      NFC: DebugInfo: Refactor debug_loc/loclist emission into a common function · 20e06a28
      David Blaikie authored
      (except for v4 loclists, which are sufficiently different to not fit
      well in this generic implementation)
      
      In subsequent patches I intend to refactor the DebugLoc and ranges data
      structures to be more similar so I can common more of the implementation
      here.
      20e06a28
    • Fangrui Song's avatar
      __bit_reference: fix -Wdeprecated-copy warnings · b7eb30d4
      Fangrui Song authored
      Since C++11, [depr.impldec]:
      
      The implicit definition of a copy constructor as defaulted is deprecated
      if the class has a user-declared copy assignment operator or a
      user-declared destructor.
      
      At clang HEAD, -Wdeprecated-copy (included by -Wextra) will warn on such instances.
      
      Reviewed By: EricWF
      
      Differential Revision: https://reviews.llvm.org/D71096
      b7eb30d4
    • Evgenii Stepanov's avatar
      hwasan: add tag_offset DWARF attribute to optimized debug info · dabd2622
      Evgenii Stepanov authored
      Summary:
      Support alloca-referencing dbg.value in hwasan instrumentation.
      Update AsmPrinter to emit DW_AT_LLVM_tag_offset when location is in
      loclist format.
      
      Reviewers: pcc
      
      Subscribers: srhines, aprantl, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D70753
      dabd2622
    • Jon Chesterfield's avatar
      [libomptarget][nfc] Add declarations of atomic functions for amdgcn · 47986864
      Jon Chesterfield authored
      Summary:
      [libomptarget][nfc] Add declarations of atomic functions for amdgcn
      
      This enables building more source for amdgcn. The functions are usually available
      in a hip runtime header, but are duplicated here to decouple the implementation
      
      Reviewers: jdoerfert, ABataev, grokos
      
      Reviewed By: jdoerfert
      
      Subscribers: jvesely, mgorny, jfb, openmp-commits
      
      Tags: #openmp
      
      Differential Revision: https://reviews.llvm.org/D71412
      47986864
    • Heejin Ahn's avatar
      [IR] Include target specific intrinsic headers · 5368f35e
      Heejin Ahn authored
      After D71320, target-specific intrinsic headers should be included.
      5368f35e
    • Jon Chesterfield's avatar
      [libomptarget] Move resource id functions into target specific code, implement for amdgcn · dbb3fec8
      Jon Chesterfield authored
      Summary: [libomptarget] Move resource id functions into target specific code, implement for amdgcn
      
      Reviewers: jdoerfert, ABataev, grokos
      
      Reviewed By: jdoerfert
      
      Subscribers: jvesely, mgorny, openmp-commits
      
      Tags: #openmp
      
      Differential Revision: https://reviews.llvm.org/D71382
      dbb3fec8
    • Eric Christopher's avatar
      259a9b10
    • Danilo Carvalho Grael's avatar
      [AArch64][SVE] Add integer arithmetic with immediate instructions. · 6bed43f3
      Danilo Carvalho Grael authored
      Summary:
      Add pattern matching for the following instructions:
      - add, sub, subr, sqadd, sqsub, uqadd, uqsub
      
      This patch required complex patterns to match the immediate with optinal left shift.
      
      I re-used the Select function from the other SVE repo to implement the complext pattern.
      
      I plan on doing another patch to also match constant vector of the same immediate.
      
      Reviewers: sdesmalen, huntergr, rengolin, efriedma, c-rhodes, mgudim, kmclaughlin
      
      Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits, amehsan
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71370
      6bed43f3
    • Nathan Ridge's avatar
      [clangd] Heuristically resolve dependent method calls · ecaa9363
      Nathan Ridge authored
      Summary:
      The heuristic is to look in the definition of the primary template,
      which is what you want in the vast majority of cases.
      
      Fixes https://github.com/clangd/clangd/issues/141
      
      Reviewers: sammccall
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D71240
      ecaa9363
    • Eric Fiselier's avatar
    • Johannes Doerfert's avatar
      [Attributor][FIX] Do treat byval arguments special · 6abd01e4
      Johannes Doerfert authored
      When we reason about the pointer argument that is byval we actually
      reason about a local copy of the value passed at the call site. This was
      not the case before and we wrongly introduced attributes based on the
      surrounding function.
      
      AAMemoryBehaviorArgument, AAMemoryBehaviorCallSiteArgument and
      AANoCaptureCallSiteArgument are made aware of byval now. The code
      to skip "subsuming positions" for reasoning follows a common pattern and
      we should refactor it. A TODO was added.
      
      Discovered by @efriedma as part of D69748.
      6abd01e4
    • Denis Bakhvalov's avatar
      [NFC][InstSimplify] Refactoring ThreadCmpOverSelect function · 7081c922
      Denis Bakhvalov authored
      Removed code duplication in ThreadCmpOverSelect and broke it
      into several smaller functions for reusing them.
      
      Differential Revision: https://reviews.llvm.org/D71158
      7081c922
    • Sanjay Patel's avatar
      Revert "[DAGCombiner] fold shift-trunc-shift to shift-mask-trunc" · 94329371
      Sanjay Patel authored
      This reverts commit 8963332c.
      There was a logic bug typo in this code, but it wasn't visible in the asm for the tests.
      94329371
    • Michał Górny's avatar
      [clang] [test] Disable the test exhausting stack on NetBSD · 4c6c1d0f
      Michał Górny authored
      Disable the instantiation-depth-default.cpp test on NetBSD since it
      requires more stack space than we have by default on NetBSD.
      
      Differential Revision: https://reviews.llvm.org/D71419
      4c6c1d0f
    • Eric Christopher's avatar
      [sanitizers] Redirect stdout and stderr to TASK_LOG · 3ecfe64f
      Eric Christopher authored
      At some point cpplint.py became very noisy during a build spewing
      a few hundred lines of "Done processing..." even with SILENT=1 in
      cmake. This attempts to redirect the stdout of "Done processing" to
      the task log along with any errors.
      
      Tested by this with and without SILENT=1 to check things.
      
      Differential Revision: https://reviews.llvm.org/D71402
      Reviewed By: eugenis
      3ecfe64f
    • Alexey Bataev's avatar
      [OPENMP50]Fix possible conflict when emitting an alias for the functions · 5ad52587
      Alexey Bataev authored
      in declare variant.
      
      If the types of the fnction are not equal, but match, at the codegen
      thei may have different types. This may lead to compiler crash.
      5ad52587
    • Sanjay Patel's avatar
      [DAGCombiner] fold shift-trunc-shift to shift-mask-trunc · 8963332c
      Sanjay Patel authored
      This fold is done in IR by instcombine, and we have a special
      form of it already here in DAGCombiner, but we want the more
      general transform too:
      https://rise4fun.com/Alive/3jZm
      
      Name: general
      Pre: (C1 + zext(C2) < 64)
      %s = lshr i64 %x, C1
      %t = trunc i64 %s to i16
      %r = lshr i16 %t, C2
      =>
      %s2 = lshr i64 %x, C1 + zext(C2)
      %a = and i64 %s2, zext((1 << (16 - C2)) - 1)
      %r = trunc %a to i16
      
      Name: special
      Pre: C1 == 48
      %s = lshr i64 %x, C1
      %t = trunc i64 %s to i16
      %r = lshr i16 %t, C2
      =>
      %s2 = lshr i64 %x, C1 + zext(C2)
      %r = trunc %s2 to i16
      
      ...because D58017 exposes a regression without this fold.
      8963332c
    • Eric Fiselier's avatar
    • Teresa Johnson's avatar
      [LTO] Support for embedding bitcode section during LTO · c8e0bb3b
      Teresa Johnson authored
      Summary:
      This adds support for embedding bitcode in a binary during LTO. The libLTO gains supports the `-lto-embed-bitcode` flag. The option allows users of the LTO library to embed a bitcode section. For example, LLD can pass the option via `ld.lld -mllvm=-lto-embed-bitcode`.
      
      This feature allows doing something comparable to `clang -c -fembed-bitcode`, but on the (LTO) linker level. Having bitcode alongside native code has many use-cases. To give an example, the MacOS linker can create a `-bitcode_bundle` section containing bitcode. Also, having this feature built into LLVM is an alternative to 3rd party tools such as [[ https://github.com/travitch/whole-program-llvm | wllvm ]] or [[ https://github.com/SRI-CSL/gllvm | gllvm ]]. As with these tools, this feature simplifies creating "whole-program" llvm bitcode files, but in contrast to wllvm/gllvm it does not rely on a specific llvm frontend/driver.
      
      Patch by Josef Eisl <josef.eisl@oracle.com>
      
      Reviewers: #llvm, #clang, rsmith, pcc, alexshap, tejohnson
      
      Reviewed By: tejohnson
      
      Subscribers: tejohnson, mehdi_amini, inglorion, hiraditya, aheejin, steven_wu, dexonsmith, dang, cfe-commits, llvm-commits, #llvm, #clang
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D68213
      c8e0bb3b
    • Alexey Bataev's avatar
      [OPENMP50]Improve checks for declare variant functions compatibility. · 0ee89c1b
      Alexey Bataev authored
      Added check for functions compatibility in C and removed restriction
      for functions with no prototypes in declare variant constrcut.
      0ee89c1b
    • Alex Langford's avatar
      [Target] Remove Target::GetScratchClangASTContext · 3031818a
      Alex Langford authored
      Target doesn't really need to know about ClangASTContext more than any
      other TypeSystem. We can create a method ClangASTContext::GetScratch for
      anything who needs a ClangASTContext specifically instead of just a
      generic TypeSystem.
      3031818a
    • Tony's avatar
      [AMDGPU] AMDGPUUsage clarify address space information and other typo and formatting fixes · 7a54f727
      Tony authored
      Summary:
      - Clarify AMDGPU address spaces.
      - Correct path to AMDGPU backend since now in the mono-repo.
      - Fix numerous text style and typo issues.
      - Correct reStructure text formatting warnings.
      - Made reStructure directive usage more consistent.
      - Add references for gfx10 ISA specification.
      
      Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, jfb, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71392
      7a54f727
    • Vedant Kumar's avatar
      TypeCategory: Initialize m_enabled to false · 46d970cc
      Vedant Kumar authored
      The initialization was accidentally lost in https://reviews.llvm.org/D71310, causing a ubsan failure:
      
      /Users/buildslave/jenkins/workspace/lldb-cmake-sanitized/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h:278:35: runtime error: load of value 190, which is not a valid value for type 'bool'
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Users/buildslave/jenkins/workspace/lldb-cmake-sanitized/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h:278:35 in
      
      http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-sanitized/621/consoleText
      46d970cc
    • Erich Keane's avatar
      Suppress -Wwarn-unused-variables when we don't know the constructor · 654c0dae
      Erich Keane authored
      This warning is supposed to be suppressed when the
      constructor/destructor are non-trivial, since it might be a RAII type.
      However, if the type has a trivial destructor and the constructor hasn't
      been resolved (since it is called with dependent arguments), we were
      still warning.
      
      This patch suppresses the warning if the type could possibly have a
      be a non-trivial constructor call.  Note that this does not take the
      arity of the constructors into consideration, so it might suppress
      the warning in cases where it isn't possible to call a non-trivial
      constructor.
      654c0dae