Commit Graph

463338 Commits

Author SHA1 Message Date
Simon Pilgrim
9424a54201 [GlobalIsel][X86] Update legalization of G_AND/G_OR/G_XOR
Replace the legacy G_AND/G_OR/G_XOR legalizer, this handles all scalar promotion and vector clamping (allows AVX1 to handle 256-bit logic ops).
2023-06-04 11:44:27 +01:00
Sergei Barannikov
c37e6a269e [Hexagon] Check if register is non-null before calling subregs_inclusive
D151036 adds an assertions that prohibits iterating over sub- and
super-registers of a null register. This is already the case when
iterating over register units of a null register, and worked by
accident for sub- and super-registers.

Reviewed By: kparzysz

Differential Revision: https://reviews.llvm.org/D151406
2023-06-04 12:40:04 +03:00
Amara Emerson
fbdcd54442 [GlobalISel] Fix DIVREM combine from inserting a divrem before its operands' defs.
In some rare corner cases where in between the div/rem pair there's a def of
the second instruction's source (but a different vreg due to the combine's
eqivalence checks), it will place the DIVREM at the first instruction's point,
causing a use-before-def. There wasn't an obvious fix that stood out to me
without doing more involved analysis than a combine should really be doing.

Fixes issue #60516

I'm open to new suggestions on how to approach this, as I'm not too happy
at bailing out here. It's not the first time we run into issues with value liveness
that the DAG world isn't affected by.

Differential Revision: https://reviews.llvm.org/D144336
2023-06-04 00:24:38 -07:00
khei4
f4eafba206 [MemCpyOpt] Remove unnecessary bitcast and reuse some variables for ByValOptimization (NFC)
Differential Revision: https://reviews.llvm.org/D152056
2023-06-04 15:37:41 +09:00
Kazu Hirata
8514082f54 [MC] Modernize InlineAsmIdentifier (NFC) 2023-06-03 23:36:54 -07:00
Kazu Hirata
52543545b0 [IR] Remove unused declaration removeParamUndefImplyingAttrs
The corresponding function definition was removed by:

  commit 087a8eea35
  Author: Nikita Popov <nikita.ppv@gmail.com>
  Date:   Sun Jul 25 18:21:13 2021 +0200
2023-06-03 23:36:53 -07:00
Kazu Hirata
2029d39261 [DWARFLinker] Remove unused declaration keepDIEAndDependencies
The corresponding function definition was removed by:

  commit 95a8e8a255
  Author: Jonas Devlieghere <jonas@devlieghere.com>
  Date:   Tue Dec 3 11:10:04 2019 -0800
2023-06-03 23:36:51 -07:00
Kazu Hirata
59048a3aa3 [AST] Remove unused declaration makeDeclVisibleInContextInternal
The corresponding function definition was removed by:

  commit f634c90069
  Author: Richard Smith <richard-llvm@metafoo.co.uk>
  Date:   Fri Mar 16 06:12:59 2012 +0000
2023-06-03 23:36:50 -07:00
Timm Bäder
808004f82a [clang][NFC] Reformat expandTabs
Use the proper capitalization here as well as a init capture for better
identifiers.
2023-06-04 07:52:46 +02:00
Patryk Wychowaniec
ff75a2be34 [AVR] Fix incorrect operands of pseudo instruction 'ROLBRd'
Fixes https://github.com/llvm/llvm-project/issues/63098

Reviewed by: benshi001

Differential Revision: https://reviews.llvm.org/D152063
2023-06-04 11:08:57 +08:00
Matt Arsenault
79c27e0b47 Attributor: Fix comment typos 2023-06-03 21:11:19 -04:00
Aiden Grossman
ea8f4b9841 [libc][CMake] Place archives in build/lib/<target-triple>
This patch moves the location of libllvmlibc.a within the build tree to
within ./lib/<target triple>. This more closely matches the behavior of
other runtime builds and allows for clang in the same build tree to
automatically be able to link against llvmlibc since this path is by
default included by the driver.

Also removes the LIBC_BINARY_DIR CMake flag since it isn't used anywhere
in the tree (based on a quick grep).

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D151624
2023-06-03 22:40:03 +00:00
Aiden Grossman
2ff0aa207f [CMake][Fuchsia] Add LLVM_ENABLE_HTTPLIB to Stage 2 build
This patch sets the LLVM_ENABLE_HTTPLIB flag to ON in the stage 2 build
similar to how many of the other dependency flags are already specified.
This is necessary to configure the stage 2 build by itself, otherwise
the CMake configuration crashes.

