platform/upstream/llvm.git
23 months agoRevert "[Attributor] AAPointerInfo should allow "harmless" uses"
Johannes Doerfert [Mon, 12 Sep 2022 04:35:50 +0000 (21:35 -0700)]
Revert "[Attributor] AAPointerInfo should allow "harmless" uses"
Revert "[Attributor] Teach AAPointerInfo to look into aggregates"

This reverts commit 844f6c5d03d58e7ac0c6b838e4a7834ac575ab9b and
4ed0a88cd8a77370073feb270d77a9e8b27bd68c as they broke the buildbots
that run openmp/libomptarget/test/offloading/bug49021.cpp.

23 months agoAdd SBDebugger::GetSetting() public APIs
Jeffrey Tan [Thu, 8 Sep 2022 18:00:22 +0000 (11:00 -0700)]
Add SBDebugger::GetSetting() public APIs

This patch adds new SBDebugger::GetSetting() API which
enables client to access settings as SBStructedData.

Implementation wise, a new ToJSON() virtual function is added to OptionValue
class so that each concrete child class can override and provides its
own JSON representation. This patch aims to define the APIs and implement
a common set of OptionValue child classes, leaving the remaining for
future patches.

This patch is used later by auto deduce source map from source line breakpoint
feature for testing generated source map entries.

Differential Revision: https://reviews.llvm.org/D133038

23 months ago[Attributor] AAPointerInfo should allow "harmless" uses
Johannes Doerfert [Mon, 12 Sep 2022 01:43:20 +0000 (18:43 -0700)]
[Attributor] AAPointerInfo should allow "harmless" uses

If a call base use will not capture a pointer we can approximate the
effects. This is important especially for readnone/only uses.

23 months ago[Attributor] Teach AAPointerInfo to look into aggregates
Johannes Doerfert [Wed, 31 Aug 2022 19:13:42 +0000 (12:13 -0700)]
[Attributor] Teach AAPointerInfo to look into aggregates

If we have a constant aggregate, e.g., as an initializer, we usually
failed to extract the proper value/type from it. This patch provides the
size and offset information necessary to extract the right part of the
constant.

23 months ago[Attributor][FIX] Conservatively handle ptr2int, don't crash
Johannes Doerfert [Tue, 30 Aug 2022 21:04:48 +0000 (14:04 -0700)]
[Attributor][FIX] Conservatively handle ptr2int, don't crash

If a pointer-2-int cast is found we give up on AAPointerInfo for now.
This caused a crash before.

Reported by John Tramm (@jtramm).

23 months ago[OpenMP] Allow the Attributor to look at functions we also internalized
Johannes Doerfert [Fri, 12 Aug 2022 23:33:29 +0000 (18:33 -0500)]
[OpenMP] Allow the Attributor to look at functions we also internalized

This is important as we have accesses to globals in those which we need to
categorize.

23 months ago[flang] Fix invalid branch optimization
V Donaldson [Sat, 10 Sep 2022 04:23:50 +0000 (21:23 -0700)]
[flang] Fix invalid branch optimization

Branch optimization in function rewriteIfGotos attempts to rewrite code
such as

    <<IfConstruct>>
      1 If[Then]Stmt: if(cond) goto L
      2 GotoStmt: goto L
      3 EndIfStmt
    <<End IfConstruct>>
    4 Statement: ...
    5 Statement: ...
    6 Statement: L ...

to eliminate a branch and a trivial basic block to get:

    <<IfConstruct>>
      1 If[Then]Stmt [negate]: if(cond) goto L
      4 Statement: ...
      5 Statement: ...
      3 EndIfStmt
    <<End IfConstruct>>
    6 Statement: L ...

Among other requirements, this is invalid if any statement between the
GOTO and its target is an intermediate construct statement such as a
CASE or ELSE IF statement, like the CASE DEFAULT statement in:

  select case(i)
  case (:2)
    n = i * 10
  case (5:)
    n = i * 1000
    if (i <= 6) goto 9 ! exit over 'case default'; may not be rewritten
    n = i * 10000
  case default
    n = i * 100
9 end select

23 months ago[XRay] Remove XRayRecordStorage
Kazu Hirata [Sun, 11 Sep 2022 23:11:41 +0000 (16:11 -0700)]
[XRay] Remove XRayRecordStorage

AFAICT, this type hasn't used for 4 years at least.

23 months ago[llvm] Use std::aligned_storage_t (NFC)
Kazu Hirata [Sun, 11 Sep 2022 23:11:39 +0000 (16:11 -0700)]
[llvm] Use std::aligned_storage_t (NFC)

23 months ago[libc++] Workaround the absence of the __GLIBC_USE macro in glibc versions prior...
Tom Honermann [Sun, 11 Sep 2022 19:58:09 +0000 (15:58 -0400)]
[libc++] Workaround the absence of the __GLIBC_USE macro in glibc versions prior to 2.25.

This change correct a configuration check that relies on the glibc __GLIBC_USE
macro being defined. Previously, the function-like macro was expanded without
ensuring it was actually defined. This resulted in compilation failures for
glibc versions prior to 2.25 (the glibc version in which the macro was added).

Differential Revision: https://reviews.llvm.org/D130946

23 months ago[GlobalISel] Use std::initializer_list::size (NFC)
Kazu Hirata [Sun, 11 Sep 2022 19:19:37 +0000 (12:19 -0700)]
[GlobalISel] Use std::initializer_list::size (NFC)

23 months ago[test][clangd] Fix use-after-return after 72142fbac4
Vitaly Buka [Sun, 11 Sep 2022 18:46:49 +0000 (11:46 -0700)]
[test][clangd] Fix use-after-return after 72142fbac4

