Louis Dionne [Wed, 2 Mar 2022 22:49:13 +0000 (17:49 -0500)]
[libc++] Add a CI job running MSAN
For some reason, we've been going without a MSAN CI job, even though
even run-buildbot defined a generic-msan job. This must have been an
oversight that went unnoticed. Thanks to @EricWF for the catch.
Differential Revision: https://reviews.llvm.org/D120851
Yitzhak Mandelbaum [Mon, 21 Mar 2022 20:37:04 +0000 (20:37 +0000)]
[clang][dataflow] Add support for `value_or` in a comparison.
This patch adds limited modeling of the `value_or` method. Specifically, when
used in a particular idiom in a comparison to implicitly check whether the
optional holds a value.
Differential Revision: https://reviews.llvm.org/D122231
Sanjay Patel [Thu, 31 Mar 2022 12:21:28 +0000 (08:21 -0400)]
[x86] try to replace 0.0 in fcmp with negated operand
This inverts a fold recently added to IR with:
3491f2f4b033
We can put -bidirectional on the Alive2 examples to show that
the reverse transforms work:
https://alive2.llvm.org/ce/z/8iVQwB
The motivation for the IR change was to improve matching to
'fabs' in IR (see https://github.com/llvm/llvm-project/issues/38828 ),
but it regressed x86 codegen for 'not-quite-fabs' patterns like
(X > -X) ? X : -X.
Ie, when there is no fast-math (nsz), the cmp+select is not a proper
fabs operation, but it does map nicely to the unusual NAN semantics
of MINSS/MAXSS.
I drafted this as a target-independent fold, but it doesn't appear to
help any other targets and seems to cause regressions for SystemZ at
least.
Differential Revision: https://reviews.llvm.org/D122726
Vy Nguyen [Tue, 22 Mar 2022 22:55:15 +0000 (18:55 -0400)]
[llvm-readobj][MachO] Add option to sort the symbol table before dumping (MachO only, for now).
This would help making tests less brittle as the order will be fixed.
(see also PR/53026)
Differential Revision: https://reviews.llvm.org/D116787
Jay Foad [Tue, 29 Mar 2022 16:06:50 +0000 (17:06 +0100)]
[AMDGPU] Fix last remaining checks in perfhint.ll
Unfortunately this just shows that the test case for D47740 never
really tested what it was supposed to test.
Differential Revision: https://reviews.llvm.org/D122664
Fraser Cormack [Thu, 31 Mar 2022 12:17:11 +0000 (13:17 +0100)]
[RISCV][NFC] Fix formatting on one line
Sergei Lebedev [Thu, 31 Mar 2022 12:27:49 +0000 (14:27 +0200)]
Fixed the type of context in type stubs for MLIR Python bindings
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D122795
Abinav Puthan Purayil [Thu, 31 Mar 2022 10:18:50 +0000 (15:48 +0530)]
[AMDGPU] Regenerate checks in some mir tests
Serge Pavlov [Fri, 1 Nov 2019 13:49:35 +0000 (20:49 +0700)]
Implement inlining of strictfp functions
According to the current design, if a floating point operation is
represented by a constrained intrinsic somewhere in a function, all
floating point operations in the function must be represented by
constrained intrinsics. It imposes additional requirements to inlining
mechanism. If non-strictfp function is inlined into strictfp function,
all ordinary FP operations must be replaced with their constrained
counterparts.
Inlining strictfp function into non-strictfp is not implemented as it
would require replacement of all FP operations in the host function,
which now is undesirable due to expected performance loss.
Differential Revision: https://reviews.llvm.org/D69798
Alexandros Lamprineas [Thu, 31 Mar 2022 11:00:00 +0000 (12:00 +0100)]
[FuncSpec] Constant propagate multiple arguments for recursive functions.
This fixes a TODO in constantArgPropagation() to make it feature complete.
However, I do find myself in agreement with the review comments in
https://reviews.llvm.org/D106426. I don't think we should pursue
specializing such recursive functions as the code size increase becomes
linear to 'max-iters'. Compiling the modified test just with -O3 (no
function specialization) generates the same code.
Differential Revision: https://reviews.llvm.org/D122755
Priyansh Singh [Thu, 31 Mar 2022 11:35:40 +0000 (07:35 -0400)]
Fixed minor documentation issues
Fixed whitespace and punctuation issues, added a name to a link, and
fixed a typo.
Florian Hahn [Thu, 31 Mar 2022 11:32:50 +0000 (12:32 +0100)]
Revert "[LV] Remove unneeded createHeaderBranch.(NFCI)"
This reverts commit
32bc83d11e19b8a8c15df81b32fde1f9f8c6156b.
This is causing bots with expensive-checks to fail. Revert while I
investigate.
Abinav Puthan Purayil [Thu, 31 Mar 2022 11:14:54 +0000 (16:44 +0530)]
[AMDGPU][GlobalISel] Remove unused variable. NFC.
Luo, Yuanke [Wed, 30 Mar 2022 08:45:15 +0000 (16:45 +0800)]
[X86][AMX] Materialize undef or zero value to tilezero
The AMX combiner would store undef or zero to stack and invoke tileload
to load the data to tile register. To avoid the store/load, we can
materialzie undef or zero value to tilezero.
Differential Revision: https://reviews.llvm.org/D122714
Kirill Bobyrev [Thu, 31 Mar 2022 10:49:38 +0000 (12:49 +0200)]
[clangd] IncludeCleaner: Add support for IWYU pragma private
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D120306
Florian Hahn [Thu, 31 Mar 2022 10:48:52 +0000 (11:48 +0100)]
[LV] Remove unneeded createHeaderBranch.(NFCI)
The only remaining use was to get the exit block of the loop. Instead of
relying on the loop, use the successor of VectorHeaderBB
(LoopMiddleBlock) directly to set VPTransformState::CFG::ExitB
Depends on D121621.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D121623
Nicholas Guy [Tue, 22 Mar 2022 16:35:12 +0000 (16:35 +0000)]
[AArch64] Set MaxBytesForLoopAlignment for more targets
Differential Revision: https://reviews.llvm.org/D122566
Sergei Lebedev [Thu, 31 Mar 2022 09:57:07 +0000 (11:57 +0200)]
Added an empty __init__.py file to the MLIR Python bindings
While not strictly required after PEP-420, it is better to have one, since not
all tooling supports implicit namespace packages.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D122794
Sergei Lebedev [Thu, 31 Mar 2022 09:55:51 +0000 (11:55 +0200)]
Fixed mypy type errors in MLIR Python type stubs
This commit fixes or disables all errors reported by
python3 -m mypy -p mlir --show-error-codes
Note that unhashable types cannot be currently expressed in a way compatible
with typeshed. See https://github.com/python/typeshed/issues/6243 for details.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D122790
Simon Pilgrim [Thu, 31 Mar 2022 09:54:06 +0000 (10:54 +0100)]
[X86] Extend xor-lea test coverage
Add ADD/SUB(XOR(X,MIN_SIGNED_VALUE),Y) tests
Florian Hahn [Thu, 31 Mar 2022 09:34:27 +0000 (10:34 +0100)]
[VPlan] Remove unneeded Loop variable (NFC).
Suggested in D121623. The remaining uses of L can be replaced, reducing
the need for the variable.
Marco Elver [Wed, 30 Mar 2022 14:56:10 +0000 (16:56 +0200)]
[AddressSanitizer] Allow prefixing memintrinsic calls in kernel mode
Allow receiving memcpy/memset/memmove instrumentation by using __asan or
__hwasan prefixed versions for AddressSanitizer and HWAddressSanitizer
respectively when compiling in kernel mode, by passing params
-asan-kernel-mem-intrinsic-prefix or -hwasan-kernel-mem-intrinsic-prefix.
By default the kernel-specialized versions of both passes drop the
prefixes for calls generated by memintrinsics. This assumes that all
locations that can lower the intrinsics to libcalls can safely be
instrumented. This unfortunately is not the case when implicit calls to
memintrinsics are inserted by the compiler in no_sanitize functions [1].
To solve the issue, normal memcpy/memset/memmove need to be
uninstrumented, and instrumented code should instead use the prefixed
versions. This also aligns with ASan behaviour in user space.
[1] https://lore.kernel.org/lkml/Yj2yYFloadFobRPx@lakrids/
Reviewed By: glider
Differential Revision: https://reviews.llvm.org/D122724
Groverkss [Thu, 31 Mar 2022 08:57:36 +0000 (14:27 +0530)]
[MLIR][Presburger] Remove forward declaration to PresburgerLocalSpace
This patch removes a forward declaration to PresburgerLocalSpace, a
class which does not exist anymore.
Jean Perier [Thu, 31 Mar 2022 08:57:01 +0000 (10:57 +0200)]
[flang] Allow user to recover from bad edit descriptor with INTEGER
Runtime was crashing when an INTEGER passed in formatted output with
a bad edit descriptor even when the user did provide IOSTAT. Flang
is already signaling an error when facing similar error with other
types. Do the same with INTEGERs.
The input case is already signaling an error in the related input error
case.
Differential Revision: https://reviews.llvm.org/D122749
Jean Perier [Thu, 31 Mar 2022 08:54:15 +0000 (10:54 +0200)]
[flang] Skip `D` when including D debug line
When including debug lines as code, the `D` should be considered as
a white space. Currently an error was raised about bad labels because
it the `D` remained a `D` when considering the source line as code.
Differential Revision: https://reviews.llvm.org/D122711
Simon Pilgrim [Thu, 31 Mar 2022 08:52:55 +0000 (09:52 +0100)]
[X86] combineCarryThroughADD - recognise X86ISD::ADD(AND(X,1),-1) pattern can be folded to X86ISD::BT
As mentioned on D122482, if we've generated a masked overflow test see if we can fold it to X86ISD::BT to feed a X86ISD::ADC/SBB
Differential Revision: https://reviews.llvm.org/D122572
ShihPo Hung [Mon, 7 Mar 2022 07:42:49 +0000 (23:42 -0800)]
[RISCV][RVV] Add Uses = [FRM] and mayRaiseFPException = true to RVV instructions
This patch adds Uses = [FRM] and mayRaiseFPException = true to following
instructions:
VFADD, VFSUB, VFRSUB, VFMUL, VFDIV, VFRDIV
VFWADD, VFWSUB, VFWMUL
VFMADD, VFMACC, VFMSAC, VFMSUB
VFNMADD, VFNMACC, VFNMSAC, VVFNMSUB
VFWMACC, VFWMSAC,
VFWNMACC, VFWNMSAC
VFSQRT, VFREC7
VFREDOSUM, VFREDUSUM,
VFWREDOSUM, VFWREDUSUM
and only adds mayRaiseFPException = true to following instructions:
VFRSQRT7,
VFMIN, VFMAX, VFREDMIN, VFREDMAX
VMFEQ, VMFNE, VMFLT,VMFLE, VMFGT, VMFGE
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D121087
David Green [Thu, 31 Mar 2022 08:19:31 +0000 (09:19 +0100)]
[LV] Invalidate widening decisions after maximizing vector bandwidth
When MaximizeVectorBandwidth is enabled, we can end up (via calls to
collectUniformsAndScalars/setCostBasedWideningDecision through
calculateRegisterUsage) making widening decisions before we have decided
whether to fold the tail by masking. These decisions will be wrong if we
later decided to fold the tail, for example when the trip count is very
low. It will use incorrect costs for loads that should get masked, using
standard memory operation costs instead.
This still at the moment uses the EmulatedMaskMemRefHack costs (a bit
unfortunately), but the old costs without this change were 1, leading to
too optimistic vectorization.
This slightly changes the way that the MaximizeVectorBandwidth option
works to make it easier to test, always honouring the option if it is
set.
Differential Revision: https://reviews.llvm.org/D120215
Matthias Springer [Thu, 31 Mar 2022 08:15:31 +0000 (17:15 +0900)]
[mlir][memref][NFC] Remove unused function
This fixes a compiler warning.
Jay Foad [Tue, 29 Mar 2022 13:30:41 +0000 (14:30 +0100)]
[AMDGPU] Document the intended semantics of llvm.amdgcn.s.buffer.load
Differential Revision: https://reviews.llvm.org/D122653
Matthias Springer [Thu, 31 Mar 2022 08:04:38 +0000 (17:04 +0900)]
[mlir][tensor] Fix bufferization of CollapseShapeOp / ExpandShapeOp
Infer a tighter MemRef type instead of always falling back to the most dynamic MemRef type. This is inefficient and caused op verification errors.
Differential Revision: https://reviews.llvm.org/D122649
Fraser Cormack [Thu, 31 Mar 2022 07:58:59 +0000 (08:58 +0100)]
[RISCV][NFC] Fix comment to refer to correct file
Matthias Springer [Thu, 31 Mar 2022 08:04:15 +0000 (17:04 +0900)]
[mlir][memref] Fix CollapseShapeOp verifier
Differential Revision: https://reviews.llvm.org/D122647
Matthias Springer [Thu, 31 Mar 2022 08:03:41 +0000 (17:03 +0900)]
[mlir][memref] Fix ExpandShapeOp verifier
* Complete rewrite of the verifier.
* CollapseShapeOp verifier will be updated in a subsequent commit.
* Update and expand op documentation.
* Add a new builder that infers the result type based on the source type, result shape and reassociation indices. In essence, only the result layout map is inferred.
Differential Revision: https://reviews.llvm.org/D122641
Argyrios Kyrtzidis [Thu, 31 Mar 2022 07:43:28 +0000 (00:43 -0700)]
[Support/BLAKE3] Re-enable building with the simd-optimized implementations, v2
* Support compiling with clang-5
* Check for `LLVM_DISABLE_ASSEMBLY_FILES` and have it set by
`compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh`
which wants to receive and process only bitcode files.
Qiu Chaofan [Thu, 31 Mar 2022 07:51:11 +0000 (15:51 +0800)]
Revert "[Clang] Add option to set alternative toolchain path"
--overlay-platform-toolchain inserts a whole new toolchain path with
higher priority than system default, which could be achieved by
composing smaller options. We need to figure out alternative solution
and what is missing among these basic options.
Petr Hosek [Wed, 30 Mar 2022 19:07:41 +0000 (12:07 -0700)]
[runtimes] Create Tests.cmake if it does not exist
This is necessary so that Tests.cmake is always included in the
generated build file and any changes made by subbuilds are detected
without needing to rerun CMake.
This is equivalent to an earlier version of D121647.
Differential Revision: https://reviews.llvm.org/D121647
Frances Wingerter [Thu, 31 Mar 2022 07:20:41 +0000 (08:20 +0100)]
[docs] [tools] Document and alphabetize all llvm-config command-line options
Also implements explicit handling for the already-documented --help
flag.
Fraser Cormack [Thu, 31 Mar 2022 07:30:18 +0000 (08:30 +0100)]
[VP][LangRef] Correct select operands in vp.fptosi docs
Lian Wang [Thu, 24 Mar 2022 03:26:14 +0000 (03:26 +0000)]
[RISCV] Add VL patterns for vfwmul/vfwadd/vfwsub
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D122369
Tobias Hieta [Thu, 31 Mar 2022 06:34:30 +0000 (08:34 +0200)]
[test-release] Added -silent-log flag to test-release.sh
This flag silents the build output of test-release.sh so that
it can be used in CI systems a bit better. It will still log
the build output to the log files but not echo it to stdout.
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D122146
Fangrui Song [Thu, 31 Mar 2022 06:20:49 +0000 (23:20 -0700)]
[Driver] Move legacy -f[no-]unit-at-a-time to clang_ignored_gcc_optimization_f_Group
Move to clang_ignored_gcc_optimization_f_Group like other ignored options. This
decreases code size a bit: ~400 bytes on x86-64.
Serge Pavlov [Wed, 30 Mar 2022 04:23:49 +0000 (11:23 +0700)]
Mapping of FP operations to constrained intrinsics
A new function 'getConstrainedIntrinsic' is added, which for any gived
instruction returns id of the corresponding constrained intrinsic. If
there is no constrained counterpart for the instruction or the instruction
is already a constrained intrinsic, the function returns zero.
This is recommit of
115b3ace369254f573ca28934ef30ab9d8f497ef, reverted in
8160dd582b67430a5c24c836a57ae3c15cfa973c.
Differential Revision: https://reviews.llvm.org/D69562
wanglei [Thu, 31 Mar 2022 03:48:03 +0000 (11:48 +0800)]
[LoongArch] Construct codegen infra and generate first add instruction.
This patch constructs codegen infra and successfully generate the first
'add' instruction. Add integer calling convention for fixed arguments which
are passed with general-purpose registers.
New test added here:
CodeGen/LoongArch/ir-instruction/add.ll
The test file is placed in a subdirectory because we will use
subdirctories to distinguish different categories of tests (e.g.
intrinsic, inline-asm ...)
Reviewed By: MaskRay, SixWeining
Differential Revision: https://reviews.llvm.org/D122366
Chuanqi Xu [Thu, 31 Mar 2022 03:21:37 +0000 (11:21 +0800)]
[C++20] [Modules] Use '-' as the separator of partitions when searching
in filesystems
It is simpler to search for module unit by -fprebuilt-module-path
option. However, the separator ':' of partitions is not friendly.
According to the discussion in https://reviews.llvm.org/D118586, I think
we get consensus to use '-' as the separator instead. The '-' is the
choice of GCC too.
Previously I thought it would be better to add an option. But I feel it
is over-engineering now. Another reason here is that there are too many
options for modules (for clang module mainly) now. Given it is not bad
to use '-' when searching, I think it is acceptable to not add an
option.
Reviewed By: iains
Differential Revision: https://reviews.llvm.org/D120874
Aditya Kumar [Wed, 30 Mar 2022 20:20:44 +0000 (13:20 -0700)]
[GVNHoist] drop debug location according to the debug info guide
According to the LLVM debug info update guide: https://llvm.org/docs/HowToUpdateDebugInfo.html,
"Hoisting identical instructions which appear in several successor
blocks into a predecessor block. In this case there is no single
merged instruction. The rule for dropping locations applies".
Thanks to Yuanbo Li for reporting this.
Reviewed By: dblaikie
Reviewers: sebpop, tejohnson, dblaikie
Differential Revision: https://reviews.llvm.org/D122730
jacquesguan [Wed, 30 Mar 2022 06:53:47 +0000 (14:53 +0800)]
[mlir][Vector] Fold ShuffleOp if result is identical to one of source vectors.
For example, we could do the following eliminations:
fold vector.shuffle V1, V2, [0, 1, 2, 3] : <4xi32>, <2xi32> -> V1
fold vector.shuffle V1, V2, [4, 5] : <4xi32>, <2xi32> -> V2
Differential Revision: https://reviews.llvm.org/D122706
Wei Xiao [Wed, 30 Mar 2022 14:41:31 +0000 (22:41 +0800)]
[X86] Add test with abs intrinsic for x86-partial-reduction optimization
V Donaldson [Wed, 30 Mar 2022 00:16:39 +0000 (17:16 -0700)]
[flang] Correct a typo when parsing format token white space
A format such as "( D C, X6. 2 )" is parsed the same as "(DC,X6.2)".
Shafik Yaghmour [Thu, 31 Mar 2022 01:00:37 +0000 (18:00 -0700)]
[LLDB] Fix NSIndexPathSyntheticFrontEnd::Impl::Clear() to only clear the active union member
NSIndexPathSyntheticFrontEnd::Impl::Clear() currently calls Clear() on both
unions members regardless of which one is active. I modified it to only call
Clear() on the active member.
Differential Revision: https://reviews.llvm.org/D122753
Jordan R Abrahams-Whitehead [Thu, 31 Mar 2022 00:27:19 +0000 (17:27 -0700)]
[Utils] Add URL formatting for revert_checker
This lets the revert_checker.py get called with the -u option, which
formats the revert and reverted SHAs into handy URLs which point to the
LLVM reviews associated with those SHAs. This is useful for viewers to
look quickly at the changes made by SHAs that were potentially reverted.
Differential Revision: https://reviews.llvm.org/D122772
Stephen Long [Wed, 30 Mar 2022 23:51:37 +0000 (16:51 -0700)]
[LoopIdiom] Merge TBAA of adjacent stores when creating memset
Factor in the TBAA of adjacent stores instead of just the head store
when merging stores into a memset. We were seeing GVN remove a load that
had a TBAA that matched the 2nd store because GVN determined it didn't
match the TBAA of the memset. The memset had the TBAA of only the first
store.
i.e. Loading the field pi_ of shared_count after memset to create an
array of shared_ptr
template<class T>
class shared_ptr {
T *p;
shared_count refcount;
};
class shared_count {
sp_counted_base *pi_;
};
Differential Revision: https://reviews.llvm.org/D122205
wangyihan [Wed, 30 Mar 2022 23:38:37 +0000 (07:38 +0800)]
[Clang][CodeGen]Beautify dump format, add indent for nested struct and struct members
Beautify dump format, add indent for nested struct and struct members, also fix test cases in dump-struct-builtin.c
for example:
struct:
```
struct A {
int a;
struct B {
int b;
struct C {
struct D {
int d;
union E {
int x;
int y;
} e;
} d;
int c;
} c;
} b;
};
```
Before:
```
struct A {
int a = 0
struct B {
int b = 0
struct C {
struct D {
int d = 0
union E {
int x = 0
int y = 0
}
}
int c = 0
}
}
}
```
After:
```
struct A {
int a = 0
struct B {
int b = 0
struct C {
struct D {
int d = 0
union E {
int x = 0
int y = 0
}
}
int c = 0
}
}
}
```
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D122704
Tue Ly [Sun, 27 Mar 2022 04:01:26 +0000 (00:01 -0400)]
[libc] Improve the performance of expm1f.
Improve the performance of expm1f:
- Rearrange the selection logic for different cases to improve the overall
throughput.
- Use the same degree-4 polynomial for large inputs as `expf`
(https://reviews.llvm.org/D122418), reduced from a degree-7 polynomial.
Performance benchmark using perf tool from CORE-MATH project
(https://gitlab.inria.fr/core-math/core-math/-/tree/master):
Before this patch:
```
$ ./perf.sh expm1f
CORE-MATH reciprocal throughput : 15.362
System LIBC reciprocal throughput : 53.288
LIBC reciprocal throughput : 54.572
$ ./perf.sh expm1f --latency
CORE-MATH latency : 57.759
System LIBC latency : 147.146
LIBC latency : 118.057
```
After this patch:
```
$ ./perf.sh expm1f
CORE-MATH reciprocal throughput : 15.359
System LIBC reciprocal throughput : 53.188
LIBC reciprocal throughput : 14.600
$ ./perf.sh expm1f --latency
CORE-MATH latency : 57.774
System LIBC latency : 147.119
LIBC latency : 60.280
```
Reviewed By: michaelrj, santoshn, zimmermann6
Differential Revision: https://reviews.llvm.org/D122538
sstwcw [Wed, 30 Mar 2022 23:17:27 +0000 (23:17 +0000)]
[clang-format] Indent import statements in JavaScript.
[clang-format] Indent import statements in JavaScript.
Take for example this piece of code found at
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import>.
```
for (const link of document.querySelectorAll("nav > a")) {
link.addEventListener("click", e => {
e.preventDefault();
import('/modules/my-module.js')
.then(module => {
module.loadPageInto(main);
})
.catch(err => {
main.textContent = err.message;
});
});
}
```
Previously the import line would be unindented, looking like this.
```
for (const link of document.querySelectorAll("nav > a")) {
link.addEventListener("click", e => {
e.preventDefault();
import('/modules/my-module.js')
.then(module => {
module.loadPageInto(main);
})
.catch(err => {
main.textContent = err.message;
});
});
}
```
Actually we were going to fix this along with fixing Verilog import
statements. But the patch got too big.
Reviewed By: MyDeveloperDay, curdeius
Differential Revision: https://reviews.llvm.org/D121906
Jonas Devlieghere [Wed, 30 Mar 2022 17:36:18 +0000 (10:36 -0700)]
[lldb] Change the way we pick a platform for fat binaries
Currently, when creating a target for a fat binary, we error out if more
than one platforms can support the different architectures in the
binary. There are situations where it makes sense for multiple platforms
to support the same architectures: for example the host and
remote-macosx platform on Darwin.
The only way to currently disambiguate between them is to specify the
architecture. This patch changes that to take into account the selected
and host platform. The new algorithm works a follows:
1. Pick the selected platform if it matches any of the architectures.
2. Pick the host platform if it matches any of the architectures.
3. If there's one platform that works for all architectures, pick that.
If none of the above apply then we either have no platform supporting
the architectures in the fat binary or multiple platforms with no good
way to disambiguate between them.
I've added a bunch of unit tests to codify this new behavior.
rdar://
90360204
Differential revision: https://reviews.llvm.org/D122684
Arjun P [Wed, 30 Mar 2022 22:24:00 +0000 (23:24 +0100)]
Revert "[MLIR][Presburger] LexSimplex::addEquality: add equalities as fixed columns"
This reverts commit
5630143af33f7e6e0dabdf38982cc9800140bb75. The
implementation in this commit was incorrect. Also, handling this representation
of equalities in the upcoming support for symbolic lexicographic minimization
makes that patch much more complex. It will be easier to review that without
this representaiton and then reintroduce the fixed column representation
later, hence the revert rather than a bug fix.
Daniel Thornburgh [Tue, 22 Mar 2022 17:09:51 +0000 (17:09 +0000)]
[Debuginfod] Use env to fix debuginfod.test on Win32.
Florian Hahn [Wed, 30 Mar 2022 21:16:40 +0000 (22:16 +0100)]
[VPlan] Track current vector loop in VPTransformState (NFC).
Instead of looking up the vector loop using the header, keep track of
the current vector loop in VPTransformState. This removes the
requirement for the vector header block being part of the loop up front.
A follow-up patch will move the code to generate the Loop object for the
vector loop to VPRegionBlock.
Depends on D121619.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D121621
Martin Storsjö [Wed, 30 Mar 2022 10:13:45 +0000 (13:13 +0300)]
[libcxx] [doc] Update Windows build instructions after deprecating the legacy standalone builds
Differential Revision: https://reviews.llvm.org/D122715
Martin Storsjö [Wed, 30 Mar 2022 08:57:53 +0000 (11:57 +0300)]
[lldb-vscode] Avoid a -Wunused-but-set-variable warning. NFC.
Differential Revision: https://reviews.llvm.org/D122710
Hongtao Yu [Wed, 30 Mar 2022 19:27:10 +0000 (12:27 -0700)]
[llvm-profgen] Read sample profiles for post-processing.
Sometimes we would like to run post-processing repeatedly on the original sample profile for tuning. In order to avoid regenerating the original profile from scratch every time, this change adds the support of reading in the original profile (called symbolized profile) and running the post-processor on it.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D121655
Nico Weber [Tue, 29 Mar 2022 00:17:08 +0000 (20:17 -0400)]
[lld/mac] Give range extension thunks for local symbols local visibility
When two local symbols (think: file-scope static functions, or functions in
unnamed namespaces) with the same name in two different translation units
both needed thunks, ld64.lld previously created external thunks for both
of them. These thunks ended up with the same name, leading to a duplicate
symbol error for the thunk symbols.
Instead, give thunks for local symbols local visibility.
(Hitting this requires a jump to a local symbol from over 128 MiB away.
It's unlikely that a single .o file is 128 MiB large, but with ICF
you can end up with a situation where the local symbol is ICF'd with
a symbol in a separate translation unit. And that can introduce a
large enough jump to require a thunk.)
Fixes PR54599.
Differential Revision: https://reviews.llvm.org/D122624
Jessica Paquette [Wed, 30 Mar 2022 20:35:50 +0000 (13:35 -0700)]
Recommit "[Docs] Add documentation for llvm-remark-size-diff"
Add it to the toctree for the LLVM command guide.
Jessica Paquette [Wed, 30 Mar 2022 20:34:03 +0000 (13:34 -0700)]
Revert "[Docs] Add documentation for llvm-remark-size-diff"
This reverts commit
bdea2afc8c16e51edc8877479623e16261940e00.
Bot failure.
Fangrui Song [Wed, 30 Mar 2022 20:31:17 +0000 (13:31 -0700)]
[AutoUpgrade] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds
Jessica Paquette [Wed, 30 Mar 2022 16:42:51 +0000 (09:42 -0700)]
[Docs] Add documentation for llvm-remark-size-diff
Add documentation describing how to
- Use `llvm-remark-size-diff`
- Interpret the output from the tool
Differential Revision: https://reviews.llvm.org/D122744
David Blaikie [Wed, 30 Mar 2022 20:18:40 +0000 (20:18 +0000)]
Demangle: Fix crash-on-invalid demangling of a module name with no underlying entity
Amir Ayupov [Tue, 29 Mar 2022 22:54:08 +0000 (15:54 -0700)]
[MC][BOLT] Add setter for AllowAtInName
Use the setter in BOLT to allow printing names with variant kind in the name
(e.g. "func@PLT").
Fixes BOLT buildbot tests that broke after D122516:
https://lab.llvm.org/buildbot/#/builders/215/builds/3595
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D122694
Stanislav Mekhanoshin [Wed, 30 Mar 2022 19:56:46 +0000 (12:56 -0700)]
[AMDGPU] Remove empty comments in 2 tests. NFC.
Daniel Grumberg [Wed, 30 Mar 2022 19:38:09 +0000 (20:38 +0100)]
[clang][extract-api][NFC] Don't remap the generated input buffer in PPOpts
This was triggering some build failures so removing this change for now.
Eli Friedman [Tue, 22 Mar 2022 23:41:16 +0000 (16:41 -0700)]
[AArch64] Fix AArch64TargetParser.def to match AArch64.td.
Currently, we have two different lists of features each CPU supports...
and those lists aren't consistent. This patch assumes AArch64.td is
right, and tries to fix AArch64TargetParser to match.
It's hard to find documentation for the right features, but reviewers
have confirmed these changes.
Probably we should try to unify the two lists at some point, but
synchronizing them seems like a prerequisite to that anyway.
Differential Revision: https://reviews.llvm.org/D122274
Chris Bieneman [Wed, 30 Mar 2022 18:32:24 +0000 (13:32 -0500)]
Expanding HLSL attribute diagnostics
Updating the diagnostics as per the feedback on
https://reviews.llvm.org/D122627.
This change correctly handles missing argument lists, and changes the
subject for the `numthreads` attribute to be global functions.
I did not handle applying the attribute to template functions because
that currently fails parsing in a way that is consisetent with the
current DXC codebase (Microsoft attributes are not supported on
templates).
A future improvement to the diagnostic maybe warranted.
Louis Dionne [Fri, 25 Mar 2022 16:55:36 +0000 (12:55 -0400)]
[libc++] Ensure that all public C++ headers include <__assert>
This patch changes the requirement for getting the declaration of the
assertion handler from including <__assert> to including any public
C++ header of the library. Note that C compatibility headers are
excluded because we don't implement all the C headers ourselves --
some of them are taken straight from the C library, like assert.h.
It also adds a generated test to check it. Furthermore, this new
generated test is designed in a way that will make it possible to
replace almost all the existing test-generation scripts with this
system in upcoming patches.
Differential Revision: https://reviews.llvm.org/D122506
Ben Barham [Sun, 27 Mar 2022 21:08:48 +0000 (14:08 -0700)]
[VFS] RedirectingFileSystem only replace path if not already mapped
If the `ExternalFS` has already remapped a path then the
`RedirectingFileSystem` should not change it to the originally provided
path. This fixes the original path always being used if multiple VFS
overlays were provided and the path wasn't found in the highest (ie.
first in the chain).
This also renames `IsVFSMapped` to `ExposesExternalVFSPath` and only
sets it if `UseExternalName` is true. This flag then represents that the
`Status` has an external path that's different from its virtual path.
Right now the contained path is still the external path, but further PRs
will change this to *always* be the virtual path. Clients that need the
external can then request it specifically.
Note that even though `ExposesExternalVFSPath` isn't set for all
VFS-mapped paths, `IsVFSMapped` was only being used by a hack in
`FileManager` that was specific to module searching. In that case
`UseExternalNames` is always `true` and so that hack still applies.
Resolves rdar://
90578880 and llvm-project#53306.
Differential Revision: https://reviews.llvm.org/D122549
Craig Topper [Wed, 30 Mar 2022 18:37:34 +0000 (11:37 -0700)]
[RISCV] ISel (and (shift X, C1), C2)) to shift pair in more cases
Previously, these isel optimizations were disabled if the AND could
be selected as a ANDI instruction. This patch disables the optimizations
only if the immediate is valid for C.ANDI. If we can't use C.ANDI,
we might be able to compress the shift instructions instead.
I'm not checking the C extension since we have relatively poor test
coverage of the C extension. Without C extension the code size
should be equal. My only concern would be if the shift+andi had
better latency/throughput on a particular CPU.
I did have to add a peephole to match SRLIW if the input is zexti32
to prevent a regression in rv64zbp.ll.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D122701
Dominic Chen [Wed, 16 Mar 2022 20:42:49 +0000 (13:42 -0700)]
[scudo] Reland: Add noreturn/pragma to suppress compiler warnings
Differential Revision: https://reviews.llvm.org/D121853
Craig Topper [Wed, 30 Mar 2022 18:33:35 +0000 (11:33 -0700)]
[RISCV] Use getSplatBuildVector instead of getSplatVector for fixed vectors.
The splat_vector will be legalized to build_vector eventually
anyway. This patch makes it take fewer steps.
Unfortunately, this results in some codegen changes. It looks
like it comes down to how the nodes were ordered in the topological
sort for isel. Because the build_vector is created earlier we end up
with a different ordering of nodes.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D122185
Chang-Sun Lin Jr [Wed, 30 Mar 2022 18:31:17 +0000 (11:31 -0700)]
Value-number GVNHoist loads by result type as well as pointer address.
Avoids merge errors when opaque pointers are loaded into different types.
Reviewed by: jcranmer-intel, hiraditya
Differential Revision: https://reviews.llvm.org/D122521
Craig Topper [Wed, 30 Mar 2022 18:24:01 +0000 (11:24 -0700)]
[SelectionDAG] Move extension type for ConstantSDNode from getCopyToRegs to HandlePHINodesInSuccessorBlocks.
D122053 set the ExtendType for ConstantSDNodes in getCopyToRegs to
ZERO_EXTEND to match assumptions in ComputePHILiveOutRegInfo. PHIs
are probably not the only way ConstantSDNodeNodes can get to
getCopyToRegs.
This patch adds an ExtendType parameter to CopyValueToVirtualRegister and
has HandlePHINodesInSuccessorBlocks pass ISD::ZERO_EXTEND for ConstantInts.
This way we only affect ConstantSDNodes for PHIs.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D122171
Julian Lettner [Wed, 30 Mar 2022 02:09:59 +0000 (19:09 -0700)]
Do not generate x86_64 test targets on AS hosts
Differential Revision: https://reviews.llvm.org/D122700
Michael Liao [Wed, 30 Mar 2022 18:03:31 +0000 (14:03 -0400)]
[clang] Fix shared build. NFC.
Daniel Grumberg [Tue, 29 Mar 2022 16:48:11 +0000 (17:48 +0100)]
[clang][extract-api] Add support for macros
To achieve this we hook into the preprocessor during the
ExtractAPIAction and record definitions for macros that don't get
undefined during preprocessing.
Daniel Grumberg [Tue, 29 Mar 2022 15:53:39 +0000 (16:53 +0100)]
[clang][extractapi] Tie API and serialization to the FrontendAction
Make the API records a property of the action instead of the ASTVisitor
so that it can be accessed outside the AST visitation and push back
serialization to the end of the frontend action.
This will allow accessing and modifying the API records outside of the
ASTVisitor, which is a prerequisite for supporting macros.
Corentin Jabot [Tue, 22 Mar 2022 18:48:01 +0000 (19:48 +0100)]
[Clang] Add a compatibiliy warning for non-literals in constexpr.
Reviewed By: aaron.ballman, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D122249
Nathan James [Wed, 30 Mar 2022 17:10:11 +0000 (18:10 +0100)]
Revert "[ASTMatchers] Output currently matching node on crash"
This reverts commit
6e33e45b943061f79ab6de1b60d04d4c6f32f8f9.
Fails to build on 32bit machines due to PointerUnion limitations
Florian Hahn [Wed, 30 Mar 2022 16:31:38 +0000 (17:31 +0100)]
[LV] Do not create separate latch block in VPlan::execute.
Now that all dependencies on creating the latch block up-front have been
removed, there is no need to create it early.
Depends on D121618.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D121619
Fraser Cormack [Wed, 30 Mar 2022 12:14:33 +0000 (13:14 +0100)]
[VP] Add vp.icmp comparison intrinsic and docs
This patch mostly follows up on D121292 which introduced the vp.fcmp
intrinsic.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D122729
Fraser Cormack [Wed, 30 Mar 2022 16:02:41 +0000 (17:02 +0100)]
[LangRef][NFC] Correct select operands in vp.fcmp docs
Thanks for craig.topper for spotting this.
Nathan James [Wed, 30 Mar 2022 16:13:59 +0000 (17:13 +0100)]
[ASTMatchers] Output currently matching node on crash
Extend D120185 to also log the node being matched on in case of a crash.
This can help if a matcher is causing a crash or there are not enough interesting nodes bound.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D122529
Fangrui Song [Wed, 30 Mar 2022 16:12:09 +0000 (09:12 -0700)]
[ELF] Default to --no-fortran-common
D86142 introduced --fortran-common and defaulted it to true (matching GNU ld
but deviates from gold/macOS ld64). The default state was motivated by transparently
supporting some FORTRAN 77 programs (Fortran 90 deprecated common blocks).
Now I think it again. I believe we made a mistake to change the default:
* this is a weird and legacy rule, though the breakage is very small
* --fortran-common introduced complexity to parallel symbol resolution and will slow down it
* --fortran-common more likely causes issues when users mix COMMON and
STB_GLOBAL definitions (see https://github.com/llvm/llvm-project/issues/48570 and
https://maskray.me/blog/2022-02-06-all-about-common-symbols).
I have seen several issues in our internal projects and Android.
On the other hand, --no-fortran-common is safer since
COMMON/STB_GLOBAL have the same semantics related to archive member extraction.
Therefore I think we should switch back, not punishing the common uage.
A platform wanting --fortran-common can implement ld.lld as a shell script
wrapper around `lld -flavor gnu --fortran-common "$@"`.
Reviewed By: ikudrin, sfertile
Differential Revision: https://reviews.llvm.org/D122450
Fangrui Song [Wed, 30 Mar 2022 16:02:23 +0000 (09:02 -0700)]
[X86][test] Precommit D122541 tests for prologue/epilogue CFI
Currently there is no CFI_INSTRUCTION MIR test with .ll input. This patch
adds some -stop-after=prologepilog tests.
Nathan Sidwell [Tue, 18 Jan 2022 15:14:08 +0000 (07:14 -0800)]
[clang][ABI] New C++20 module mangling scheme
Implement a demangleable strong ownership symbol mangling.
* The original module symbol mangling scheme turned out to be
undemangleable.
* The hoped-for C++17 compatibility of weak ownership turns out to be
fragile
* C++20 now has better ways of controlling C++17 compatibility
The issue is captured on the ABI list at:
https://github.com/itanium-cxx-abi/cxx-abi/issues/134
GCC implements this new mangling.
The old mangling is unceremoniously dropped. No backwards
compatibility, no deprectated old-mangling flag. It was always
labelled experimental. (Old and new manglings cannot be confused.)
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D122256
Nikita Popov [Wed, 30 Mar 2022 15:25:49 +0000 (17:25 +0200)]
[AutoUpgrade] Don't upgrade intrinsics returning overloaded struct type
We only want to do the upgrade from named to anonymous struct
return if the intrinsic is declared to return a struct, but not
if it has an overloaded return type that just happens to be a
struct. In that case the struct type will be mangled into the
intrinsic name and there is no problem.
This should address the problem reported in
https://reviews.llvm.org/D122471#3416598.
Louis Dionne [Fri, 4 Mar 2022 19:34:46 +0000 (14:34 -0500)]
[libunwind] Add a _LIBUNWIND_VERSION macro
This allows us to detect whether we're being compiled with LLVM's libunwind
more easily, without CMake having to set explicit variables.
As discussed in https://llvm.org/D119538.
Differential Revision: https://reviews.llvm.org/D121015
Sanjay Patel [Wed, 30 Mar 2022 14:24:54 +0000 (10:24 -0400)]
[SDAG] avoid libcalls to fmin/fmax for soft-float targets
This is an extension of D70965 to avoid creating a mathlib
call where it did not exist in the original source. Also see
D70852 for discussion about an alternative proposal that was
abandoned.
In the motivating bug report:
https://github.com/llvm/llvm-project/issues/54554
...we also have a more general issue about handling "no-builtin" options.
Differential Revision: https://reviews.llvm.org/D122610
Pavel Labath [Mon, 14 Mar 2022 15:32:51 +0000 (16:32 +0100)]
Recommit [lldb/test] Make category-skipping logic "platform"-independent
This recommits
dddf4ce03, which was reverted because of a couple of test
failures on macos. The reason behind the failures was that the patch
inadvertenly changed the value returned by the host platform from
"macosx" to "darwin". The new version fixes that.
Original commit message was:
The decision which categories are relevant for a particular test run
happen very early in the test setup process. They use the SBPlatform
object to determine which categories should be skipped. The platform
object created for this purpose transcends individual test runs.
This setup is not compatible with the direction discussed in
<https://discourse.llvm.org/t/multiple-platforms-with-the-same-name/59594>
-- when platform objects are tied to a specific (SB)Debugger, they need
to be created alongside it, which currently happens in the test setUp
method.
This patch is the first step in that direction -- it rewrites the
category skipping logic to avoid depending on a global SBPlatform
object. Fortunately, the skipping logic is fairly simple (and I believe
it outght to stay that way) and mainly consists of comparing the
platform name against some hardcoded lists. This patch bases this
comparison on the platform name instead of the os part of the triple (as
reported by the platform).
Differential Revision: https://reviews.llvm.org/D121605
serge-sans-paille [Wed, 30 Mar 2022 06:17:56 +0000 (08:17 +0200)]
Fix invalid overflow check in flang
Statically checking for overflow with
if constexpr (sizeof(std::size_t) <= sizeof(std::int64_t)) {
return static_cast<std::int64_t>(length);
}
Doesn't work if `sizeof(std::size_t) == sizeof(std::int64_t)` because std::size_t
is unsigned.
if `length == std::numeric_limits<size_t>` casting it to `int64_t` is going to overflow.
This code would be much simpler if returning a `uint64_t` instead of a signed
value...
Differential Revision: https://reviews.llvm.org/D122705
Jun Zhang [Tue, 29 Mar 2022 07:24:48 +0000 (15:24 +0800)]
[NFC] Use range based loop.
Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D122657
Fraser Cormack [Wed, 9 Mar 2022 15:02:53 +0000 (15:02 +0000)]
[VP] Add vp.fcmp comparison intrinsic and docs
This patch adds the first support for vector-predicated comparison
intrinsics, starting with vp.fcmp. It uses metadata to encode its
condition code, like the llvm.experimental.constrained.fcmp intrinsic.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D121292