This is currently causing the MLGO demo to fail since we're only using
stage 2 to avoid having to build stage 1 to save some compile time.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D152057
2023-06-03 22:30:19 +00:00
Aiden Grossman
2f93cfebb5 [Docs][CMake] Add LLVM_ENABLE_HTTPLIB to CMake options list
This patch adds LLVM_ENABLE_HTTPLIB to the list of CMake options to make
it more clear exactly what it does and also provide clarity on which
specific project it is referring to/installation.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D152060
2023-06-03 22:27:09 +00:00
Martin Storsjö
ac0ea7555e [clang-tools-extra] Fix linking when built with CLANG_LINK_CLANG_DYLIB=ON
clangIncludeCleaner isn't part of libclang-cpp, so link it with
target_link_libraries instead of clang_target_link_libraries.

This fixes a regression from
c28506ba4b.

Fix suggested by Michal Gorny.
2023-06-03 23:25:33 +03:00
Martin Storsjö
fcbbd9649a [libcxx] Fix using std::wcout/wcin on Windows with streams configured in wide mode
On Windows, the underlying file descriptors for stdout/stdin/stderr
can be reconfigured to wide mode. In the default (narrow) mode, the
charset usually isn't utf8 (as libcxx assumes), but normally a locale
specific codepage (where each codepage only can represent a small
subset of unicode characters).

By configuring the stdout file descriptor to wide mode, the user can
output wchar_t based strings without convesion to the narrow charset.
Within libcxx, don't try to use codecvt to convert this to a narrow
character encoding, but output these strings as such with fputwc.

In wide mode, such strings could be output directly with fwrite too,
but if the file descriptor hasn't been configured in wide mode, that
breaks the output (which currently works reasonably). By always
outputting one character at a time with fputwc, it works regardless
of mode of the stdout file descriptor.

For the narrow output stream, std::cout, outputting (via fwrite)
does fail when the file descriptor is set to wide mode. This matches
how it behaves with both MS STL and GNU libstdc++ too, so this is
probably acceptable.

This fixes https://github.com/llvm/llvm-project/issues/46646, and
the downstream bugs https://github.com/mstorsjo/llvm-mingw/issues/145
and https://github.com/mstorsjo/llvm-mingw/issues/222.

Differential Revision: https://reviews.llvm.org/D146398
2023-06-03 23:11:39 +03:00
Owen Pan
4b9764959d [clang-format] Fix overlapping replacements before PPDirectives
If the first token of an annotated line is finalized, reuse its
NewlinesBefore value to avoid potential overlapping whitespace
replacements before preprocessor branching directives.

Fixes #62892.

Differential Revision: https://reviews.llvm.org/D151954
2023-06-03 12:33:03 -07:00
Kazu Hirata
797564104a [MCA] Modernize Stage (NFC) 2023-06-03 11:01:18 -07:00
Kazu Hirata
83d4f681c8 [MCA] Modernize RAWHazard (NFC) 2023-06-03 11:01:17 -07:00
Kazu Hirata
6d4d019654 [MCA] Modernize MemoryGroup (NFC) 2023-06-03 11:01:15 -07:00
Kazu Hirata
b48ebad561 [MCA] Modernize StallInfo (NFC) 2023-06-03 10:38:55 -07:00
Kazu Hirata
87709b719c [llvm-mca] Modernize MCACommentConsumer (NFC) 2023-06-03 10:38:53 -07:00
Kazu Hirata
064b98fc5f [MCA] Modernize IncrementalSourceMgr (NFC) 2023-06-03 10:38:51 -07:00
Simon Pilgrim
4dcd66a005 [GlobalIsel][X86] Update legalization of G_MUL
Replace the legacy G_MUL legalizer, this handles all scalar promotion and vector clamping, however we still need to add custom legalization for many vector multiplies.
2023-06-03 18:22:02 +01:00
eopXD
1cb382718a [Clang][RISCV] Avoid generating MaskedPrototype if the intrinsic does not have a masked version. NFC
The function should not be called if an intrinsic does not have a masked version.