23 months agoRevert "[test][clangd] Fix use-after-return after 72142fbac4"
Vitaly Buka [Sun, 11 Sep 2022 18:44:38 +0000 (11:44 -0700)]
Revert "[test][clangd] Fix use-after-return after 72142fbac4"

Will try another fix.

This reverts commit c3c930d573656a825523b7112891bd97eec7b64f.

23 months agoMake sure libLLVM users link with libatomic if needed
Aaron Puchert [Sun, 11 Sep 2022 18:44:51 +0000 (20:44 +0200)]
Make sure libLLVM users link with libatomic if needed

64-bit atomics are used in llvm/ADT/Statistic.h, which means that users
of libLLVM.so might also have to link with libatomic. To avoid having
to special-case the library here, we simply add all `LLVM_SYSTEM_LIBS`
as public link dependencies to libLLVM.

This fixes a build failure on PowerPC 32-bit.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D132799

23 months ago[libcxxabi] Fix forced_unwind3.pass.cpp compilation error
Aaron Puchert [Sun, 11 Sep 2022 18:44:36 +0000 (20:44 +0200)]
[libcxxabi] Fix forced_unwind3.pass.cpp compilation error

Under some circumstances there is no struct _Unwind_Exception, it's just
an alias to another struct. This would result in an error like this:

libcxxabi/test/forced_unwind3.pass.cpp:50:77: error: typedef '_Unwind_Exception' cannot be referenced with a struct specifier
  static _Unwind_Reason_Code stop(int, _Unwind_Action actions, type, struct _Unwind_Exception*, struct _Unwind_Context*,
                                                                            ^
<...>/lib/clang/15.0.0/include/unwind.h:68:38: note: declared here
typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */
                                     ^

This seems to have been an issue since the test was first added in
D109856, except that it didn't surface with Clang 14 because the code
is filtered out by the preprocessor if `__clang_major__ < 15`.

Reviewed By: danielkiss, mstorsjo, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D132873

23 months ago[docs] Use relative URLs for man pages
Aaron Puchert [Sun, 11 Sep 2022 18:43:55 +0000 (20:43 +0200)]
[docs] Use relative URLs for man pages

Should have no effect on the online documentation, but it makes offline
builds more self-contained. With relative links however we have to
abstain from using `:manpage:` outside of man page cross-references.

Reviewed By: mysterymath

Differential Revision: https://reviews.llvm.org/D132794

23 months ago[test][clangd] Fix use-after-return after 72142fbac4
Vitaly Buka [Sun, 11 Sep 2022 17:15:13 +0000 (10:15 -0700)]
[test][clangd] Fix use-after-return after 72142fbac4

23 months agoRevert "[test][clangd] Try to unbrake bots after 72142fbac4"
Vitaly Buka [Sun, 11 Sep 2022 17:06:55 +0000 (10:06 -0700)]
Revert "[test][clangd] Try to unbrake bots after 72142fbac4"

It does not help.

This reverts commit 355dbd3b2aa28d479170c4e43265de186317dd86.

23 months ago[libc++][random] Removes transitive includes.
Mark de Wever [Sat, 3 Sep 2022 11:37:09 +0000 (13:37 +0200)]
[libc++][random] Removes transitive includes.

It seems these includes are still provided by the sub headers, so it only
removes the duplicates.

There is no change in the list of includes, but the change affects the
modular build. By not having the includes in the top-level header the
module map has changed. This uncovers missing includes in the tests
and missing exports in the module map. This causes the huge amount of
changes in the patch.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D133252

23 months ago[Clang] Reimplement time tracing of NewPassManager by PassInstrumentation framework
Junduo Dong [Tue, 16 Aug 2022 12:45:09 +0000 (05:45 -0700)]
[Clang] Reimplement time tracing of NewPassManager by PassInstrumentation framework

The previous implementation of time tracing in NewPassManager is direct but messive.

The key codes are like the demo below:
```
  /// Runs the function pass across every function in the module.
  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
                        LazyCallGraph &CG, CGSCCUpdateResult &UR) {
      /// ...
      PreservedAnalyses PassPA;
      {
        TimeTraceScope TimeScope(Pass.name());
        PassPA = Pass.run(F, FAM);
      }
      /// ...
 }
```

It can be bothered to judge where should we add the tracing codes by hands.

With the PassInstrumentation framework, we can easily add `Before/After` callback
functions to add time tracing codes.

Differential Revision: https://reviews.llvm.org/D131960

23 months ago[VPlan] Check recipe uses instead of type of underlying instr (NFC).
Florian Hahn [Sun, 11 Sep 2022 11:24:43 +0000 (12:24 +0100)]
[VPlan] Check recipe uses instead of type of underlying instr (NFC).

Suggested by @Ayal post-commit, to reduce the dependence on the
underlying instruction in favor of information available directly for
the recipe.

23 months ago[InstCombine] Fold x + (x | -x) to x & (x - 1)
Marc Auberer [Sun, 11 Sep 2022 10:13:25 +0000 (06:13 -0400)]
[InstCombine] Fold x + (x | -x) to x & (x - 1)

Fixes #57531

This transformation may be particularly useful on x86-64,
because x & (x - 1) can be performed by a single blsr instruction.

Differential Revision: https://reviews.llvm.org/D133362

23 months ago[InstCombine] add tests for mul-by-neg-pow2; NFC
Sanjay Patel [Sat, 10 Sep 2022 15:38:32 +0000 (11:38 -0400)]
[InstCombine] add tests for mul-by-neg-pow2; NFC

23 months ago[InstCombine] add tests for demanded bits of add with multi-use; NFC
Sanjay Patel [Fri, 9 Sep 2022 20:19:03 +0000 (16:19 -0400)]
[InstCombine] add tests for demanded bits of add with multi-use; NFC

23 months ago[libc++][doc] Updates format status page.
Mark de Wever [Sun, 11 Sep 2022 10:12:22 +0000 (12:12 +0200)]
[libc++][doc] Updates format status page.

23 months ago[compiler-rt] Handle non-canonical triples with new runtime lib layout
Rainer Orth [Sun, 11 Sep 2022 09:25:53 +0000 (11:25 +0200)]
[compiler-rt] Handle non-canonical triples with new runtime lib layout

As described in Issue #54196
<https://github.com/llvm/llvm-project/issues/54196>, the ideas of `clang`
and `compiler-rt` where runtime libs are located with
`-DLLVM_ENABLE_RUNTIMES` can differ.  This is the `compiler-rt` side of the
patch I've used to get them in sync for the `amd64-pc-solaris2.11` and
`sparc64-unknown-linux-gnu` release builds.

Tested on  `amd64-pc-solaris2.11` and `sparc64-unknown-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D133406

23 months ago[StripDeadDebugInfo] Drop dead CUs
Alexey Bader [Wed, 3 Aug 2022 13:06:50 +0000 (06:06 -0700)]
[StripDeadDebugInfo] Drop dead CUs

In situations when a submodule is extracted from big module (i.e. using
CloneModule) a lot of debug info is copied via metadata nodes. Despite of
the fact that part of that info is not linked to any instruction in extracted
IR file, StripDeadDebugInfo pass doesn't drop them.
Strengthen criteria for debug info that should be kept in a module:
- Only those compile units are left that referenced by a subprogram debug info
node that is attached to a function definition in the module or to an instruction
in the module that belongs to an inlined function.

Signed-off-by: Mikhail Lychkov <mikhail.lychkov@intel.com>
Differential Revision: https://reviews.llvm.org/D122163

23 months ago[test][clangd] Try to unbrake bots after 72142fbac4
Vitaly Buka [Sun, 11 Sep 2022 08:19:22 +0000 (01:19 -0700)]
[test][clangd] Try to unbrake bots after 72142fbac4

23 months ago[libc++][cuchar] Declare std::c8rtomb and std::mbrtoc8 in <cuchar> if available.
Tom Honermann [Sat, 10 Sep 2022 14:16:20 +0000 (10:16 -0400)]
[libc++][cuchar] Declare std::c8rtomb and std::mbrtoc8 in <cuchar> if available.

This change implements the C library dependent portions of P0482R6
(char8_t: A type for UTF-8 characters and strings (Revision 6)) by
declaring std::c8rtomb() and std::mbrtoc8() in the <cuchar> header
when implementations are provided by the C library as specified by
WG14 N2653 (char8_t: A type for UTF-8 characters and strings
(Revision 1)) as adopted for C23.

A _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 macro is defined by the libc++ __config
header unless it is known that the C library provides these functions
in the current compilation mode. This macro is used for testing purposes
and may be of use to libc++ users. At present, the only C library known
to implement these functions is GNU libc as of its 2.36 release.

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D130946

23 months ago[MLIR][Presburger] Refactor MultiAffineFunction to be defined over universe
Groverkss [Sun, 11 Sep 2022 00:02:52 +0000 (01:02 +0100)]
[MLIR][Presburger] Refactor MultiAffineFunction to be defined over universe

This patch refactors MAF to be defined over the universe in a given space
instead of being defined over a restricted domain.

The reasoning for this refactor is to store division representation for local
variables explicitly for the function outputs. This change is required for
unionLexMax/Min to support local variables which will be upstreamed after this
patch. Another reason for this refactor is to have a flattened form of
AffineMap as MultiAffineFunction.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D131864

23 months ago[test][msan] Add tests for @llvm.masked.*
Vitaly Buka [Sat, 10 Sep 2022 23:00:17 +0000 (16:00 -0700)]
[test][msan] Add tests for @llvm.masked.*

23 months ago[MLGO] Make TFLiteUtils throw an error if some features haven't been passed to the...
Aiden Grossman [Wed, 7 Sep 2022 20:36:09 +0000 (20:36 +0000)]
[MLGO] Make TFLiteUtils throw an error if some features haven't been passed to the model

In the Tensorflow C lib utilities, an error gets thrown if some features
haven't gotten passed into the model (due to differences in ordering
which now don't exist with the transition to TFLite). However, this is
not currently the case when using TFLiteUtils. This patch makes some
minor changes to throw an error when not all inputs of the model have
been passed, which when not handled will result in a seg fault within
TFLite.

Reviewed By: mtrofin

Differential Revision: https://reviews.llvm.org/D133451

23 months ago[test][msan] Remove -DAG after fixing indeterminism
Vitaly Buka [Sat, 10 Sep 2022 22:19:00 +0000 (15:19 -0700)]
[test][msan] Remove -DAG after fixing indeterminism

23 months ago[msan] Don't deppend on argumens evaluation order
Vitaly Buka [Sat, 10 Sep 2022 21:15:23 +0000 (14:15 -0700)]
[msan] Don't deppend on argumens evaluation order

23 months ago[test][msan] Autogenerate the test
Vitaly Buka [Sat, 10 Sep 2022 20:19:17 +0000 (13:19 -0700)]
[test][msan] Autogenerate the test

23 months ago[msan] Do not deppend on arguments evaluation order
Vitaly Buka [Sat, 10 Sep 2022 20:47:10 +0000 (13:47 -0700)]
[msan] Do not deppend on arguments evaluation order

Clang and GCC do this differently making IR inconsistent.
https://lab.llvm.org/buildbot#builders/6/builds/13120

23 months agoRevert "[test][msan] Convert test into autogenerated"
Vitaly Buka [Sat, 10 Sep 2022 20:31:56 +0000 (13:31 -0700)]
Revert "[test][msan] Convert test into autogenerated"

Fails https://lab.llvm.org/buildbot#builders/6/builds/13120

This reverts commit affc90ed8d30badf585a93d1b6997e400099075c.

23 months ago[test][msan] Convert test into autogenerated
Vitaly Buka [Sat, 10 Sep 2022 20:19:17 +0000 (13:19 -0700)]
[test][msan] Convert test into autogenerated

23 months ago[SLP] Add test case showing missing CSE in hoisted instructions.
Florian Hahn [Sat, 10 Sep 2022 19:55:03 +0000 (20:55 +0100)]
[SLP] Add test case showing missing CSE in hoisted instructions.

23 months ago[NFC][msan] Remove unused return type
Vitaly Buka [Sat, 10 Sep 2022 19:20:54 +0000 (12:20 -0700)]
[NFC][msan] Remove unused return type

23 months ago[msan] Relax handling of llvm.masked.expandload and llvm.masked.gather
Vitaly Buka [Sat, 10 Sep 2022 19:09:51 +0000 (12:09 -0700)]
[msan] Relax handling of llvm.masked.expandload and llvm.masked.gather

This is work around for new false positives. Real implementation will
follow.

23 months ago[CostModel][X86] Merge AVX512BW vXi8/vXi16 shifts into default AVX512BW cost table
Simon Pilgrim [Sat, 10 Sep 2022 17:18:36 +0000 (18:18 +0100)]
[CostModel][X86] Merge AVX512BW vXi8/vXi16 shifts into default AVX512BW cost table

We only need to handle the uniform cases early

23 months ago[Clang] NFC: Remove duplicated variable def in CheckLValueConstantExpression
Corentin Jabot [Sat, 10 Sep 2022 17:07:56 +0000 (19:07 +0200)]
[Clang] NFC: Remove duplicated variable def in CheckLValueConstantExpression

23 months ago[CostModel][X86] Update CTPOP costs
Simon Pilgrim [Sat, 10 Sep 2022 16:57:20 +0000 (17:57 +0100)]
[CostModel][X86] Update CTPOP costs

With the bdver2 model updates, many of the AVX1 costs were far too high - it also helped expose some costs mismatches for Atom/Silvermont

23 months ago[X86] Fix bdver2 128-bit shuffles throughputs
Simon Pilgrim [Sat, 10 Sep 2022 16:34:40 +0000 (17:34 +0100)]
[X86] Fix bdver2 128-bit shuffles throughputs

Noticed while trying to get vector ctpop/ctlz/cttz costs fixed using the script from D103695 - all of these are full-rate but the throughput costs were weirdly high for bdver2

Matches AMD 15h SoG, Agner and instlatx64

23 months ago[X86] Fix bdver2 128-bit ALU/logic/shift throughputs
Simon Pilgrim [Sat, 10 Sep 2022 15:21:50 +0000 (16:21 +0100)]
[X86] Fix bdver2 128-bit ALU/logic/shift throughputs

Noticed while trying to get vector shifts costs fixed using the script from D103695 - all of these are full-rate but the throughput costs were weirdly high for bdver2

Matches AMD 15h SoG, Agner and instlatx64

23 months agoUse PoisonValue instead of UndefValue when RAUWing unreachable code [NFC]
Manuel Brito [Sat, 10 Sep 2022 13:22:38 +0000 (14:22 +0100)]
Use PoisonValue instead of UndefValue when RAUWing unreachable code [NFC]

Replacing the following instances of UndefValue with PoisonValue, where the UndefValue is used as an arbitrary value:

- llvm/lib/CodeGen/WinEHPrepare.cpp
`demotePHIsOnFunclets`: RAUW arbitrary value for lingering uses of removed PHI nodes

 - llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
`FoldSingleEntryPHINodes`: Removes a self-referential single entry phi node.

 - llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
`finalize`: Remove all references to removed functions.

- llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
`cleanup`: the result is not used then the inserted instructions are removed.

 - llvm/tools/bugpoint/CrashDebugger.cpp
`TestInts`:  the program is cloned and instructions are removed to narrow down source of crash.

Differential Revision: https://reviews.llvm.org/D133640

23 months ago[Object] Improve ArchiveWriter diagnostics
Yi Kong [Fri, 9 Sep 2022 19:42:15 +0000 (03:42 +0800)]
[Object] Improve ArchiveWriter diagnostics

Print out the archive member that failed, to make debugging easier.

Before:
  error: failed to build archive: Not an int attribute (Producer: 'LLVM15.0.1git' Reader: 'LLVM 14.0.5-rust-dev')
After:
  error: failed to build archive: 'fake_bt_keystore.o': Not an int attribute (Producer: 'LLVM15.0.1git' Reader: 'LLVM 14.0.5-rust-dev')

Differential Revision: https://reviews.llvm.org/D133607

23 months ago[libc++] Bump _LIBCPP_STD_VER to the next expected C++ version
Nikolas Klauser [Mon, 5 Sep 2022 22:23:21 +0000 (00:23 +0200)]
[libc++] Bump _LIBCPP_STD_VER to the next expected C++ version

We've decided to use `_LIBCPP_STD_VER >= xy` while discussing to change the constexpr macros, so let's finally bump the version macro to match that.

Reviewed By: ldionne, Mordante, huixie90, #libc, avogelsgesang

Spies: avogelsgesang, libcxx-commits

Differential Revision: https://reviews.llvm.org/D133323

23 months ago[Linux] Hack around Linux/sparc <bits/stdio-ldbl.h>
Rainer Orth [Sat, 10 Sep 2022 07:37:35 +0000 (09:37 +0200)]
[Linux] Hack around Linux/sparc <bits/stdio-ldbl.h>

I've been using this hack to work around the Linux/sparc64 compile failure
described in Issue #47994
<https://github.com/llvm/llvm-project/issues/47994>, especially since the
underlying glibc PR build/27558
<https://sourceware.org/bugzilla/show_bug.cgi?id=27558> doesn't seem to be
making progress and some fix is required to have LLVM build on
`sparc64-unknown-linux-gnu` at all, as evidenced on the buildbot.

Tested on `sparc64-unknown-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D133405

23 months ago[ORC] Remove moves.
sunho [Sat, 10 Sep 2022 06:46:11 +0000 (15:46 +0900)]
[ORC] Remove moves.

23 months ago[ORC][ORC_RT][COFF] Remove public bootstrap method.
sunho [Sat, 10 Sep 2022 06:25:50 +0000 (15:25 +0900)]
[ORC][ORC_RT][COFF] Remove public bootstrap method.

Removes public bootstrap method that is not really necessary and not consistent with other platform API.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D132780

23 months ago[ORC][ORC_RT][COFF] Support dynamic VC runtime.
sunho [Sat, 10 Sep 2022 06:25:49 +0000 (15:25 +0900)]
[ORC][ORC_RT][COFF] Support dynamic VC runtime.

Supports dynamic VC runtime. It implements atexits handling which is required to load msvcrt.lib successfully. (the object file containing atexit symbol somehow resolves to static vc runtim symbols) It also default to dynamic vc runtime which tends to be more robust.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D132525

23 months ago[JITLink][COFF] Use DLLImportDefinitionGenerator for creating PLT stubs.
sunho [Sat, 10 Sep 2022 06:25:44 +0000 (15:25 +0900)]
[JITLink][COFF] Use DLLImportDefinitionGenerator for creating PLT stubs.

Uses DLLImportDefinitionGenerator for creating PLT stubs. It removes previous approach for dllimport stub creation which can't deal with jump thunks.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D132524

23 months ago[DAGCombiner] Use HandleSDNode to keep node alive across call to getNegatedExpression.
Craig Topper [Sat, 10 Sep 2022 05:02:40 +0000 (22:02 -0700)]
[DAGCombiner] Use HandleSDNode to keep node alive across call to getNegatedExpression.

getNegatedExpression can delete nodes. If the first call to
getNegatedExpression produced a node that the second call also
manages to create, it might get deleted. Use a HandleSDNode to
ensure it has a use to prevent it from being deleted.

Fixes PR57658.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D133602

23 months agoDocument some of the clang-specific DWARF extensions supported by LLDB
Adrian Prantl [Sat, 10 Sep 2022 00:47:53 +0000 (17:47 -0700)]
Document some of the clang-specific DWARF extensions supported by LLDB

This patch adds a new page to the LLDB documentation that documents,
among other things the -gmodules debug info format.

Differential Revision: https://reviews.llvm.org/D133519

23 months agodependency cycle fix in DynamicLoaderDarwinKernel
Jason Molenda [Sat, 10 Sep 2022 00:34:23 +0000 (17:34 -0700)]
dependency cycle fix in DynamicLoaderDarwinKernel

DynamicLoaderDarwinKernel calls in to PlatformDarwinKernel, and
with my changes in https://reviews.llvm.org/D133534, PlatformDarwinKernel
calls in to DynamicLoaderDarwinKernel.  This results in a cmake
dependency if accurately included in the link libraries list.

lldbPluginDynamicLoaderDarwinKernel is specfically for kernel
debugging and is uncommonly linked in to anything except a full
lldb.  lldbPluginPlatformMacOSX is any Darwin platform, including
PlatformDarwinKernel, and is referenced a number of time in shell
tests, for instance.

I believe anything linking the darwin kernel DynamicLoader plugin
will already have lldbPluginPlatformMacOSX in its dependency list,
so not explicitly expressing this dependency is safe.

23 months ago[clang][cmake] Remove extra brace
Mohammed Keyvanzadeh [Fri, 9 Sep 2022 20:11:17 +0000 (00:41 +0430)]
[clang][cmake] Remove extra brace

Remove the extra trailing brace from the local variable accessor.

Differential Revision: https://reviews.llvm.org/D133613

23 months ago[mlir][sparse] fix some asan detected leaks in integration tests
Aart Bik [Fri, 9 Sep 2022 23:55:03 +0000 (16:55 -0700)]
[mlir][sparse] fix some asan detected leaks in integration tests

One was an oversight, but the others seem something that regressed.
Matthias to have look later.

https://github.com/llvm/llvm-project/issues/57663

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D133624

23 months ago[llvm][lit] Respect GTEST_TOTAL_SHARDS and GTEST_SHARD_INDEX env vars
Joe Loser [Thu, 8 Sep 2022 23:34:09 +0000 (17:34 -0600)]
[llvm][lit] Respect GTEST_TOTAL_SHARDS and GTEST_SHARD_INDEX env vars

There are a variety of issues with using GTest sharding by default for users of
`lit` using the Google Test formatter as mentioned in
https://github.com/llvm/llvm-project/issues/56492 and
https://github.com/llvm/llvm-project/issues/56491.

Currently, there is no way for users to explicitly control the sharding
behavior, even with the environment variables that GTest provides. This patch
teaches the `googletest` formatter to actually respect `GTEST_TOTAL_SHARDS`
and `GTEST_SHARD_INDEX` environment variables if they are set.

In practice, we could go one step further and not do any of the post-processing
of the JSON files if `GTEST_TOTAL_SHARDS` is `1` for example, but that it left
as a follow-up if desired.  There may be preferred alternative approaches to
disabling sharding entirely through another mechanism, such as a lit config
variable.

Differential Revision: https://reviews.llvm.org/D133542

23 months ago[llvm] Remove includes of `llvm/Support/STLArrayExtras.h`
Joe Loser [Fri, 9 Sep 2022 18:47:56 +0000 (12:47 -0600)]
[llvm] Remove includes of `llvm/Support/STLArrayExtras.h`

`llvm` and downstream internal callers no longer use `array_lengthof`, so drop
the include everywhere.

Differential Revision: https://reviews.llvm.org/D133600

23 months ago[Clang][ScanDeps] Change multiple-commands.c test to use -fmodules-cache-path on...
Bruno Cardoso Lopes [Fri, 9 Sep 2022 22:10:31 +0000 (15:10 -0700)]
[Clang][ScanDeps] Change multiple-commands.c test to use -fmodules-cache-path on implicit builds

The module cache escapes the test output dirs in this test. Since its default location maybe
composed of system and user related path this can cause problems in some builders (e.g. not
accessible paths inherited in a chroot environment).

Clean the test a bit by passing `-fmodules-cache-path` inside the test output dirs.

Differential Revision: https://reviews.llvm.org/D133617

23 months ago[gn build] port 1a608cfb5ca8
Nico Weber [Fri, 9 Sep 2022 23:17:41 +0000 (19:17 -0400)]
[gn build] port 1a608cfb5ca8

23 months ago[gn build] port 48506fbbbf2732d (Mach-O-Fileset)
Nico Weber [Fri, 9 Sep 2022 23:17:19 +0000 (19:17 -0400)]
[gn build] port 48506fbbbf2732d (Mach-O-Fileset)

23 months agoAdd the ability to show when variables fails to be available when debug info is valid.
Greg Clayton [Tue, 30 Aug 2022 22:46:57 +0000 (15:46 -0700)]
Add the ability to show when variables fails to be available when debug info is valid.

Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience.

Examples of this include:
- enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables
- unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file.

This patch adds an new API to SBValueList:

  lldb::SBError lldb::SBValueList::GetError();

object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available.

This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList.

It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above:

(lldb) frame variable
error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match

Differential Revision: https://reviews.llvm.org/D133164

23 months ago[mlir][linalg] Add decomposition from conv_2d_nchw
Stanley Winata [Fri, 9 Sep 2022 23:00:33 +0000 (16:00 -0700)]
[mlir][linalg] Add decomposition from conv_2d_nchw

Decompose conv_2d_nchw_fchw -> conv_1d_ncw_fcw

Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D133551

23 months agoAdapt LLDB dataformatters for libcxx change D129386
Adrian Prantl [Fri, 9 Sep 2022 22:58:14 +0000 (15:58 -0700)]
Adapt LLDB dataformatters for libcxx change D129386

Differential Revision: https://reviews.llvm.org/D133618

23 months ago[ADT] Move LLVM_DEPRECATED before type after D133502
Fangrui Song [Fri, 9 Sep 2022 22:56:57 +0000 (15:56 -0700)]
[ADT] Move LLVM_DEPRECATED before type after D133502

`[[deprecated(...)]]` cannot appear between `inline size_t`.

23 months ago[LLDB][NativePDB] Replace blocks.cpp with blocks.s so the test won't be affected...
Zequan Wu [Fri, 9 Sep 2022 22:47:17 +0000 (15:47 -0700)]
[LLDB][NativePDB] Replace blocks.cpp with blocks.s so the test won't be affected by codegen changes.

23 months ago[Bazel] Port eb65327fe9d8b1a6824937e2b76f759101cd6416
Fangrui Song [Fri, 9 Sep 2022 22:35:52 +0000 (15:35 -0700)]
[Bazel] Port eb65327fe9d8b1a6824937e2b76f759101cd6416

23 months ago[mlir] Fix asan leak in BlockAndValueMapping test
River Riddle [Fri, 9 Sep 2022 21:57:04 +0000 (14:57 -0700)]
[mlir] Fix asan leak in BlockAndValueMapping test

Operations were being created without being erased.

23 months ago[mlir:SymbolTable] Add "remove" method that drops a symbol without erasing it
River Riddle [Fri, 9 Sep 2022 09:03:47 +0000 (02:03 -0700)]
[mlir:SymbolTable] Add "remove" method that drops a symbol without erasing it

There are various use cases where we don't want to immediately erase
an operation when removing it from the symbol table. This commit adds
a "remove" method to support that.

Differential Revision: https://reviews.llvm.org/D133564

23 months ago[NFC] Cleanup test for D132913 Preserve vec3 for HLSL
Xiang Li [Fri, 9 Sep 2022 22:03:35 +0000 (15:03 -0700)]
[NFC] Cleanup test for D132913 Preserve vec3 for HLSL

Support number for parameter test added in
https://reviews.llvm.org/D132913

23 months agoRecognize a platform binary in ProcessGDBRemote which determines plugins
Jason Molenda [Fri, 9 Sep 2022 21:52:59 +0000 (14:52 -0700)]
Recognize a platform binary in ProcessGDBRemote which determines plugins

Complete support of the binary-addresses key in the qProcessInfo packet
in ProcessGDBRemote, for detecting if one of the binaries needs to be
handled by a Platform plugin, and can be used to set the Process'
DynamicLoader plugin and the Target's Platform plugin.

Implement this method in PlatformDarwinKernel to recognize a kernel
fileset at that address, find the actual kernel address in the
fileset, set DynamicLoaderDarwinKernel and PlatformDarwinKernel
in the Process/Target; register the kernel address with the dynamic
loader so it will be loaded later during attach.

This patch only addresses the live debug scenario with a gdb remote
serial protocol connection. I'll handle corefiles in a subsequent
patch that builds on this.

Differential Revision: https://reviews.llvm.org/D133534
rdar://98754861

23 months ago[ELF] Merge Symbol::needs* into uint16_t flags. NFC
Fangrui Song [Fri, 9 Sep 2022 21:37:18 +0000 (14:37 -0700)]
[ELF] Merge Symbol::needs* into uint16_t flags. NFC

Split off from D133003 ([ELF] Parallelize relocation scanning) to make its diff smaller.

23 months ago[ADT] Mark `llvm::array_lengthof` as deprecated
Joe Loser [Thu, 8 Sep 2022 15:13:17 +0000 (09:13 -0600)]
[ADT] Mark `llvm::array_lengthof` as deprecated

As a follow-up of 5e96cea1db0623a833d5376c9ea2ce4528771f97, mark
`llvm::array_lengthof` as deprecated in favor of using `std::size` function
directly.

Differential Revision: https://reviews.llvm.org/D133502

23 months ago[lld] Use std::size instead of llvm::array_lengthof
Joe Loser [Fri, 9 Sep 2022 18:43:07 +0000 (12:43 -0600)]
[lld] Use std::size instead of llvm::array_lengthof

LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.

Differential Revision: https://reviews.llvm.org/D133598

23 months ago[mlir][arith] Fix unused variable warning. NFC.
Jakub Kuderski [Fri, 9 Sep 2022 21:17:50 +0000 (17:17 -0400)]
[mlir][arith] Fix unused variable warning. NFC.

23 months ago[test] Use either `127.0.0.1` or `[::1]` to run in ipv6-only environments.
Jordan Rupprecht [Wed, 7 Sep 2022 01:46:40 +0000 (18:46 -0700)]
[test] Use either `127.0.0.1` or `[::1]` to run in ipv6-only environments.

Test for both IPv4 and IPv6 support to determine if either `127.0.0.1` or `[::1]` are appropriate IP addresses to attempt to connect to. In an IPv6-only environment, `127.0.0.1` is not available.

Using `localhost` is problematic because we might not be able to get the same port on each IP flavor, and later try to connect to the wrong thing.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D133393

23 months ago[mlir][sparse] Add new option (enable-runtime-library) to sparse compiler pipeline
Peiming Liu [Fri, 9 Sep 2022 18:37:59 +0000 (18:37 +0000)]
[mlir][sparse] Add new option (enable-runtime-library) to sparse compiler pipeline

Add new option (enable-runtime-library) to sparse compiler pipeline, it allows us to decide whether we need to rewrite operations (e.g., concatenate, reshape) within sparsification (when using codegen) or convert them after sparsification (when using runtime library).

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133597

23 months ago[mlir][arith] Support wide integer addition emulation
Jakub Kuderski [Fri, 9 Sep 2022 20:48:00 +0000 (16:48 -0400)]
[mlir][arith] Support wide integer addition emulation

I tested this implementation for all i16 input pairs, when emulating i16
operations with i8 operations.

Reviewed By: antiagainst, Mogball

Differential Revision: https://reviews.llvm.org/D133137

23 months ago[mlir][spirv] Add support for fast math mode
Lei Zhang [Fri, 9 Sep 2022 20:16:36 +0000 (16:16 -0400)]
[mlir][spirv] Add support for fast math mode

This commit introduces a new option to SPIRVConversionOptions
to allow enabling fast math mode. With it, various patterns
would assume no NaN/infinity for floating point values and
avoid guards to check them. This is particularly useful for
CodeGen towards WebGPU environment, where fast math is assumed.

Along the way, fixed the conversion for arith.minf/maxf to
handle the NaN cases properly for Shader cases.

Part of https://github.com/llvm/llvm-project/issues/57584.

Reviewed By: ThomasRaoux, hanchung

Differential Revision: https://reviews.llvm.org/D133599

23 months ago[Libomptarget][NFC] Remove unused variable
Joseph Huber [Fri, 9 Sep 2022 20:26:02 +0000 (15:26 -0500)]
[Libomptarget][NFC] Remove unused variable

23 months ago[Libomptarget] Fix compiling with asserts using the bitcode library
Joseph Huber [Fri, 9 Sep 2022 18:18:16 +0000 (13:18 -0500)]
[Libomptarget] Fix compiling with asserts using the bitcode library

Sumnmary:
A previous patch introduces an `exports` file which contains all the
symbol names that are not internalized in the bitcode library. This is
done to reduce the size of the bitcode library and only export needed
functions. This export file must contain all the functoins expected to
be called from the device. Since its introduction the `__assert_fail`
function used to be provided but was mistakenly not included. This patch
adds it.

Fixes #57656

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D133594

23 months ago[mlir][spirv] NFC: move conversion options out of the type converter
Lei Zhang [Fri, 9 Sep 2022 19:46:17 +0000 (15:46 -0400)]
[mlir][spirv] NFC: move conversion options out of the type converter

This is a step for adding more options not directly related to type
conversion. Also with this we can now avoid the explicit constructor.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D133596

23 months ago[LV] Remove now dead variable after 2a78890b7b7f08 (NFC).
Florian Hahn [Fri, 9 Sep 2022 19:25:54 +0000 (20:25 +0100)]
[LV] Remove now dead variable after 2a78890b7b7f08 (NFC).

23 months ago[gn build] port 4d50a392401c (llvm-exegesis multi-target)
Nico Weber [Fri, 9 Sep 2022 19:04:04 +0000 (15:04 -0400)]
[gn build] port 4d50a392401c (llvm-exegesis multi-target)

Also ports follow-up 5a425b0b2f855c (I'm getting linker errors without it).

23 months ago[mlir] NFC: ConvertAsyncToLLVM: sort deps alphabetically
Emilio Cota [Fri, 9 Sep 2022 18:59:46 +0000 (14:59 -0400)]
[mlir] NFC: ConvertAsyncToLLVM: sort deps alphabetically

23 months ago[mlir] Improve bitEnumContains methods.
Hanhan Wang [Fri, 9 Sep 2022 18:56:29 +0000 (11:56 -0700)]
[mlir] Improve bitEnumContains methods.

https://github.com/llvm/llvm-project/commit/839b436c93604e042f74050cf2adadd75f30e898
changes the behavior. Based on the discussion, we also want to support
"and" behavior. The revision changes it into two functions, bitEnumContainsAny
and bitEnumContainsAll.

Reviewed By: krzysz00, antiagainst

Differential Revision: https://reviews.llvm.org/D133507

23 months ago[gn build] port 5e0464e38bcb (lld test zstd)
Nico Weber [Fri, 9 Sep 2022 18:48:26 +0000 (14:48 -0400)]
[gn build] port 5e0464e38bcb (lld test zstd)

23 months ago[mlir][CallGraph] Add special call graph node for representing unknown callees
Markus Böck [Fri, 9 Sep 2022 18:13:08 +0000 (20:13 +0200)]
[mlir][CallGraph] Add special call graph node for representing unknown callees

The callgraph currently contains a special external node that is used both as the quasi caller for any externally callable as well as callees that could not be resolved.
This has one negative side effect however, which is the motivation for this patch: It leads to every externally callable which contains a call that could not be resolved (eg. an indirect call), to be put into one giant SCC when iterating over the SCCs of the call graph.

This patch fixes that issue by creating a second special callgraph node that acts as the callee for any unresolved callable. This breaks the cycles produced in the callgraph, yielding proper SCCs for all direct calls.

Differential Revision: https://reviews.llvm.org/D133585

23 months ago[VPlan] Move SCEV expansion for pointer induction to VPExpandSCEV (NFC).
Florian Hahn [Fri, 9 Sep 2022 18:20:12 +0000 (19:20 +0100)]
[VPlan] Move SCEV expansion for pointer induction to VPExpandSCEV (NFC).

Use VPExpandSCEVRecipe to expand the step of pointer inductions. This
cleanup addresses a corresponding FIXME.

It should be NFC, as steps for pointer induction must be constants,
which makes expansion trivial.

23 months agoSpeculative bot fix after 4d50a392
Philip Reames [Fri, 9 Sep 2022 18:16:53 +0000 (11:16 -0700)]
Speculative bot fix after 4d50a392

https://lab.llvm.org/buildbot#builders/56/builds/3201 failed with a link error being unable to initialize the disassembler.  Oddly, this bot is the *only* bot which appears to have failed in this way.  (A bunch sent warnings, but that appears to be spurious due to cmake rebuilds on incremental bots.)  Why only polly would witness this is an excercise for the reader - because I have no clue.

23 months agoOpenMP: mark allocptr attribute on __kmpc_free_shared
Augie Fackler [Wed, 27 Apr 2022 00:33:35 +0000 (20:33 -0400)]
OpenMP: mark allocptr attribute on __kmpc_free_shared

Differential Revision: https://reviews.llvm.org/D124491

23 months ago[mlir][sparse] Avoid generating DimOp in conversion passes.
Peiming Liu [Fri, 9 Sep 2022 17:29:16 +0000 (17:29 +0000)]
[mlir][sparse] Avoid generating DimOp in conversion passes.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133592

23 months ago[HLSL] Preserve vec3 for HLSL.
Xiang Li [Tue, 30 Aug 2022 07:35:25 +0000 (00:35 -0700)]
[HLSL] Preserve vec3 for HLSL.

Preserve vec3 for HLSL by set -fpreserve-vec3-type.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D132913

23 months agoLoop names used in reporting can grow very large
Jamie Schmeiser [Fri, 9 Sep 2022 17:43:58 +0000 (13:43 -0400)]
Loop names used in reporting can grow very large

Summary:
The code for generating a name for loops for various reporting scenarios
created a name by serializing the loop into a string.  This may result in
a very large name for a loop containing many blocks.  Use the getName()
function on the loop instead.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: Whitney (Whitney Tsang), aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D133587

23 months agoTemporarily XFAIL libcxx tests.
Adrian Prantl [Fri, 9 Sep 2022 17:40:41 +0000 (10:40 -0700)]
Temporarily XFAIL libcxx tests.

These tests started failing on green dragon after a configuration change that compiles tests using the just-built libcxx. We may need to force the system libcxx here, or change LLDB to import the std module from the just-built libcxx, too.

23 months ago[ELF] Add --compress-debug-sections=zstd
Fangrui Song [Fri, 9 Sep 2022 17:30:18 +0000 (10:30 -0700)]
[ELF] Add --compress-debug-sections=zstd

`clang -gz=zstd a.o` passes this option to the linker. This option compresses output
debug sections with zstd and sets ch_type to ELFCOMPRESS_ZSTD. As of today, very
few DWARF consumers recognize ELFCOMPRESS_ZSTD.

Use the llvm::zstd::compress API with level llvm::zstd::DefaultCompression (5),
which we may tune after we have more experience with zstd output.
zstd has built-in parallel compression support (so we don't need to do D117853
for zlib), which is not leveraged yet.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D133548

23 months ago[Flang][OpenMP] Add support for logical and reduction in worksharing-loop
Dylan Fleming [Fri, 9 Sep 2022 17:18:27 +0000 (17:18 +0000)]
[Flang][OpenMP] Add support for logical and reduction in worksharing-loop

Adds support for .and. reductions with logical types.

Because arith.addi doesn'to work with fir.logical<4> types
logical<4> must be converted to i1 prior to the operation.

This means that the pattern matched by integer reductions
(load -> op -> store) will not match logical reductions.
Instead, the pattern being searched for here is
load -> convert(logical<4> to i1) -> op -> convert(i1 to logical<4>) -> store

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D132228