516779 Commits

Author SHA1 Message Date
Karthika Devi C
4cb7170199
[polly] Add nullptr check to fix #113772 (#114206)
The patch adds a nullptr check before accessing the loop blocks in
'hasPossiblyDistributableLoop' function. The existing check for the
loop’s containment in the region does not capture nullptr cases when the
region covers the entire function. Therefore, it’s better to exit if the
basic block isn’t part of any loop

Fixes #113772.
2024-11-01 11:15:24 +05:30
Kyungwoo Lee
7ec26b23f2
[CGData] Stable Function Map (#112662)
These define the main data structures to represent stable functions and
group similar functions in a function map.
Serialization is supported in a binary or yaml form.

Depends on #112638.
This is a patch for
https://discourse.llvm.org/t/rfc-global-function-merging/82608.
2024-10-31 22:23:55 -07:00
Oleksandr T.
df9769e14b
[Clang] prevent setting default lexical access specifier for missing primary declarations (#112424)
This PR resolves a crash triggered by a forward reference to an enum
type in a function parameter list. The fix includes setting `Invalid`
when `TagUseKind` is `Declaration` to ensure correct error handling.

Fixes #112208
2024-11-01 13:13:33 +08:00
Thorsten Schütt
8e3772744d
[GlobalISel][AArch64] Legalize G_INSERT_VECTOR_ELT for SVE (#114470)
There are patterns for:
* {nxv2s32, s32, s64},
* {nxv4s16, s16, s64},
* {nxv2s16, s16, s64}
2024-11-01 06:10:26 +01:00
Yingwei Zheng
f16bff1261
[GVN][NewGVN][Local] Handle attributes for function calls after CSE (#114011)
This patch intersects attributes of two calls to avoid introducing UB.
It also skips incompatible call pairs in GVN/NewGVN. However, I cannot
provide negative tests for these changes.

Fixes https://github.com/llvm/llvm-project/issues/113997.
2024-11-01 12:44:33 +08:00
Lei Wang
bef3b54ea1
[InstrPGO] Avoid using global variable to fix potential data race (#114364)
In https://github.com/llvm/llvm-project/pull/109837, it sets a global
variable(`PGOInstrumentColdFunctionOnly`) in PassBuilderPipelines.cpp
which introduced a data race detected by TSan. To fix this, I decouple
the flag setting, the flags are now set
separately(`instrument-cold-function-only-path` is required to be used
with `--pgo-instrument-cold-function-only`).
2024-10-31 21:28:13 -07:00
Yingwei Zheng
96b14f2ccb
[Reland][InstCombine] Fix FMF propagation in foldSelectIntoOp (#114499)
Relands #114356. Compared to the last version, this patch only merges
poison-generating/nsz flags from the select to fix LV regression in
`llvm/test/Transforms/PhaseOrdering/AArch64/predicated-reduction.ll`.
2024-11-01 12:22:57 +08:00
Louis Dionne
d1b311d7d2
[libc++] Split std::hash benchmark out of std::unordered_set benchmark (#114448)
As a drive-by, remove unused functor inside the unordered_set benchmark.
That benchmark still isn't very exhaustive, but that can be addressed
separately.
2024-10-31 22:53:06 -04:00
lntue
5cb730594a
[libc] Remove FE_ALL_EXCEPT check in hdr/fenv_macros.h. (#114446)
FE_ALL_EXCEPT macro might not be a valid preprocessor constant
expression in some environment.
Moreover, FE_ALL_EXCEPT might not be defined as int.
2024-10-31 22:24:06 -04:00
Kyle Evans
2606a58bc0
compiler-rt: sanitizer_common: use close_range() instead of looping (#114442)
_SC_OPEN_MAX is quite high on FreeBSD, which makes this close() loop a
quite obvious problem when attempting to do any kind of debugging in a
process that uses StartSubprocess. Switch to using close_range(2)
instead to close them all in a single syscall and dramatically reduce
the runtime and syscall trace noise

Linux has an equivalent syscall, but I do not have the capacity to test
that it works there, so this is limited to SANITIZER_FREEBSD for the
time being.
2024-10-31 19:20:46 -07:00
Lang Hames
0019d06185 Revert "Revert "[JITLink] Use MapVector to stabilize iteration order""
This reverts commit 244ea4062590b4fbda56bbae6cd3700159db19bf while I test a fix
for a build failure: https://lab.llvm.org/buildbot/#/builders/174/builds/7685.
2024-10-31 19:18:34 -07:00
Valentin Clement (バレンタイン クレメン)
466b58ba38
[flang] Avoid generating duplicate symbol in comdat (#114472)
In case where a fir.global might be duplicated in an inner module
(gpu.module), the conversion pattern will be applied on the module and
the gpu module version of the global and try to generate multiple comdat
with the same symbol name. This is what we have in the implementation of
CUDA Fortran.

Just check for the presence of the `ComdatSelectorOp` before creating a
new one.
2024-10-31 18:59:04 -07:00
Valentin Clement (バレンタイン クレメン)
067ce5ca18
[flang][cuda] Use getOrCreateGPUModule in CUFDeviceGlobal pass (#114468)
Make the pass functional if gpu module was not created yet.
2024-10-31 18:58:43 -07:00
c8ef
cf0b6cc711
Revert "[ConstantFold] Fold tgamma and tgammaf when the input parameter is a constant value." (#114496)
Reverts llvm/llvm-project#114065
2024-11-01 09:26:11 +08:00
c8ef
1f07f995cc
[ConstantFold] Fold tgamma and tgammaf when the input parameter is a constant value. (#114065)
This patch adds support for constant folding for the `tgamma` and
`tgammaf` libc functions.
2024-11-01 09:07:55 +08:00
Ben Shi
da9788359d
[clang][driver] Improve warning message for target AVR (#114394)
Fixes https://github.com/llvm/llvm-project/issues/96743
2024-11-01 08:51:24 +08:00
Hervé Poussineau
6fa1647a47
[MC][Mips] Rename MipsMCAsmInfo to MipsELFMCAsmInfo (#112592)
Also change MipsAsmPrinter::emitStartOfAsmFile to emit ELF-related
sections only when using ELF output file format.
2024-11-01 08:42:34 +08:00
Tom Stellard
beb7fb9d0f
[ORC] skip reoptimization tests on i386 (#114351)
This test currently segfaults on i386-unknown-linux-gnu builds.
2024-10-31 17:41:02 -07:00
Alexey Samsonov
33d636f0f6
[libc][bazel] Fix linter warning - remove unused load. (#114493)
This load is no longer necessary since PLATFORM_CPU_ARM64 was removed in
fa17977c315062646d4d1e01262d68dd69313e61
2024-10-31 17:34:39 -07:00
Ruiling, Song
54d31bde32
Reapply "StructurizeCFG: Optimize phi insertion during ssa reconstruction (#101301)" (#114347)
This reverts commit be40c723ce2b7bf2690d22039d74d21b2bd5b7cf.
2024-11-01 08:29:59 +08:00
Peter Hawkins
51a4f319f0
[mlir:python] Avoid calls to get_op_result_or_results in generated value wrappers (#114491)
If we know the output arity at tablegen time, we can often just call
.result or .results directly.

This saves almost 1s in a JAX-based LLM benchmark building a mixture of
upstream dialects and StableHLO.
2024-11-01 00:54:20 +01:00
Thurston Dang
84f5c8571d
[msan] Add test for Arm NEON tbl intrinsics (#114462)
Arm NEON tbl intrinsics are currently not instrumented properly by MSan.
This test will help track progress.
2024-10-31 16:45:01 -07:00
Jan Svoboda
e494e2694a
[clang][lex] Remove HeaderFileInfo::Framework (#114460)
This PR removes the `HeaderFileInfo::Framework` member and reduces the
size of this data type from 32B to 16B. This should improve Clang's
memory usage in situations where it keeps track of lots of header files.
NFCI. Depends on #114459.
2024-10-31 16:33:28 -07:00
Justin Fargnoli
a1987beac5
Reland "[NVPTX] Prefer prmt.b32 over bfi.b32" (#114326)
Fix
[failure](https://github.com/llvm/llvm-project/pull/110766#discussion_r1796832635)
identified by @akuegel.

---

In [[NVPTX] Improve lowering of
v4i8](cbafb6f2f5)
@Artem-B add the ability to lower ISD::BUILD_VECTOR with bfi PTX
instructions. @Artem-B did this because:
(https://github.com/llvm/llvm-project/pull/67866#discussion_r1343066911)

Under the hood byte extraction/insertion ends up as BFI/BFE
instructions, so we may as well do that in PTX, too.
https://godbolt.org/z/Tb3zWbj9b

However, the example that @Artem-B linked was targeting sm_52. On modern
architectures, ptxas uses prmt.b32.
[Example](https://godbolt.org/z/Ye4W1n84o).

Thus, remove uses of NVPTXISD::BFI in favor of NVPTXISD::PRMT.
2024-10-31 16:09:20 -07:00
Jan Svoboda
19b4f17d4c
[clang][lex] Remove -index-header-map (#114459)
This PR removes the `-index-header-map` functionality from Clang. AFAIK
this was only used internally at Apple and is now dead code. The main
motivation behind this change is to enable the removal of
`HeaderFileInfo::Framework` member and reducing the size of that data
structure.

rdar://84036149
2024-10-31 16:04:35 -07:00
Michael Jones
3af87d4c57
[libc] Remove asm-generic includes from tests (#114479)
We shouldn't be including headers directly from asm-generic for macros.
It's safer to get those through the correct primary header where
possible (e.g. fcntl instead of asm-generic/fcntl).

For our public headers we may need to include the asm-generic
headers instead of defining all the macros ourselves, but that's
something for a followup PR.
2024-10-31 15:56:58 -07:00
Jonas Devlieghere
cf3464bbb7
[lldb] Set LLDB_USE_NATIVE_PDB_READER at the directory level (#114455)
Lit allows you to set environment variables for all tests in a directory
using a `lit.local.cfg` file. Do this for the PDB and NativePDB tests.
2024-10-31 15:31:51 -07:00
Michael Jones
e241964b93
[libc] Fix macro definition hermeticity (#114467)
Previously shm_test was including <asm-generic/fcntl.h> for the macro
FD_CLOEXEC. This patch adds that macro to the list we have defined, and
redirects the test to use the correct proxy header.
2024-10-31 14:42:50 -07:00
Thorsten Schütt
aa70d846b0
[GlobalISel][AArch64] Legalize G_SPLAT_VECTOR (#114006)
{nxv8s16, s16} fails to select.
{nxv16s8, s8} no patterns available.
2024-10-31 22:20:08 +01:00
Thurston Dang
083a5cdbea Revert "[sanitizer_common] AND signals in BlockSignals instead of deleting (#113443)"
This reverts commit 25fd366d6a7d40266ff27c134ed8beb0a90cc33b.

Reason: buildbot breakage (https://lab.llvm.org/buildbot/#/builders/186/builds/3642)
2024-10-31 21:08:22 +00:00
Jakub Kuderski
a8b4cb185c [mlir] Remove debug prints from test pattern 2024-10-31 17:06:02 -04:00
Florian Hahn
3b4c45e4e5
[VPlan] Fix long comment added in b021464d35ca (NFC).
Fix formatting of comment added in b021464d35ca.
2024-10-31 21:05:00 +00:00
Michael Jones
0b2b87bf34
[libc] Fix path to fcntl_overlay in cmake (#114464)
The proxy header definition for mode_t was using an incorrect form for
its dependency on fcntl_overlay. The relative paths for dependencies can
only go down, not up so "../" doesn't work. This patch fixes it to be
absolute.
2024-10-31 14:03:02 -07:00
Nick Desaulniers
8413599b59
[libc][i386] syscall support (#114264)
Link: #93709
2024-10-31 13:41:55 -07:00
Florian Hahn
b021464d35
[VPlan] Introduce scalar loop header in plan, remove VPLiveOut. (#109975)
Update VPlan to include the scalar loop header. This allows retiring
VPLiveOut, as the remaining live-outs can now be handled by adding
operands to the wrapped phis in the scalar loop header.

Note that the current version only includes the scalar loop header, no
other loop blocks and also does not wrap it in a region block.

PR: https://github.com/llvm/llvm-project/pull/109975
2024-10-31 21:36:44 +01:00
Igor Kudrin
454abad7b0
[CFI][LowerTypeTests] Fix indirect call with alias (#113987)
This is a fixed version of #106185, which was reverted in #113978 due to
a buildbot failure.

Motivation example:
```
> cat test.cpp
extern "C" [[gnu::weak]] void f() {}
void alias() __attribute__((alias("f")));
int main() { auto p = alias; p(); }
> clang test.cpp -fsanitize=cfi-icall -flto=thin -fuse-ld=lld
> ./a.out
[1]    1868 illegal hardware instruction  ./a.out
```

If the address of a function was only taken through its alias, the
function was not considered exported and therefore was not included in
the CFI jumptable. This resulted in `@llvm.type.test()` being lowered to
`false`, and consequently the indirect call to the function was
eventually optimized to `ubsantrap()`.
2024-10-31 13:29:07 -07:00
gulfemsavrun
d183dc7c24
Revert "[InstCombine] Fix FMF propagation in foldSelectIntoOp" (#114458)
Reverts llvm/llvm-project#114356 because it caused test failures.
https://lab.llvm.org/buildbot/#/builders/190/builds/8601

https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-base-linux-x64/b8732549597609293617/overview
2024-10-31 13:21:52 -07:00
zhijian lin
674574d25c
Promote 32bit pseudo instr that infer extsw removal to 64bit in PPCMIPeephole (#85451)
Fixes:   https://github.com/llvm/llvm-project/issues/71030

Bug only happens in 64bit involving spills. Since we don't know when the
spill will happen, all instructions in the chain used to deduce sign
extension for eliminating 'extsw' will need to be promoted to 64-bit
pseudo instructions.

The following instruction will promoted in PPCMIPeepholes: EXTSH, LHA,
ISEL to EXTSH8, LHA8, ISEL8
2024-10-31 15:49:36 -04:00
Paul Kirth
913cd11f94
[llvm][fatlto] Drop any CFI related instrumentation after emitting bitcode (#112788)
We want to support CFI instrumentation for the bitcode section, without
miscompiling the object code portion of a FatLTO object. We can reuse
the existing mechanisms in the LowerTypeTestsPass to do that, by just
adding the pass to the FatLTO pipeline after the EmbedBitcodePass with
the correct options set.

Fixes #112053
2024-10-31 12:40:21 -07:00
Rolf Morel
5c1752e368
[MLIR][DLTI] Pretty parsing and printing for DLTI attrs (#113365)
Unifies parsing and printing for DLTI attributes. Introduces a format of
`#dlti.attr<key1 = val1, ..., keyN = valN>` syntax for all queryable
DLTI attributes similar to that of the DictionaryAttr, while retaining
support for specifying key-value pairs with `#dlti.dl_entry` (whether to
retain this is TBD).

As the new format does away with most of the boilerplate, it is much easier
to parse for humans. This makes an especially big difference for nested
attributes.

Updates the DLTI-using tests and includes fixes for misc error checking/
error messages.
2024-10-31 19:18:24 +00:00
Matt Arsenault
9cc298108a
AtomicExpand: Copy metadata from atomicrmw to cmpxchg (#109409)
When expanding an atomicrmw with a cmpxchg, preserve any metadata
attached to it. This will avoid unwanted double expansions
in a future commit.

The initial load should also probably receive the same metadata
(which for some reason is not emitted as an atomic).
2024-10-31 11:54:07 -07:00
Antonio Frighetto
19c8475871 [SelectionDAG] Add preliminary plumbing for samesign flag
Extend recently-added poison-generating IR flag to codegen as well.
2024-10-31 19:47:50 +01:00
Matt Arsenault
e3222e6f80
AMDGPU: Add baseline tests for cmpxchg custom expansion (#109408)
We need a non-atomic path if flat may access private.
2024-10-31 11:46:13 -07:00
Craig Topper
6ff8091b5e [Alignment] Fix old method name in comment. NFC
getValue() was renamed to value() in the migration from
llvm::Optional to std::optional.
2024-10-31 11:23:33 -07:00
Daniel Sanders
5b356f27a0 Trivial change llvm::CreateInfoOutputFile() to return raw_ostream. NFC
This is NFC w.r.t upstream but allows us to return raw_null_ostream in our
downstream fork without changing the interface.
2024-10-31 11:22:22 -07:00
Jorge Gorbe Moya
93d12d4881
Revert "[Bazel] Fix for 1bc58a258e2edb6221009a26d0f0037eda6c7c47" (#114444)
This reverts commit 5ce8a93ebb7688c66bd08fa27d2e04bca33b6763.

Commit 1bc58a258e2edb6221009a26d0f0037eda6c7c47 was reverted in
a9a8351ef181610559687679a40efe24649f9600, so the bazel fix is no longer
needed.
2024-10-31 11:21:04 -07:00
Manish Kausik H
0856592f6f
Ensure collectTransitivePredecessors returns Pred only from the Loop. (#113831)
It's possible that we encounter Irreducible control flow, due to which,
we may find that a few predecessors of BB are not a part of the CurLoop.
Currently we crash in the function for such cases. This patch ensures
that we only return Predecessors that are a part of CurLoop and
gracefully ignore other Predecessors.

For example, consider Irreducible IR of this form:
```
define i64 @baz() {
bb:
  br label %bb1

bb1:                                              ; preds = %bb3, %bb
  br label %bb3

bb2:                                              ; No predecessors!
  br label %bb3

bb3:                                              ; preds = %bb2, %bb1
  %load = load ptr addrspace(1), ptr addrspace(1) null, align 8
  br label %bb1
}
```

This crashes when `collectTransitivePredecessors` is called on the
`%bb1<Header>, %bb3<latch>` loop, because the loop body has a
predecessor `%bb2` which is not a part of the loop.

See https://godbolt.org/z/E9fM1q3cT for the crash
2024-10-31 11:08:15 -07:00
Thurston Dang
25fd366d6a
[sanitizer_common] AND signals in BlockSignals instead of deleting (#113443)
My earlier patch https://github.com/llvm/llvm-project/pull/98200 caused a regression because it unconditionally unblocked synchronous signals, even if the user program had deliberately blocked them. This patch fixes the issue by checking the current signal mask, as suggested by Vitaly. It also adds tests.

Fixes #113385

---------

Co-authored-by: Vitaly Buka <vitalybuka@gmail.com>
2024-10-31 11:07:41 -07:00
Craig Topper
cd8d507b07 [RISCV] Pull __builtin_riscv_clz/ctz out of a nested switch. NFC
The nested switch exists to share setting IntrinsicsTypes to {ResultType}.
clz/ctz return before we reach that so they can just be in the top
level switch.
2024-10-31 11:01:58 -07:00
Lang Hames
fe5215281d [JITLink][COFF] Delete trailing whitespace in testcase. NFC. 2024-11-01 04:50:24 +11:00