Signed-off by: eop Chen <eop.chen@sifive.com>
2023-06-03 10:20:04 -07:00
Kazu Hirata
2a8c1fd20b [MCA] Modernize Pipeline (NFC) 2023-06-03 09:37:39 -07:00
Kazu Hirata
8e6e659cc8 [Serialization] Remove unused function getKnownModules
The last use was removed by:

  commit 603cd869f7
  Author: Douglas Gregor <dgregor@apple.com>
  Date:   Fri Mar 22 18:50:14 2013 +0000
2023-06-03 09:37:37 -07:00
Kazu Hirata
8dc7647845 [AST] Use DenseMapBase::lookup (NFC) 2023-06-03 09:37:36 -07:00
Corentin Jabot
684f3c968d [Clang] Fix status of P0960
P0960R3 and P1975R0 were marked not implemented because
of #61145,

This issue has been fixed and backported to LLVM 16,
the status page should reflect that.

Reviewed By: #clang-language-wg, ayzhao, erichkeane

Differential Revision: https://reviews.llvm.org/D150122
2023-06-03 17:03:42 +02:00
zhongyunde
34d380e1f6 [IndVars] Add check of loop invariant for indirect use
We usually only check direct use instruction of IV, while the
bitcast of 'ptrtoint ptr to i64' doesn't affect the result, so go
a step further.
Fix https://github.com/llvm/llvm-project/issues/59633.

Reviewed By: markoshorro
Differential Revision: https://reviews.llvm.org/D151877
2023-06-03 22:29:09 +08:00
Hussain Kadhem
287f201f9d [flang] Fix for 541f5c4a6d (D140524) breaking out-of-tree flang build. 2023-06-03 15:19:01 +02:00
paperchalice
0beffb8542 [CMake] Ensure CLANG_RESOURCE_DIR is respected.
re-commit of 39aa0f5c43 with missing file:
cmake/Modules/GetClangResourceDir.cmake.
2023-06-03 04:21:35 -07:00
Sheng
4c2ec08ebc [m68k] Add TLS Support
This patch introduces TLS (Thread-Local Storage) support to the LLVM m68k backend.

Reviewed By: glaubitz

Differential Revision: https://reviews.llvm.org/D144941
2023-06-03 19:09:47 +08:00
Sheng
40d89de4c5 [m68k] Implement absolution long addressing mode for ADDA instruction
Reviewed By: myhsu

Differential Revision: https://reviews.llvm.org/D143316
2023-06-03 19:09:47 +08:00
Sheng
6595cb1dbb [m68k] Implement BSR Instruction
Reviewed By: myhsu

Differential Revision: https://reviews.llvm.org/D143315
2023-06-03 19:09:47 +08:00
Sheng
2f62803ea4 coach UpdateTestChecks to filter out certain symbol aliases for m68k
This patch coaches UpdateTestChecks to filter out these symbol aliases in llc test for m68k
- .L<function name>$local:
- .type .L<function name>$local,@function

Reviewed By: myhsu

Differential Revision: https://reviews.llvm.org/D151526
2023-06-03 19:09:47 +08:00
Simon Pilgrim
41f8b6fe74 [GlobalIsel][X86] Regenerate G_MUL scalar legalization tests
Add i8 test coverage
2023-06-03 11:18:51 +01:00
Martin Storsjö
d072d11022 Revert "[CMake] Ensure CLANG_RESOURCE_DIR is respected."
This reverts commit 39aa0f5c43.

This is missing the new GetClangResourceDir.cmake that is being included,
so all clang builds are broken.
2023-06-03 11:47:57 +03:00
Mike Hommey
57dc16fbe3
[llvm] Strip stabs symbols in Mach-O when stripping debug info 2023-06-03 09:31:42 +02:00
luxufan
1ac99bc452 [InstSimplify] Simplify select i1 ConstExpr, i1 true, i1 false to ConstExpr
`select i1 non-const, i1 true, i1 false` has been optimized to
`non-const`. There is no reason that we can not optimize `select i1
ConstExpr, i1 true, i1 false` to `ConstExpr`.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D151631
2023-06-03 15:09:00 +08:00
paperchalice
39aa0f5c43 [CMake] Ensure CLANG_RESOURCE_DIR is respected. 2023-06-02 23:29:44 -07:00
Nitin John Raj
aa7eace843 [TableGen][GlobalISel] Account for HwMode in RegisterBank register sizes
This patch adds logic for determining RegisterBank size to RegisterBankInfo, which allows accounting for the HwMode of the target. Individual RegisterBanks cannot be constructed with HwMode information as construction is generated by TableGen, but a RegisterBankInfo subclass can provide the HwMode as a constructor argument. The HwMode is used to select the appropriate RegisterBank size from an array relating sizes to RegisterBanks.

