Antoine Moynault [Fri, 14 Apr 2023 15:32:41 +0000 (15:32 +0000)]
[fuzzer][test] Disable noasan-strncmp test for AArch64
This test fails on several aarch64 bots
clang-aarch64-lld-2stage ( https://lab.llvm.org/buildbot/#/builders/185/builds/3525 )
clang-aarch64-full-2stage ( https://lab.llvm.org/buildbot/#/builders/179/builds/5904 )
clang-aarch64-sve-vla ( https://lab.llvm.org/buildbot/#/builders/197/builds/4519 )
Disable it while this is analyzed.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D148332
Valentin Clement [Fri, 14 Apr 2023 15:29:39 +0000 (08:29 -0700)]
[mlir][openacc] Add acc.kernels operation
The acc.kernels operation models the OpenACC kernels construct.
The kernels construct defines a region of a program that is
compiled into a sequence of kernels to be executed on the current device.
The operation is modelled on the acc.parallel operation and will
receive similar updates when the data operands operations will
be implemented.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D148277
Louis Dionne [Tue, 11 Apr 2023 16:53:39 +0000 (17:53 +0100)]
[libc++] Remove redundant assertion in std::span::subspan
That is already checked later in the function as `__count <= size() - __offset`.
rdar://
107884996
Differential Revision: https://reviews.llvm.org/D148030
Kevin P. Neal [Wed, 12 Apr 2023 15:42:44 +0000 (11:42 -0400)]
[FPEnv][LangRef] Update doc for strictfp attribute
Based on the direction of IR Verifier changes in D146845, this documentation
needs to be updated.
Differential Revision: https://reviews.llvm.org/D148138
Dave Lee [Wed, 12 Apr 2023 21:44:19 +0000 (15:44 -0600)]
[lldb] Add `operator StringRef` to ConstString
Add a `StringRef` conversion function to `ConstString`.
This will make using llvm, and other non-ConstString, APIs more convenient.
For demonstration, this updates Module.cpp.
Differential Revision: https://reviews.llvm.org/D148175
Christian Sigg [Fri, 14 Apr 2023 15:04:14 +0000 (17:04 +0200)]
[mlir] Fix test after 2d4e856
The test CHECKs for `-nan`, but printing the sign is optional.
This change removes the sign because it has no meaning.
Zain Jaffal [Fri, 14 Apr 2023 14:37:06 +0000 (15:37 +0100)]
[ConstraintElimination] Add tests to check for transfering facts from sgt to ugt.
If we have a >s b and we know that b >s 0 then we also can infer that a >u b.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D148321
Joseph Huber [Thu, 6 Apr 2023 16:18:47 +0000 (11:18 -0500)]
[OpenMP] Replace HeapToShared's initial value with `poison`
There's a desire to move away from `undef` in LLVM. Currently we want to
have the `addressspace(3)` variables use `poison` instead.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D147719
Joseph Huber [Mon, 10 Apr 2023 14:50:40 +0000 (09:50 -0500)]
[OpenMP][Docs] Add documentation for using configuration files
We recently reverted a patch that automatically set the rpath on OpenMP
executables. This was used because the `libomptarget.so` library is only
expected to work with the same version of compiler that will be using
it. This patch adds some documentation for how to get similar behaviour
as before using a clang configuration file.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D147943
Kiran Chandramohan [Fri, 14 Apr 2023 14:23:30 +0000 (14:23 +0000)]
[Flang] Add code owner for the Driver
Andrzej proposed the design and led the work for the Flang Driver
over the past couple of years. He is continuing to function as
the primary reviewer and gate-keeper of the Driver.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D147573
Simon Pilgrim [Fri, 14 Apr 2023 14:37:40 +0000 (15:37 +0100)]
[X86] combineSetCCMOVMSK - fold anyof/noneof movmskps/movmskpd -> testps/testpd
Another part of Issue #60007
Nikita Popov [Fri, 14 Apr 2023 14:28:03 +0000 (16:28 +0200)]
[X86] Add additional add of mul test (NFC)
Balaji V. Iyer [Fri, 14 Apr 2023 13:52:17 +0000 (13:52 +0000)]
[mlir][math] Expand math.powf to exp, log and multiply
Powf functions are pushed directly to libm. This is problematic for
situations where libm is not available. This patch will decompose the
powf function into log of exponent multiplied by log of base and raise
it to the exp.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D148164
Nikita Popov [Fri, 14 Apr 2023 13:56:42 +0000 (15:56 +0200)]
[X86] Add test for foldable add of mul (NFC)
Krasimir Georgiev [Fri, 14 Apr 2023 13:55:20 +0000 (13:55 +0000)]
Revert " [sanitizer] adapt for
75f1f158812dabc03e70697b6b9c272230bce63d"
This reverts commit
de4c038c7ba2c6a8d529cb094f1a7c3deaae9b75.
The change that triggered this fix got reverted.
pvanhout [Fri, 7 Apr 2023 12:54:50 +0000 (14:54 +0200)]
[AMDGPU] Less aggressively break large PHIs
In some cases, breaking large PHIs can very negatively affect
performance (3x more instructions observed in a particular test case).
This patch adds some basic profitability heuristics to help with some of these issues without affecting the "good" cases.
e.g. avoid breaking PHIs if it causes back-and-forth between vector/scalar form for no good reason.
Fixes SWDEV-392803
Fixes SWDEV-393781
Fixes SWDEV-394228
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D147786
Nicolas Vasilache [Fri, 14 Apr 2023 12:43:07 +0000 (05:43 -0700)]
[mlir][Linalg] Support tensor.parallel_insert_slice in transform.insert_slice_to_copy
Differential Revision: https://reviews.llvm.org/D148333
Luke Lau [Thu, 13 Apr 2023 15:43:36 +0000 (16:43 +0100)]
[VP] Mark llvm.vp.copysign as a binary op
I was working on legalising vector binary ops to their VP counterparts when I noticed that `vp_copysign` wasn't marked as a binary op. It looks like this might have been an oversight, so this marks it as one.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D148241
Pavel Labath [Fri, 14 Apr 2023 12:36:27 +0000 (14:36 +0200)]
[lldb] Add a sleep to TestObjectFileJSON
The test fails when the two generated files have the same timestamp
(lldb uses second granularity).
Dmitry Makogon [Wed, 12 Apr 2023 08:15:47 +0000 (15:15 +0700)]
[SCEV] Preserve NSW for AddRec multiplied by -1 if it cannot be signed minimum
This preserves NSW flag for AddRecs multiplied by -1 if we can prove
via constant ranges that the AddRec cannot be signed minimum.
An explanation:
Let M be signed minimum. If AddRec's range contains M, then M * (-1) will
stay M and (M + 1) * (-1) will be signed maximum, so we get a signed overflow.
In all other cases if an AddRec didn't signed overflow,
then AddRec * (-1) wouldn't too.
Differential Revision: https://reviews.llvm.org/D148084
Ivan Butygin [Thu, 13 Apr 2023 16:28:57 +0000 (18:28 +0200)]
[mlir][scf] WhileOp patterns cleanup
Fix review comments from https://reviews.llvm.org/D146252
Merge `WhileRemoveUnusedArgs` pattern with (unused) `WhileUnusedArg`,
use `getConditionOp`, use `SmallPtrSet` and early check, move tests
Differential Revision: https://reviews.llvm.org/D148256
Christian Sigg [Fri, 14 Apr 2023 11:24:15 +0000 (13:24 +0200)]
[bazel] Fix build after e5f50bd and 62ef97e
Christian Ulmann [Fri, 14 Apr 2023 11:09:54 +0000 (11:09 +0000)]
[mlir][Analysis] CFGLoopInfo instantiation in C++
This commit moves the CFGLoopInfo instantiation into the C++ file to
ensure that it is only compiled once. Instantiating the template
explicitly revealed two missing functions that this commit also adds.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D148219
Aaron Ballman [Fri, 14 Apr 2023 11:18:46 +0000 (07:18 -0400)]
Model list initialization more directly; fixes an assert with coverage mapping
Instead of using the validity of a brace's source location as a flag
for list initialization, this now uses a PointerIntPair to model it so
we do not increase the size of the AST node to track this information.
This allows us to retain the valid source location information, which
fixes the coverage assertion.
Fixes https://github.com/llvm/llvm-project/issues/62105
Differential Revision: https://reviews.llvm.org/D148245
Dmitry Makogon [Fri, 14 Apr 2023 11:12:25 +0000 (18:12 +0700)]
[Test] Fix tests showing flags improvement for SCEV sub expressions (NFC)
This fixes a failing check in tests added by
05a142cc6fd1.
Simon Pilgrim [Fri, 14 Apr 2023 11:03:38 +0000 (12:03 +0100)]
[X86] SimplifyDemandedBitsForTargetNode - improve TESTPS/TESTPD handling for duplicated operands
We often repeat the vector operand in TESTPS(X,X)/TESTPD(X,X) for anyof comparisons - ensure we still only demand the sign bits when the TESTP is the only user of that operand
Kito Cheng [Fri, 14 Apr 2023 10:46:52 +0000 (18:46 +0800)]
[RISCV][NFC] Add test case for accept hexadecimal floating-point for fli instructions
Zfa provide fli instruction to load a floating point immediate value,
and some of those are not easy to write and read by human, so
hexadecimal floating-point format should be a good alternative way to write:
Consider this case: 1^-16 = 1.
52587890625e-05 (decimal) vs 0x1p-16 (hexadecimal)
The hexadecimal format is easier to write for human.
Fortunately hexadecimal floating-point constants already supported in
C99, so actually we don't need to add any extra code to support that.
This patch added test case for demonstrate we support that and also make
sure this will be supported in future.
I also gonna to talk with ISA folks to adding hexadecimal floating-point
to the ISA spec, so that user will know fli accept value in this format.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D148077
Serge Pavlov [Fri, 14 Apr 2023 10:37:25 +0000 (17:37 +0700)]
Revert "[symbolizer] Change error message if module not found"
This reverts commit
75f1f158812dabc03e70697b6b9c272230bce63d.
It caused fail on https://lab.llvm.org/buildbot#builders/37/builds/21461
Florian Hahn [Fri, 14 Apr 2023 10:35:01 +0000 (11:35 +0100)]
[Matrix] Refine cost estimate for dot-product.
Adjust lowerDotProduct cost estimate to include the cost benefits of:
* emitting a wide load
* emitting a wide multiply.
Reviewed By: thegameg
Differential Revision: https://reviews.llvm.org/D147330
Simon Pilgrim [Fri, 14 Apr 2023 10:07:37 +0000 (11:07 +0100)]
[X86] Add AVX2 test coverage to TESTPS/TESTPD combines
Simon Pilgrim [Fri, 14 Apr 2023 10:05:51 +0000 (11:05 +0100)]
[X86] Add TESTPS/TESTPD test coverage showing failure to simplify demanded sign bit when the operands has multiple uses
Dmitry Makogon [Fri, 14 Apr 2023 10:12:17 +0000 (17:12 +0700)]
[Test] Add tests showing flags improvement for SCEV sub expressions (NFC)
Chen Zheng [Fri, 14 Apr 2023 10:16:01 +0000 (06:16 -0400)]
[AIX] enable the cases that are excluded by XCOFF 64 integrated-as support
These case are excluded in https://reviews.llvm.org/D113049.
Now AIX XCOFF 64 integrated-as support improves a lot and all these
cases pass now, so enable them.
Nikita Popov [Wed, 1 Mar 2023 08:41:59 +0000 (09:41 +0100)]
[llvm-c] Remove PassRegistry and initialization APIs
Remove C APIs for interacting with PassRegistry and pass
initialization. These are legacy PM concepts, and are no longer
relevant for the new pass manager.
Calls to these initialization functions can simply be dropped.
Differential Revision: https://reviews.llvm.org/D145043
Nico Weber [Fri, 14 Apr 2023 10:08:51 +0000 (06:08 -0400)]
[gn] Port
fcc5f9ef50e1 (GenVT)
Nikita Popov [Thu, 6 Apr 2023 08:49:42 +0000 (10:49 +0200)]
[FunctionAttrs] Fix nounwind inference for landingpads
Currently, FunctionAttrs treats landingpads as non-throwing, and
will infer nounwind for functions with landingpads (assuming they
can't unwind in some other way, e.g. via resum). There are two
problems with this:
* Non-cleanup landingpads with catch/filter clauses do not
necessarily catch all exceptions. Unless there are catch ptr null
or filter [0 x ptr] zeroinitializer clauses, we should assume
that we may unwind past this landingpad. This seems like an
outright bug.
* Cleanup landingpads are skipped during phase one unwinding, so
we effectively need to support unwinding past them. Marking these
nounwind is technically correct, but not compatible with how
unwinding works in reality.
Fixes https://github.com/llvm/llvm-project/issues/61945.
Differential Revision: https://reviews.llvm.org/D147694
Florian Hahn [Fri, 14 Apr 2023 09:40:47 +0000 (10:40 +0100)]
[Matrix] Add dot product tests with builtin loads with variable strides
Extra tests for D147330.
Kai Luo [Fri, 14 Apr 2023 09:24:30 +0000 (17:24 +0800)]
[PowerPC] Update `incr` after resetting the register in MI
After performing signed extension, we update the register in MI. We should also update `incr` register which is tracking the register in `MI`.
Fixes https://github.com/llvm/llvm-project/issues/61882.
Reviewed By: #powerpc, shchenz
Differential Revision: https://reviews.llvm.org/D147594
Nikita Popov [Mon, 20 Feb 2023 14:55:17 +0000 (15:55 +0100)]
[InstCombine] Support multiple comparisons in foldAllocaCmp()
foldAllocaCmp() needs to fold all comparisons of an alloca at the
same time, to ensure that there is a consistent view of the alloca
address. Currently, it folds "all" comparisons by limiting to the
case where there is only one. This patch switches the algorithm to
instead actually collect and fold all comparisons.
Something we need to be careful about here is that there may be
comparisons where both sides of the icmp are based on the alloca.
Such comparisons are comparing offsets of the alloca, and as such
can be ignored here, but shouldn't be folded to false.
Differential Revision: https://reviews.llvm.org/D144492
Nikita Popov [Fri, 14 Apr 2023 09:18:18 +0000 (11:18 +0200)]
[InstSimplify] Add MaxRecurse argument to simplifyInstructionWithOperands (NFC)
Christian Sigg [Fri, 14 Apr 2023 09:11:39 +0000 (11:11 +0200)]
Fix bazel build after
e5f50bd26807
Peter Smith [Tue, 11 Apr 2023 17:14:40 +0000 (18:14 +0100)]
[LLD][ARM] Handle .ARM.exidx sections at non-zero output sec offset
Embedded systems that do not use an ELF loader locate the
.ARM.exidx exception table via linker defined __exidx_start and
__exidx_end rather than use the PT_ARM_EXIDX program header. This
means that some linker scripts such as the picolibc C library's
linker script, do not have the .ARM.exidx sections at offset 0 in
the OutputSection. For example:
.except_unordered : {
. = ALIGN(8);
PROVIDE(__exidx_start = .);
*(.ARM.exidx*)
PROVIDE(__exidx_end = .);
} >flash AT>flash :text
This is within the specification of Arm exception tables, and is
handled correctly by ld.bfd.
This patch has 2 parts. The first updates the writing of the data
of the .ARM.exidx SyntheticSection to account for a non-zero
OutputSection offset. The second part makes the PT_ARM_EXIDX program
header generation a special case so that it covers only the
SyntheticSection and not the parent OutputSection. While not strictly
necessary for programs locating the exception tables via the symbols
it may cause ELF utilities that locate the exception tables via
the PT_ARM_EXIDX program header to fail. This does not seem to be the
case for GNU and LLVM readelf which seems to look for the
SHT_ARM_EXIDX section.
Differential Revision: https://reviews.llvm.org/D148033
Kristof Beyls [Wed, 12 Apr 2023 13:01:00 +0000 (15:01 +0200)]
[docs] Clarify that CoC docs are under a CC-BY license.
Differential Revision: https://reviews.llvm.org/D148121
David Stuttard [Mon, 20 Feb 2023 17:11:22 +0000 (17:11 +0000)]
[AMDGPU] Add backend support for new PAL ELF Metadata 3.0
PAL Metadata 3.0 introduces an explicit structure in metadata for the
programmable registers written out by the compiler backend.
Rather than using opaque registers which can change between different
architectures and requires encoding the bitfield information in the backend,
which may change between versions.
This is the initial minimal implementation that enables the use of PAL Metadata
3.0.
The change itself should be NFC for non-PAL, although the way RSRC2 register is
handled has been changed slightly.
The test is fairly minimal, but checks that the metadata format looks as
expected and verifies a couple of special cases such as tgid_[xyz]_en handling
and PsInputAddr/Ena which also change to explicit fields.
Differential Revision: https://reviews.llvm.org/D147143
Nikita Popov [Thu, 13 Apr 2023 08:38:56 +0000 (10:38 +0200)]
[LangRef][Local] dereferenceable metadata violation is UB
I believe !dereferencable violation is immediate undefined behavior,
but this was not explicitly spelled out in LangRef. We already
assume that !dereferenceable is implicitly !noundef and cannot
return poison in isGuaranteedNotToBeUndefOrPoison().
The reason why we made dereferenceable implicitly noundef is that
the purpose of this metadata is to allow speculation, and that
would not be legal on a potential poison pointer.
Differential Revision: https://reviews.llvm.org/D148202
Nikita Popov [Fri, 14 Apr 2023 08:35:17 +0000 (10:35 +0200)]
[InstSimplify] Remove unused ORE argument (NFC)
Diana Picus [Wed, 12 Apr 2023 09:52:44 +0000 (11:52 +0200)]
[AMDGPU] Don't S_MOV_B32 into $scc
The peephole optimizer tries to replace
```
%n:sgpr_32 = S_MOV_B32 x
$scc = COPY %n
```
with a `S_MOV_B32` directly into `$scc`.
This crashes because `S_MOV_B32` cannot take `$scc` as input.
We currently generate code like this from GlobalISel when lowering a
G_BRCOND with a constant condition. We should probably look into
removing this kind of branch altogether, but until then we should at
least not crash.
This patch fixes the issue by making sure we don't apply the peephole
optimization when trying to move into a physical register that
doesn't belong to the correct register class.
Differential Revision: https://reviews.llvm.org/D148117
Nikita Popov [Thu, 13 Apr 2023 15:34:30 +0000 (17:34 +0200)]
[Coroutines] Directly remove unnecessary lifetime intrinsics
The insertSpills() code will currently skip lifetime intrinsic users
when replacing the alloca with a frame reference. Rather than
leaving behind the dead lifetime intrinsics working on the old
alloca, directly remove them. This makes sure the alloca can be
dropped as well.
I noticed this as a regression when converting tests to opaque
pointers. Without opaque pointers, this code didn't really do
anything, because there would usually be a bitcast in between.
The lifetimes would get rewritten to the frame pointer. With
opaque pointers, this code now triggers and leaves behind users
of the old allocas.
Differential Revision: https://reviews.llvm.org/D148240
Krasimir Georgiev [Fri, 14 Apr 2023 08:18:43 +0000 (08:18 +0000)]
[sanitizer] adapt for
75f1f158812dabc03e70697b6b9c272230bce63d
No functional changes intended.
Tobias Gysi [Fri, 14 Apr 2023 07:10:15 +0000 (07:10 +0000)]
[mlir][llvm] Move the LLVM dialect definition (NFC).
The revision separates out the LLVM dialect definition in a separate
tablegen file and ensures the LLVMOpBase.td can include the attributes
defined by LLVMAttrDefs.td. The change allows us to use LLVM dialect
attributes in the definition of the intrinsic and memory operation
base classes, e.g. to represent alias analysis metadata using
attributes.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D148007
Tobias Hieta [Fri, 14 Apr 2023 07:44:35 +0000 (09:44 +0200)]
Revert "[clang-format] Handle object instansiation in if-statements"
This reverts commit
70de684d44135b4025d92b2b36ad387cf5ab8b5a.
This causes a regression as described in #61785
Jie Fu [Fri, 14 Apr 2023 07:46:09 +0000 (15:46 +0800)]
[llvm-exegesis] Fix -Wc++98-compat-extra-semi in BenchmarkRunner.cpp (NFC)
/data/llvm-project/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:66:2: error: extra ';' outside of a function is incompatible with C++98 [-Werror,-W
c++98-compat-extra-semi]
};
^
1 error generated.
Aiden Grossman [Fri, 14 Apr 2023 07:19:10 +0000 (07:19 +0000)]
[llvm-exegesis] Refactor common parts out of FunctionExecutorImpl
This patch refactors some code out of FunctionExecutorImpl into the base
class that should be common across all implementations of
FunctionExecutor. Particularly, this patch factors out
accumulateCounterValues, and also factors out runAndSample, moving
implementation specific code into a new runWithCounter function. This
makes adding new implementations of FunctinExecutor easier.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D148079
Nathan Ridge [Fri, 14 Apr 2023 07:25:40 +0000 (03:25 -0400)]
[clangd] Fix test failure in initialize-params.test
Aiden Grossman [Fri, 14 Apr 2023 07:05:37 +0000 (07:05 +0000)]
[llvm-exegesis][NFC] remove runAndMeasure
This completes the FIXME listed in FunctionExecutor in regards to
deprecating this function. It simply makes the appropriate call into
runAndSample and grabs the first counter value. This patch completely
removes the function, moving that logic into the callers (currently only
uopsBenchmarkRunner). This makes creating new FunctionExecutors easier
as an implementation no longer needs to worry about this detail.
Reviewed By: gchatelet
Differential Revision: https://reviews.llvm.org/D147878
Vlad Serebrennikov [Fri, 14 Apr 2023 07:14:36 +0000 (10:14 +0300)]
[clang] Add test for CWG1894 and CWG2199
[[https://wg21.link/p1787 | P1787]]: CWG1894 and its duplicate CWG2199 are resolved per Richard’s proposal for [[ https://listarchives.isocpp.org/cgi-bin/wg21/message?wg=core&msg=28415 | “dr407 still leaves open questions about typedef / tag hiding” ]], using generic conflicting-declaration rules even for typedef, and discarding a redundant typedef-name when looking up an elaborated-type-specifier.
Wording: See changes to [dcl.typedef], [basic.lookup.elab], and [basic.lookup]/4.
Generic conflicting-declaration rules are specified in changes to [basic.scope.scope]. [[ https://cplusplus.github.io/CWG/issues/407.html | CWG407]], [[ https://cplusplus.github.io/CWG/issues/1894.html | CWG1894 ]], and [[ https://cplusplus.github.io/CWG/issues/2199.html | CWG2199 ]] discuss how elaborated type specifiers interact with typedefs, using directives, and using declarations. Since existing test for CWG407 covers examples provided in CWG1894 and CWG2199, and does it in accordance with P1787, I reused parts of it.
Reviewed By: #clang-language-wg, cor3ntin
Differential Revision: https://reviews.llvm.org/D148136
Nathan Ridge [Tue, 5 Apr 2022 07:19:15 +0000 (03:19 -0400)]
[clangd] Inactive regions support via dedicated protocol
This implements the server side of the approach discussed at
https://github.com/clangd/vscode-clangd/pull/193#issuecomment-
1044315732
Differential Revision: https://reviews.llvm.org/D143974
Job Noorman [Fri, 14 Apr 2023 07:11:08 +0000 (09:11 +0200)]
[JITLink][RISCV] Handle R_RISCV_CALL_PLT fixups
In the default link configuration, PLT stubs are created automatically
for R_RISCV_CALL_PLT relocations and the relocation itself is
transformed to R_RISCV_CALL (PerGraphGOTAndPLTStubsBuilder_ELF_riscv).
Only the latter is later handled when applying fixups and the former is
simply ignored.
This patch proposes to handle R_RISCV_CALL_PLT anyway when applying
fixups to support custom configurations that do not need automatic PLT
creation. An example of this is BOLT where PLT entries from the input
binary are reused (D147544).
Reviewed By: StephenFan
Differential Revision: https://reviews.llvm.org/D148238
Aiden Grossman [Fri, 14 Apr 2023 06:55:35 +0000 (06:55 +0000)]
[MLGO] Change MBB Profile Dump from using MBB numbers to MBB IDs
Currenty, setting the -mbb-profile-dump dumps a CSV file with blocks
inside an individual function identified by their MBB numbers. This
patch changes the MBBs to be identified by their ID which is set at MBB
creation and not changed afterwards, making it inherently stable
throughout the backend. This alleviates concerns with the MBB IDs
changing between the profile dump and what ends up in the final object
file. The MBBs inside the SHT_LLVM_BB_ADDR_MAP sections are also
identified using their MBB ID rather than number, so if we want to match
them up we need to identify the MBBs here by number.
Reviewed By: mtrofin, rahmanl
Differential Revision: https://reviews.llvm.org/D147366
Fangrui Song [Fri, 14 Apr 2023 06:54:08 +0000 (23:54 -0700)]
[bazel] Remove remnant HAVE_LSEEK64 after
5cd554303ead0f8891eee3cd6d25cb07f5a7bf67
Jean Perier [Fri, 14 Apr 2023 06:47:25 +0000 (08:47 +0200)]
[flang] fix fir.array_coor of fir.box with component references
When dealing with "derived_array(j)%component" where derived_array
is not a contiguous array, but for which we know the extent, lowering
generates a fir.array_coor op on a !fir.box<!fir.array<cst x T>> with
a fir.slice containing "j" in the component path.
Codegen first computes "derived_array(j)" address using the byte
strides inside the descriptor, and then computes the offset of "j"
from that address with a second GEP.
The type of the address in that second GEP matters since "j" is passed
in the GEP via an index indicating its component position in the type.
The code was using the LLVM type of "derived_array" instead of
"derived_array(j)".
In general, with fir.box, the extent ("cst" above) is unknown and those
types match. But if the extent of "derived_array" is a compile time
constant, its LLVM type will be [cst x T] instead of T*, and the produced
GEP will compute the address of the nth T instead of the nth component
inside T leading to undefined behaviors.
Fix this by computing the element type for the second GEP.
Differential Revision: https://reviews.llvm.org/D148226
Jean Perier [Fri, 14 Apr 2023 06:43:33 +0000 (08:43 +0200)]
[flang] Change TYPE(*) arrays passing convention
- Fix the BIND(C) assumed-shape case: TYPE(*) assumed shape are passed
via CFI_cdesc_t according to Fortran 2018 standard 18.3.6 point 2 (5).
- Align the none BIND(C) case with the BIND(C) case. There is little
point passing TYPE(*) assumed size via descriptor, use a simple
address. C710 ensures there is no way the knowledge of the actual
type will be required when manipulating the dummy.
Differential Revision: https://reviews.llvm.org/D148130
Jean Perier [Fri, 14 Apr 2023 06:42:15 +0000 (08:42 +0200)]
[flang] Fold IS_CONTIGUOUS for TYPE(*) when possible
TYPE(*) arguments fell through in IS_CONTIGUOUS folding
because they are not Expr<SomeType>. Expose entry point for
symbols in IsContiguous and use that.
The added test revealed that IS_CONTIGUOUS was folded to
false for assumed rank arguments. Fix this: the contiguity of
assumed rank without the CONTIGUOUS argument can only be
verified at runtime.
Differential Revision: https://reviews.llvm.org/D148128
Serge Pavlov [Fri, 14 Apr 2023 06:03:28 +0000 (13:03 +0700)]
[symbolizer] Change error message if module not found
If llvm-symbolize did not find module, the error looked like:
LLVMSymbolizer: error reading file: No such file or directory
This message does not follow common practice: LLVMSymbolizer is not an
utility name. Also the message did not not contain the name of missed file.
With this change the error message looks differently:
llvm-symbolizer: error: 'abc': No such file or directory
This format is closer to messages produced by other utilities and allow
proper coloring.
Differential Revision: https://reviews.llvm.org/D148032
Max Kazantsev [Fri, 14 Apr 2023 05:24:32 +0000 (12:24 +0700)]
[IRCE][NFC] Refactor parseRangeCheckICmp to compute SCEVs instead of Values
The motivation is to make an opportunity to compute and return
expressions after parsing ICmp into a range check (e.g. Length + 1).
Patch by Aleksandr Popov!
Differential Revision: https://reviews.llvm.org/D148205
Karl-Johan Karlsson [Fri, 14 Apr 2023 05:44:44 +0000 (07:44 +0200)]
[compiler-rt] Fix signed shift overflows in absvdi2.c, absvsi2.c, negvdi2.c and negvsi2.c
When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warnings:
UBSan: absvdi2.c:21:23: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long')
UBSan: absvsi2.c:21:23: left shift of 1 by 31 places cannot be represented in type 'si_int' (aka 'long')
UBSan: negvdi2.c:20:32: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long')
UBSan: negvsi2.c:20:32: left shift of 1 by 31 places cannot be represented in type 'si_int' (aka 'long')
This can be avoided by doing the shift in a matching unsigned variant of the
type.
This was found in an out of tree target.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D146932
Thurston Dang [Thu, 13 Apr 2023 23:55:01 +0000 (23:55 +0000)]
Re-land 'ASan: move allocator base to avoid conflict with high-entropy ASLR for x86-64 Linux'
D147984 was reverted because it broke lit tests on Mac. This revision is based on D147984
but maintains the old behavior for Apple.
Note that, per the follow-up discussion with MaskRay in D147984, this patch excludes Apple
but includes other platforms (e.g., aarch64, MIPS64) and OSes (e.g., FreeBSD, S390X), not just
x86-64 Linux.
Original commit message from D147984:
Users have discovered [*] that when CONFIG_ARCH_MMAP_RND_BITS == 32,
it will frequently conflict with ASan's allocator on x86-64 Linux, because the
PIE program segment base address of 0x555555555554 plus an ASLR shift of up to
((2**32) * 4K == 0x100000000000) will sometimes exceed ASan's hardcoded
base address of 0x600000000000. We fix this by simply moving the allocator base
to 0x500000000000, which is below the PIE program segment base address. This is
cleaner than trying to move it to another location that is sandwiched between
the PIE program and library segments, because if either of those grow too large,
it will collide with the allocator region.
Note that we will never need to change this base address again (unless we want to increase
the size of the allocator), because ASLR cannot be set above 32-bits for x86-64 Linux (the
PIE program segment and library segments would collide with each other; see also
ARCH_MMAP_RND_BITS_MAX in https://github.com/torvalds/linux/blob/master/arch/x86/Kconfig).
[*] see https://b.corp.google.com/issues/
276925478
and https://groups.google.com/a/google.com/g/chrome-os-gardeners/c/BbfzCP3dEeo/m/h3C_vVUxCQAJ
Differential Revision: https://reviews.llvm.org/D148280
Sam Clegg [Thu, 13 Apr 2023 18:41:27 +0000 (11:41 -0700)]
[lld][WebAssembly] stub objects: Fix handling of LTO libcall dependencies
This actually simplifies the code by performs a pre-pass of the stub
objects prior to LTO.
This should be the final change needed before we can make the switch
on the emscripten side: https://github.com/emscripten-core/emscripten/pull/18905
Differential Revision: https://reviews.llvm.org/D148287
wangpc [Fri, 14 Apr 2023 03:07:29 +0000 (11:07 +0800)]
[TableGen] Allow references to class template arguments in defvar
We can't refer to template arguments for defvar statements in class
definitions, or it will report some errors like:
```
error: Variable not defined: 'xxx'.
```
The key point here is we used to pass nullptr to `ParseValue` in
`ParseDefvar`. As a result, we can't refer to template arguments
since `CurRec` is nullptr in `ParseIDValue`.
So we add an argument `CurRec` to `ParseDefvar` and provide it
when parsing defvar statements in class definitions.
Reviewed By: tra, simon_tatham
Differential Revision: https://reviews.llvm.org/D148197
varconst [Fri, 14 Apr 2023 03:07:18 +0000 (20:07 -0700)]
[libc++] Fix `generate_ignore_format.sh` and regenerate the file.
The script incorrectly produced double slashes in paths, e.g.
`libcxx/src//thread.cpp`.
Jie Fu [Fri, 14 Apr 2023 01:47:21 +0000 (09:47 +0800)]
[lldb][test] Fix -Wsign-compare in RegisterFlagsTest.cpp (NFC)
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1526:11: error: comparison of integers of different signs: 'const unsigned long long' and 'const int' [-Werror,-Wsign-compare]
if (lhs == rhs) {
~~~ ^ ~~~
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:1553:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<unsigned long long, int>' requested here
return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
^
/data/llvm-project/lldb/unittests/Target/RegisterFlagsTest.cpp:128:3: note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<unsigned long long, int, nullptr>' requested here
ASSERT_EQ(0x12345678ULL, rf.ReverseFieldOrder(0x12345678));
^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2056:32: note: expanded from macro 'ASSERT_EQ'
^
/data/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:2040:54: note: expanded from macro 'GTEST_ASSERT_EQ'
ASSERT_PRED_FORMAT2(::testing::internal::EqHelper::Compare, val1, val2)
^
1 error generated.
V Donaldson [Fri, 14 Apr 2023 01:33:29 +0000 (18:33 -0700)]
Revert "[flang] REAL(KIND=3) and COMPLEX(KIND=3) descriptors"
This reverts commit
17a4fcecf40ee5191ab05b27a58ac37e5f57261d.
Yeting Kuo [Mon, 10 Apr 2023 01:25:52 +0000 (09:25 +0800)]
[RISCV] Support vector strict_fsetcc/fsetccs.
The patch supports vector strict_fsetcc/fsetccs. Instead of revserving fflags,
the method to implement scalar quiet compares, the patch implement quiet
compares by masking the signaling compares when either input is NaN [0].
[0]: https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#vector-floating-point-compare-instructions
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147998
V Donaldson [Wed, 12 Apr 2023 19:15:27 +0000 (12:15 -0700)]
[flang] REAL(KIND=3) and COMPLEX(KIND=3) descriptors
Update descriptor generation to correctly set the `type` field for
REAL(3) and COMPLEX(3) objects.
Jonas Devlieghere [Thu, 13 Apr 2023 23:27:53 +0000 (16:27 -0700)]
[lldb] Use ObjectFileJSON to create modules for interactive crashlogs
Create an artificial module using a JSON object file when we can't
locate the module and dSYM through dsymForUUID (or however
locate_module_and_debug_symbols is implemented). By parsing the symbols
from the crashlog and making them part of the JSON object file, LLDB can
symbolicate frames it otherwise wouldn't be able to, as there is no
module for it.
For non-interactive crashlogs, that never was a problem because we could
simply show the "pre-symbolicated" frame from the input. For interactive
crashlogs, we need a way to pass the symbol information to LLDB so that
it can symbolicate the frames, which is what motivated the JSON object
file format.
Differential revision: https://reviews.llvm.org/D148172
NAKAMURA Takumi [Sun, 26 Mar 2023 10:53:05 +0000 (19:53 +0900)]
Generate staging `MachineValueType.h` (partially) from `ValueTypes.td`
- Implement `VTEmitter` as `llvm-tblgen -gen-vt`.
- Create a copy of `llvm/Support/MachineValueType.h` into `unittests/Support`.
It includes `GenVT.inc` generated by `VTEmitter`.
- Implement `MVTTest` in `SupportTests`. It checks equivalence between
`llvm/Support/MachineValueType.h` and the generated header.
Differential Revision: https://reviews.llvm.org/D146906
NAKAMURA Takumi [Sun, 26 Mar 2023 10:52:05 +0000 (19:52 +0900)]
Copy `llvm/Support/MachineValueType.h` into `unittests/Support` for D146906
Differential Revision: https://reviews.llvm.org/D146907
Jie Fu [Thu, 13 Apr 2023 23:13:58 +0000 (07:13 +0800)]
[flang] Fix -Wmismatched-tags warning of NonTbpDefinedIoTable (NFC)
/Users/jiefu/llvm-project/flang/runtime/non-tbp-dio.h:41:1: error: 'NonTbpDefinedIoTable' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Werror,-Wmismatched-tags]
struct NonTbpDefinedIoTable {
^
/Users/jiefu/llvm-project/flang/include/flang/Runtime/io-api.h:26:1: note: did you mean struct here?
class NonTbpDefinedIoTable;
^~~~~
struct
1 error generated.
Valentin Clement [Thu, 13 Apr 2023 22:35:45 +0000 (15:35 -0700)]
[flang][openacc] Lower serial and serial loop construct
Lower the parse tree to acc dialects operations. Make use
of the parallel construct lowering and make it suitable
for all compute constructs lowering.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D148273
Peter Klausler [Thu, 13 Apr 2023 17:28:19 +0000 (10:28 -0700)]
[flang] Rework handling of non-type-bound user-defined I/O
A fairly recent introduction of runtime I/O APIs called OutputDerivedType()
and InputDerivedType() didn't cover NAMELIST I/O's need to access
non-type-bound generic interfaces for user-defined derived type I/O
when those generic interfaces are defined in some scope other than the
one that defines the derived type.
The patch adds a new data structure shared between lowering
and the runtime that can represent all of the cases that can
arise with non-type-bound defined I/O. It can represent
scopes in which non-type-bound defined I/O generic interfaces
are inaccessible, too, due to IMPORT statements.
The data structure is now an operand to OutputDerivedType() and
InputDerivedType() as well as a data member in the NamelistGroup
structure.
Differential Revision: https://reviews.llvm.org/D148257
Fangrui Song [Thu, 13 Apr 2023 22:09:24 +0000 (15:09 -0700)]
[Demangle] Remove uses of llvm::itanium_demangle::StringView::{dropBack,dropFront}. NFC
Make it easier to migrate StringView to std::string_view.
do [Thu, 13 Apr 2023 22:02:46 +0000 (18:02 -0400)]
[Flang][OpenMP] Add support for logical neqv reduction in worksharing-loop
Adds support for .neqv. reductions with logical types.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D147677
Valentin Clement [Thu, 13 Apr 2023 21:35:02 +0000 (14:35 -0700)]
[mlir][openacc] Accept acc.serial has parent of acc.yield op
acc.serial op is modeled on the acc.parallel op.
acc.yield operation must then accept acc.serial has a parent
operation.
Reviewed By: PeteSteinfeld, razvanlupusoru
Differential Revision: https://reviews.llvm.org/D148258
William Huang [Wed, 12 Apr 2023 00:49:05 +0000 (00:49 +0000)]
[llvm-profdata] Fixed various issue with Sample Profile Reader
Fixed various undefind behaviors with current Sample Profile Reader when reading unusual input. Furthermore, add the following rule on allowing multiple name table sections (current Reader has conflicted code handling such case):
When a new name table section is read (in the order sections are read), the names in the previous name table are cleared. Any subsequent sections referring to function names will index into the most recent read name table.
Also changed name table index to uint64_t to be consistent since there's a mix of using uint32_t and uint64_t.
Reviewed By: snehasish, huangjd
Differential Revision: https://reviews.llvm.org/D146182
Jonas Devlieghere [Thu, 13 Apr 2023 21:19:39 +0000 (14:19 -0700)]
[lldb] Use the host's target triple in TestObjectFileJSON
Use the target's triple when adding JSON modules in TestObjectFileJSON.
This should fix the test failure on non-Darwin bots.
Jonas Devlieghere [Thu, 13 Apr 2023 20:02:45 +0000 (13:02 -0700)]
[lldb] Make ObjectFileJSON loadable as a module
This patch adds support for creating modules from JSON object files.
This is necessary for the crashlog use case where we don't have either a
module or a symbol file. In that case the ObjectFileJSON serves as both.
The patch adds support for an object file type (i.e. executable, shared
library, etc). It also adds the ability to specify sections, which is
necessary in order specify symbols by address. Finally, this patch
improves error handling and fixes a bug where we wouldn't read more than
the initial 512 bytes in GetModuleSpecifications.
Differential revision: https://reviews.llvm.org/D148062
Florian Hahn [Thu, 13 Apr 2023 21:00:51 +0000 (22:00 +0100)]
[VPlan] Switch to checking sinking legality for recurrences in VPlan.
Building on D142885 and D142589, retire the SinkAfter map from the
recurrence handling code. It is replaced by checking whether it is
possible to sink all users of a recurrence directly in VPlan. This
results in simpler code overall and allows to handle additional cases
(see the improvements in @test_crash).
Depends on D142885.
Depends on D142589.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D142886
Leandro Lupori [Fri, 27 Jan 2023 18:34:00 +0000 (18:34 +0000)]
Reland "[compiler-rt] Fix scudo build on ARM"
This reverts commit
5abef0bdbe9237b5728215bb7cd915ffb960e5c3 and
fixes Fuchsia AArch64 cross-compile.
Nicolas Vasilache [Thu, 13 Apr 2023 15:27:40 +0000 (08:27 -0700)]
[mlir][Vector] Add a masked vectorization of tensor.pad
This revision takes advantage of masking support to introduce a vectorized
version of pad that does not require lowering to lower-level form.
Lowering to lower-level form (if/else + generate + fill + copy + insert_slice)
creates unnecessary complexity that can be completely sidestepped by using
masked vectorization properly.
Differential Revision: https://reviews.llvm.org/D148261
Fangrui Song [Thu, 13 Apr 2023 19:40:55 +0000 (12:40 -0700)]
[AArch64] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds
Florian Hahn [Thu, 13 Apr 2023 19:23:56 +0000 (20:23 +0100)]
[LV] Add exit users for recurrences in test, fix names.
Add users of exit values for recurrences to make sure exit value
generation will be checked in a follow-up change.
Also adjusts/fixes naming in the test.
Nicolas Vasilache [Thu, 13 Apr 2023 19:19:22 +0000 (12:19 -0700)]
[mlir][Vector] Add a vector.materialize_masks transform operation
Craig Topper [Thu, 13 Apr 2023 18:53:43 +0000 (11:53 -0700)]
[LoopIdiomRecognize] Remove NUW flag from SCEV in getTripCount.
Based on the conversation in D147355.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D148170
Matt Arsenault [Tue, 11 Apr 2023 18:20:05 +0000 (14:20 -0400)]
Attributor: Add baseline tests for nofpclass changes
Matt Arsenault [Thu, 13 Apr 2023 15:42:35 +0000 (11:42 -0400)]
ValueTracking: Add some more uitofp/sitofp tests
Before computeKnownFPClass had a use, these were
only covered by unit tests and didn't cover vectors.
Ivan Trofimov [Fri, 3 Feb 2023 08:29:00 +0000 (00:29 -0800)]
[runtimes][asan] Fix swapcontext interception
Resetting oucp's stack to zero in swapcontext interception is incorrect,
since it breaks ucp cleanup after swapcontext returns in some cases:
Say we have two contexts, A and B, and we swapcontext from A to B, do
some work on Bs stack and then swapcontext back from B to A. At this
point shadow memory of Bs stack is in arbitrary state, but since we
can't know whether B will ever swapcontext-ed to again we clean up it's
shadow memory, because otherwise it remains poisoned and blows in
completely unrelated places when heap-allocated memory of Bs context
gets reused later (see https://github.com/llvm/llvm-project/issues/58633
for example). swapcontext prototype is swapcontext(ucontext* oucp,
ucontext* ucp), so in this example A is oucp and B is ucp, and i refer
to the process of cleaning up Bs shadow memory as ucp cleanup.
About how it breaks:
Take the same example with A and B: when we swapcontext back from B to A
the oucp parameter of swapcontext is actually B, and current trunk
resets its stack in a way that it becomes "uncleanupable" later. It
works fine if we do A->B->A, but if we do A->B->A->B->A no cleanup is
performed for Bs stack after B "returns" to A second time. That's
exactly what happens in the test i provided, and it's actually a pretty
common real world scenario.
Instead of resetting oucp's we make use of uc_stack.ss_flags to mark
context as "cleanup-able" by storing stack specific hash. It should be
safe since this field is not used in [get|make|swap]context functions
and is hopefully never meaningfully used in real-world scenarios (and i
haven't seen any).
Fixes https://github.com/llvm/llvm-project/issues/58633
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D137654
Matt Arsenault [Sat, 8 Apr 2023 23:13:56 +0000 (19:13 -0400)]
ValueTracking: Add baseline test for computeKnownFPClass for sin/cos
Matt Arsenault [Wed, 12 Apr 2023 14:35:13 +0000 (10:35 -0400)]
ValueTracking: Add cannotBeOrderedLessThanZero to KnownFPClass
Eventually we should be able to replace the existing
CannotBeOrderedLessThanZero.
Matt Arsenault [Sat, 8 Apr 2023 19:24:33 +0000 (15:24 -0400)]
ValueTracking: Address todo for nan fmul handling in computeKnownFPClass
If both operands can't be zero or nan, the result can't be nan.
Matt Arsenault [Sat, 8 Apr 2023 18:35:15 +0000 (14:35 -0400)]
ValueTracking: Handle no-nan check for computeKnownFPClass for fmul
Copy the logic from isKnownNeverNaN for fadd/fsub. Leave the
extension to handle the zero case for a future change.