Commit Graph

488014 Commits

Author SHA1 Message Date
Maksim Panchenko
0fc791cd2c [BOLT] Fix comparison function for Linux ORC entries (#79921)
Fix ORC entry comparison function to cover a case with multiple
terminator entries matching at the same IP.
2024-01-29 17:45:40 -08:00
Diego Caballero
a694104022 [mlir][Vector] Add patterns for efficient i4 -> i8 conversion emulation (#79494)
This PR adds new patterns to improve the generated vector code for the emulation of any conversion that have to go through an i4 -> i8 type extension (only signed extensions are supported for now). This will impact any i4 -> i8/i16/i32/i64 signed extensions as well as sitofp i4 -> f8/f16/f32/f64.

The asm code generated for the supported cases is significantly better after this PR for both x86 and aarch64.
2024-01-29 17:44:06 -08:00
kusmour
59c9a48d5e [llvm-gsymutil] Fix assert failure on FileEntry.Dir empty (#79926)
Summary:
FileEntry.Dir can be empty if debug info only contains relative path.
This caused an assertion failure when gsym segmentation is trying to
copy a file entry with empty dir. As the fitst entry of StringTable is
always empty (and is preserved), `StringOffsetMap` doesn't have key 0.
Hence, `find(0)` returns `End` and `operator->()` fails the assertion

Test Plan:
./bin/llvm-lit -sv llvm/test/tools/llvm-gsymutil/X86/elf-empty-dir.yaml
2024-01-29 20:41:02 -05:00
Peter Klausler
3d1157000d [flang] Restore error status for many indistinguishable specifics (#79927)
A recent patch to allow pFUnit to compile softened the diagnostic about
indistinguishable specific procedures to a portability warning. It turns
out that this was overkill -- for specific procedures containing no
optional or unlimited polymorphic dummy data arguments, a diagnosis of
"indistinguishable" can still be a hard error.

So adjust the analysis to be tri-state: two procedures are either
definitely distinguishable, definitely indistinguishable without
optionals or unlimited polymorphics, or indeterminate. Emit errors as
before for the definitely indistinguishable cases; continue to emit
portability warnings for the indeterminate cases.

When this patch is merged, all but one of the dozen or so tests that I
disabled in llvm-test-suite can be re-enabled.
2024-01-29 17:31:35 -08:00
Maksim Panchenko
aa1968c2eb [BOLT] Add metadata pre-emit finalization interface (#79925)
Some metadata needs to be updated/finalized before the binary context is
emitted into the binary. Add the interface and use it for Linux ORC
update invocation.
2024-01-29 17:27:33 -08:00
Nick Desaulniers
6b330470df [libc] add more arch entrypoints for stdc_leading_zeros (#79923)
Otherwise the include test fails on these targets.
2024-01-29 16:57:17 -08:00
Nick Desaulniers
5a7a8f73c7 [libc] fix type generic stdc_leading_zeros for GCC (#79917)
GCC does not support _Generic in C++ mode. Use inline function definitions with
function overloading in __cplusplus mode.
2024-01-29 16:40:03 -08:00
Justin Fargnoli
577738a12d Revert "Disable incorrect peephole optimizations" (#79916)
This reverts commit ff77058141.
2024-01-29 16:22:07 -08:00
Joseph Huber
d29bb704cb [libc][NFC] Remove inline assembly for PTX instructions (#79913)
Summary:
Recent patches have implemented builitin versions of these functions.
This patch simply removes uses of inline assembly to hopefully improve
optimizations in this area.
2024-01-29 18:18:04 -06:00
Justin Fargnoli
ff77058141 Disable incorrect peephole optimizations 2024-01-29 15:54:40 -08:00
Nick Desaulniers
7bc5eaa02f [libc] implement stdc_leading_zeros_u* for stdbit.h (#79669)
- stdbit.stdc_leading_zeros_uc
- stdbit.stdc_leading_zeros_us
- stdbit.stdc_leading_zeros_ui
- stdbit.stdc_leading_zeros_ul
- stdbit.stdc_leading_zeros_ull

Test via:
$ ninja libc-stdbit-tests libc_include_tests
2024-01-29 15:47:55 -08:00
Joseph Huber
51379a982e [CUDA] Change '__activemask' to use '__nvvm_activemask()' (#79892)
Summary:
We recently added builitin support for this function.
2024-01-29 17:34:45 -06:00
Joseph Huber
0a2b5b03c4 [NVPTX][Fix] Ensure the return value of 'activemask' is unsigned
Summary:
The previous patch missed the `U` prefix, which caused the mask to be
considered signed. This meant that conversions would incorrectly treat a
full mask as a negative number and break things.
2024-01-29 17:33:38 -06:00
Jivan Hakobyan
0461448313 [RISCV][ISel] Add ISel support for experimental Zimop extension (#77089)
This implements ISel support for mopr[0-31] and moprr[0-7] instructions
for 32 and 64 bits

---------

Co-authored-by: ln8-8 <lyut.nersisyan@gmail.com>
2024-01-29 15:24:00 -08:00
Craig Topper
7855703194 [RISCV] Move vp.splice tests into rvv directory. NFC 2024-01-29 15:01:52 -08:00
Valentin Clement (バレンタイン クレメン)
3c8a5800f5 [flang][openacc] Place post allocate/deallocate attribute correctly (#79883)
The `acc.declate_action` attribute was sometime misplaced as reported in
#79770.
This patch updates the lowering code to place the
postAllocate/postDeallocate actions at the correct place.
2024-01-29 14:56:26 -08:00
Peter Klausler
c322e92841 [flang] Silence bogus USE statement error (#79896)
When there are multiple USE statement for a particular module using
renaming, it is necessary to collect a set of all of the original
renaming targets before processing any of USE statements that don't have
ONLY: clauses.

Currently, if there is a name in the module that can't be added to the
current scope -- due to a conflict with an internal or module
subprogram, or with a previously use-associated name -- the compiler
will emit a bogus error message even if that conflicting name appear on
a later USE statement of the same module as the target of a renaming.

The new regression test case added with this patch provides a motivating
example.
2024-01-29 14:51:47 -08:00
yronglin
0aff71c178 [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (#76361)
Implement P2718R0 "Lifetime extension in range-based for loops"
(https://wg21.link/P2718R0)

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

---------

Signed-off-by: yronglin <yronglin777@gmail.com>
2024-01-30 06:48:14 +08:00
Peter Klausler
37180ed743 [flang] Turn "error" cases into warning for "indistinguishable" specific procedures (#79621)
When a generic procedure interface, either declared or the result of
    merging two use-associated generics, has two specific procedures
    that are not distinguishable according to the rules in F'2023
    subclause 15.4.3.4.5, emit a portability warning rather than a
    hard error message.  The rules in that subclause are not adequate
    to detect pairs of specific procedures that admit an ambiguous
    reference, as demonstrated by a case that arose in pFUnit.  Further,
    these distinguishability checks, even if sufficient to the task
    of detecting pairs of specifics capable of ambiguous references,
    should only apply to pairs where *every* reference would have to
    be ambiguous -- and this can and is validated at every reference
    anyway.  Last, only XLF enforces these incomplete and needless
    distinguishability rules -- every other compiler seems to just
    check that each procedure reference resolves to exactly one
    specific procedure.
    
    If the standard were to complete lose subclause 15.4.3.4.5 and
    its related note (C.11.6) -- which admits that the rules are
    incomplete! -- and simply require that each generic procedure
    reference resolve unambiguously to exactly one specific, nobody
    would miss them.  This patch changes this compiler to give them
    lip service when requested, but they are now otherwise ignored.
2024-01-29 14:36:37 -08:00
Peter Klausler
d83c977147 [flang] Prevent bad expression rewrite 0*ARR -> 0 (#79853)
Don't rewrite 0*X to 0 if X is not scalar. Up until now this hasn't
shown up as a bug because a scalar 0 works in nearly all expressions
where an array would be expected. But not in all cases -- this bad
rewrite can cause generic procedure resolution to fail when it causes an
actual argument to have an unsupported rank.
2024-01-29 14:25:53 -08:00
Arthur Eubanks
d6e07e0845 [X86] Treat __ehdr_start as large (#79884)
The __ehdr_start symbol is added by the linker and points to the ELF
file headers, which can be very far away from text. Treat it as a large
symbol under the medium/large code models. Performance to access
__ehdr_start is almost certainly not important.

There are a couple of other symbols that the linker adds [1], but this
is the most relevant one that may be far away from text.

[1]
547c395b27/lld/ELF/Writer.cpp (L226)
2024-01-29 14:25:40 -08:00
Evgenii Stepanov
c82f3caf56 [scudo] Add StackDepot lock to enable/disable. (#79670)
Scudo grabs all allocator locks in a pthread_atfork before the fork, and releases them after. This allows malloc to be used in a fork child of a multithreaded process, which is expressly forbidden by the standard, but very widely used. For example, Android's init uses std::string after fork when spawning services in android::init::EnterNamespaces and other places.

Any lock that is necessary to serve an allocator call must be handled this way. Otherwise there is a possibility that the lock is held during the call to fork, which results in it being held forever in the child process, and the next operation that needs it deadlocks.
2024-01-29 14:22:24 -08:00
Peter Klausler
e6fdbd1776 [flang][runtime] Add special-case faster path to real MOD/MODULO (#79625)
When a real-valued reference to the MOD/MODULO intrinsic functions has
operands that are exact integers, use the fast exact integer algorithm
rather than calling std::fmod.
2024-01-29 14:13:27 -08:00
Vitaly Buka
8dbedf49d7 [sanitizer] Allow *___lcxx_override symbolse in symbolizer (#79904)
We don't intercept them, and they are not called and used only as
markers anyway.

These symbols introduced with #69498.
2024-01-29 13:57:02 -08:00
Peter Klausler
74bebee08e [flang] Fix compiler crash in semantics (#79609)
The runtime type information table generator couldn't handle a null
pointer returned correctly for a original (not instantiated) derived
type with kind parameters.

Fixes https://github.com/llvm/llvm-project/issues/79590.
2024-01-29 13:55:34 -08:00
Nilanjana Basu
c492eb6b28 [LV] Update interleaving count computation when scalar epilogue loop needs to run at least once (#79651)
Update loop interleaving count computation to address loops that require at least one scalar iteration in the epilogue loop. For this case, the available trip count for interleaving the loop is one less.
2024-01-29 13:41:15 -08:00
Fangrui Song
9a1ca245c8 [ELF] --warn-backrefs: --defsym does not make a backward reference
The interaction between --warn-backrefs was not tested, but if
--defsym-created reference causes archive member extraction, it seems
reasonable to suppress the diagnostic, which was the behavior before #78944.
2024-01-29 13:26:33 -08:00
Joseph Huber
e633807a1f [NVPTX] Add builtin support for 'globaltimer' (#79765)
Summary:
This patch adds support for `globaltimer` to match `clock` and
`clock64`. See the PTX ISA reference for details. This patch does not
implement the `hi` or `lo` variants for brevity as they can be obtained
from this with the cost of an additional register.

https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#special-registers-globaltimer-globaltimer-lo-globaltimer-hi
2024-01-29 14:11:54 -06:00
Joseph Huber
ea8014046c [NVPTX] Add builtin for 'exit' handling (#79777)
Summary:
The PTX ISA has always supported the 'exit' instruction to terminate
individual threads. This patch adds a builtin to handle it. See the PTX
documentation for further details.

https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#control-flow-instructions-exit
2024-01-29 14:09:34 -06:00
Joseph Huber
5f12cc912a [NVPTX] Add builtin support for 'nanosleep' PTX instrunction (#79888)
Summary:
This patch adds a builtin for the `nanosleep` PTX function. It takes
either an immediate or a register and sleeps for [0, 2t] nanoseconds
given t. More information at the documentation:

https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#miscellaneous-instructions-nanosleep
2024-01-29 14:07:58 -06:00
Joseph Huber
d492faa7aa [NVPTX] Add 'activemask' builtin and intrinsic support (#79768)
Summary:
This patch adds support for getting the 'activemask' instruction's value
without needing to use inline assembly. See the relevant PTX reference
for details.


https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#parallel-synchronization-and-communication-instructions-activemask
2024-01-29 14:07:30 -06:00
Fangrui Song
3d0a689eb7 [llvm-cov] Simplify and optimize MC/DC computation (#79727)
Update code from https://reviews.llvm.org/D138847

`buildTestVector` is a standard DFS (walking a reduced ordered binary
decision diagram). Avoid shouldCopyOffTestVectorFor{True,False}Path
complexity and redundant `Map[ID]` lookups.

`findIndependencePairs` unnecessarily uses four nested loops (n<=6) to
find independence pairs. Instead, enumerate the two execution vectors
and find the number of mismatches. This algorithm can be optimized using
the marking function technique described in _Efficient Test Coverage
Measurement for MC/DC,  2013_, but this may be overkill.
2024-01-29 12:07:13 -08:00
Aiden Grossman
faf675ce34 [llvm-exegesis] Remove llvm prefix where unnecessary (#79802)
This patch removes the llvm:: prefix within llvm-exegesis where it is
not necessary. This is most occurrences of the prefix within exegesis as
exegesis is within the llvm namespace. This patch makes things more
consistent as the vast majority of the code did not use the llvm::
prefix for anything.
2024-01-29 11:40:06 -08:00
David Majnemer
0039a2ff4f [mlir][gpu] Add support for lowering math.erf to __nv_erf (#79848) 2024-01-29 19:35:23 +00:00
Louis Dionne
d9f1791a0a [libc++] Move release note to the right section 2024-01-29 14:33:27 -05:00
Louis Dionne
eac8d713a6 [libc++][ci] Update upload-artifact@v3 and hashpin the version (#79854)
The upload-artifact@v3 action is using Node 16, which is reaching EOL.
As a result, we are getting warnings prompting us to move our jobs over
to the latest version of upload-artifact.
2024-01-29 14:20:18 -05:00
Louis Dionne
c576ab6bc5 [libc++] Avoid including libc++ private header in std/ test (#79856)
Fixes #79783
2024-01-29 14:19:34 -05:00
Craig Topper
295059409f [PatternMatch] Use dyn_cast in CastInst_match instead of checking opcode. NFC (#79878)
Using dyn_cast allows us to use CastInst::getOperand instead of
Instruction::getOperand. This is more efficient since
CastInst::getOperand doesn't need to check how the operands are stored.
Instruction::getOperand has to consider HungOffUses.
2024-01-29 11:16:36 -08:00
Jason Molenda
547c395b27 Revert "[lldb/Test] Temporarily XFAIL TestStepScripted.py"
Also revert this patch until Ismail can re-land.

This reverts commit febb4c42b1.
2024-01-29 11:01:08 -08:00
Adrian Prantl
5dce6353b5 Add missing includes 2024-01-29 11:00:49 -08:00
Hristo Hristov
27e67cdb31 Reland: [libc++][format] P2637R3: Member visit (std::basic_format_arg) #76449 (#79032)
Deleted the offending test case.


`libcxx/test/std/utilities/format/format.arguments/format.arg/visit.return_type.pass.cpp`
lines: 134-135:   
>   test<Context, bool, long>(true, 192812079084L);
     test<Context, bool, long>(false, 192812079084L);
     
 Relands: https://github.com/llvm/llvm-project/pull/76449
Reverted in:
02f95b7751

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-29 20:57:12 +02:00
Alexey Bataev
8d89dd4a58 [SLP]Fix PR79743: Check that all users are demoted before trying to
demote the tree entry.

Need to check if all user nodes are marked for demotion before demoting
the node. Otherwise, some data info might be lost after vectorization.
2024-01-29 10:51:20 -08:00
Alexander Shaposhnikov
eb98b5003c [ConstraintElim] Add tests for llvm.abs >= 0 (#79068)
Add tests for llvm.abs >= 0.
This is a preparation for
https://github.com/llvm/llvm-project/pull/79070 .
2024-01-29 10:45:29 -08:00
Jason Molenda
61384850c5 Revert "[lldb] Make use of Scripted{Python,}Interface for ScriptedThreadPlan (#70392)"
Temporarily revert to unblock the CI bots, this is breaking the -DLLVM_ENABLE_MODULES=On
modules style build.  I've notified Ismail.

This reverts commit 888501bc63.
2024-01-29 10:43:33 -08:00
Alexey Bataev
c07d3343dc [SLP][NFC]Add a test for PR79743 with incorrect node demotion, NFC. 2024-01-29 10:26:12 -08:00
Adrian Prantl
649ecf88ed Add missing textual header to module map 2024-01-29 10:24:13 -08:00
Nilanjana Basu
155f24b11e [Tests][LV][AArch64] Pre-commit tests for changing loop interleaving count computation for loops that need to run scalar iterations (#79640)
This patch contains a set of pre-commit tests for changing the loop interleaving count computation in a subsequent patch in order to address loops that need to execute at least a single scalar iteration in the epilogue.
2024-01-29 10:21:23 -08:00
Arthur Eubanks
d5e8a273fd [docs] Remove second "getting sources" section in GettingStarted.rst (#79663)
The very beginning already talks about how to git clone the repo. The
section about checking out specific versions doesn't really belong in
GettingStarted and seems unnecessary.
2024-01-29 10:16:58 -08:00
Shafik Yaghmour
7b0396faab [Clang][Sema] Fix crash when type used in return statement contains errors (#79788)
In Sema in `BuildReturnStmt(...)` when we try to determine is the type
is move eligible or copy elidable we don't currently check of the init
of the `VarDecl` contain errors or not. This can lead to a crash since
we may send a type that is not complete into `getTypeInfo(...)` which
does not allow this.

This fixes: https://github.com/llvm/llvm-project/issues/63244
https://github.com/llvm/llvm-project/issues/79745
2024-01-29 10:08:09 -08:00
Antonio Frighetto
20737825c9 [BDCE] Handle multi-use binary ops upon demanded bits
Simplify multi-use `and`/`or`/`xor` when these last
do not affect the demanded bits being considered.

Fixes: https://github.com/llvm/llvm-project/issues/78596.

Proofs: https://alive2.llvm.org/ce/z/EjuWHa.
2024-01-29 19:03:24 +01:00