Targets simply need to provide the HwMode argument to the <target>GenRegisterBankInfo constructor. The RISC-V RegisterBankInfo constructor has been updated accordingly (plus an unused argument removed).

Reviewed By: simoncook, craig.topper

Differential Revision: https://reviews.llvm.org/D76007
2023-06-02 23:14:17 -07:00
Austin Kerbow
e501ed84aa [AMDGPU] Don't flush vmcnt for loops with use/def pairs
Conditions for hoisting vmcnt with flat instructions should be similar to VMEM.
If there are use/def pairs in a loop body we cannot guarantee that hosting the
waitcnt will be profitable. Better heuristics are needed to analyse whether
gains from avoiding waitcnt in loop bodys outweighs waiting for loads in the
preheader.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D151126
2023-06-02 22:55:12 -07:00
Kazu Hirata
fb7f50a0c3 [CodeGen] Use DenseMapBase::lookup (NFC)
Note that DenseMapBase::lookup and Reg2MIMap::get do exactly the same
thing.
2023-06-02 21:05:13 -07:00
Yeting Kuo
84ee08c6a8 [RISCV] Avoid illegal DAG combination for strict-fp nodes.
Those combines may change the exception behavior and rounding behavior.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D151992
2023-06-03 10:29:30 +08:00
Peiming Liu
e7b4c93f5e [mlir][sparse] fix crash when using sparse_tensor::UnaryOp and ReduceOp.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D152048
2023-06-03 01:19:05 +00:00
Tue Ly
5a4e344bd9 [libc][NFC] Add LIBC_INLINE and attribute.h header includes to targets' FMA.h.
Targets' FMA.h headers are missing LIBC_INLINE and attributes.h header.

Reviewed By: brooksmoses

Differential Revision: https://reviews.llvm.org/D152024
2023-06-02 21:15:58 -04:00
Aart Bik
6a38c772d4 [mlir][sparse] fixed bug with unary op, dense output
Note that by sparse compiler convention, dense output
is zerod out when not set, so complement results in
zeros where elements were present.

Reviewed By: wrengr

Differential Revision: https://reviews.llvm.org/D152046
2023-06-02 18:15:33 -07:00
Caslyn Tonelli
0a168131b4 [scudo] Add 'inline' to static secondary.h function
This patches an error flaged by Fuchsia builds e.g.
https://ci.chromium.org/ui/p/turquoise/builders/global.try/core.x64-asan/b8779376650819379137/overview)

```
build failed:

[87176/332302](525) CXX user.libc_x64-asan-ubsan/obj/zircon/system/ulib/c/scudo/gwp-asan-info.gwp_asan_info.cc.o
FAILED: user.libc_x64-asan-ubsan/obj/zircon/system/ulib/c/scudo/gwp-asan-info.gwp_asan_info.cc.o
../../prebuilt/third_party/python3/linux-x64/bin/python3.8 -S ../../build/rbe/cxx_remote_wrapper.py --exec_strategy=remote_local_fallback --  ../../prebuilt/third_party/clang/linux-x64/bin/clang++ -MD -MF user.libc_x64-asan-ubsan/obj/zircon/system/ulib/c/scudo/gwp-asan-info.gwp_asan_info.cc.o.d -o user.libc_x64-asan-ubsan/obj/zircon/system/ulib/c/scudo/gwp-asan-info.gwp_asan_info.cc.o -D_LIBCPP...
In file included from ../../zircon/system/ulib/c/scudo/gwp_asan_info.cc:7:
In file included from ../../third_party/scudo/src/allocator_config.h:12:
In file included from ../../third_party/scudo/src/combined.h:22:
../../third_party/scudo/src/secondary.h:67:13: error: 'static' function 'unmap' declared in header file should be declared 'static inline' [-Werror,-Wunneeded-internal-declaration]
static void unmap(LargeBlock::Header *H) {
            ^
1 error generated.
```

Differential Revision: https://reviews.llvm.org/D152038
2023-06-02 23:47:27 +00:00
Nico Weber
ddc7625e3d [gn] port 6b3ae49d32 2023-06-02 19:37:10 -04:00