Paul Kirth [Fri, 26 Aug 2022 20:25:07 +0000 (20:25 +0000)]
[llvm][ir][NFC] Clean up "if after return" in ProfDataUtils.cpp
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D131236
Paul Kirth [Fri, 26 Aug 2022 18:14:39 +0000 (18:14 +0000)]
[llvm][misexpect] Re-enable MisExpect for SampleProfiling
MisExpect was occasionally crashing under SampleProfiling, due to a division by zero.
We worked around that in D124302 by changing the assert to an early return.
This patch is intended to add a test case for the crashing scenario and
re-enable MisExpect for SampleProfiling.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D124481
Aart Bik [Fri, 26 Aug 2022 19:31:22 +0000 (12:31 -0700)]
[mlir][sparse] move sparse2sparse conversion to own test file
Rationale:
We were running *all* conversion tests two times, just to check the
difference of one indidivual test in that file. By splitting that test
out, we have a much more focused testing setup.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D132757
Nikolas Klauser [Fri, 26 Aug 2022 15:51:35 +0000 (17:51 +0200)]
[libc++] Remove __deque_base
This patch simplifies the implementation of `deque` by removing the `__deque_base` class which results in a lot less indirections and removes the need for `__base::`.
Reviewed By: ldionne, #libc
Spies: AdvenamTacet, libcxx-commits
Differential Revision: https://reviews.llvm.org/D132081
Nikolas Klauser [Fri, 26 Aug 2022 15:48:11 +0000 (17:48 +0200)]
[libc++][NFC] Remove some of the code duplication in the string tests
Reviewed By: ldionne, #libc, huixie90
Spies: huixie90, libcxx-commits, arphaman
Differential Revision: https://reviews.llvm.org/D131856
ziqingluo-90 [Fri, 26 Aug 2022 19:35:25 +0000 (12:35 -0700)]
[clang-tidy] Adding the missing handling of "noreturn" attributes for Obj-C nodes in `InfiniteLoopChecker`
With this commit, the `InfiniteLoopChecker` now recognizes message
expressions to "noreturn" methods as well as calls to "noreturn"
blocks.
Reviewed by NoQ, njames93
Differential Revision: https://reviews.llvm.org/D128314
Sterling Augustine [Fri, 26 Aug 2022 19:43:05 +0000 (12:43 -0700)]
Remove unused private variable.
Sterling Augustine [Fri, 26 Aug 2022 19:39:29 +0000 (12:39 -0700)]
Eliminate unused-variable warning.
Florian Hahn [Fri, 26 Aug 2022 19:39:52 +0000 (20:39 +0100)]
[LAA] Require AddRecs to be in the innermost loop for diff-checks.
The simpler diff-checks require pointers with add-recs from the same
innermost loop, but this property wasn't check completely. Add the
missing check to ensure both addrecs are in the innermost loop.
Fixes #57315.
Lang Hames [Fri, 26 Aug 2022 16:46:02 +0000 (09:46 -0700)]
[ORC] Add "wrap" and "unwrap" steps to ExecutorAddr toPtr/fromPtr.
The wrap/unwrap operations are applied to pointers after/before conversion to/from
raw addresses. They can be used to tag, untag, sign, or strip signing from
pointers. They currently default to 'rawPtr' (identity) on all platforms, but it
is expected that the default will be set based on the host architecture, e.g.
they would default to signing/stripping for arm64e.
Peter Klausler [Fri, 26 Aug 2022 17:17:59 +0000 (10:17 -0700)]
[flang][runtime] Corrections for byte-swapped I/O
Unformatted I/O with byte swapping was reversing bytes in badly-sized
frames for character, complex, and some default derived type transfers.
Differential Revision: https://reviews.llvm.org/D132751
Siva Chandra Reddy [Thu, 25 Aug 2022 20:04:50 +0000 (20:04 +0000)]
[libc] Implement POSIX truncate and ftruncate functions for Linux.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D132705
LLVM GN Syncbot [Fri, 26 Aug 2022 19:20:51 +0000 (19:20 +0000)]
[gn build] Port
82e893c47c77
ziqingluo-90 [Fri, 26 Aug 2022 19:16:20 +0000 (12:16 -0700)]
[analyzer] Fixing a bug raising false positives of stack block object
leaking in ARC mode
When ARC (automatic reference count) is enabled, (objective-c) block
objects are automatically retained and released thus they do not leak.
Without ARC, they still can leak from an expiring stack frame like
other stack variables.
With this commit, the static analyzer now puts a block object in an
"unknown" region if ARC is enabled because it is up to the
implementation to choose whether to put the object on stack initially
(then move to heap when needed) or in heap directly under ARC.
Therefore, the `StackAddrEscapeChecker` has no need to know
specifically about ARC at all and it will not report errors on objects
in "unknown" regions.
Reviewed By: NoQ (Artem Dergachev)
Differential Revision: https://reviews.llvm.org/D131009
Siva Chandra Reddy [Thu, 25 Aug 2022 22:30:30 +0000 (22:30 +0000)]
[libc] Add Linux implementation of GNU extension function sendfile.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D132721
Nico Weber [Fri, 26 Aug 2022 19:11:45 +0000 (15:11 -0400)]
[gn build] port
47166968db5c (no more clang-offload-wrapper)
Benjamin Kramer [Fri, 26 Aug 2022 18:59:16 +0000 (20:59 +0200)]
[bazel] Drop clang-offload-wrapper. It was deleted in
47166968db5c5c677bda996e0c5e40e94d8ef09f
Dmitry Preobrazhensky [Fri, 26 Aug 2022 19:01:30 +0000 (22:01 +0300)]
[AMDGPU][MC][GFX11][NFC] Add missing asm tests for VOPCX and VOPCX.DPP instructions
Differential Revision: https://reviews.llvm.org/D132692
Dmitry Preobrazhensky [Fri, 26 Aug 2022 18:55:38 +0000 (21:55 +0300)]
[AMDGPU][MC][GFX11][NFC] Add missing asm tests for VOP2 and VOP2.DPP instructions
Differential Revision: https://reviews.llvm.org/D132675
Dmitry Preobrazhensky [Fri, 26 Aug 2022 18:49:47 +0000 (21:49 +0300)]
[AMDGPU][MC][GFX11][NFC] Add missing asm tests for VOP1 DPP instructions
Differential Revision: https://reviews.llvm.org/D132655
Abraham Corea Diaz [Fri, 26 Aug 2022 18:31:38 +0000 (18:31 +0000)]
[clang] Enable output of SARIF diagnostics
Enables Clang to emit diagnostics in SARIF format when
`-fdiagnostics-format=sarif`. Adds a new DiagnosticConsumer named
SARIFDiagnosticPrinter and a new DiagnosticRenderer named SARIFDiagnostic
to constuct and emit a SARIF object containing the run's basic diagnostic info.
Reviewed By: cjdb, denik, aaron.ballman
Differential Revision: https://reviews.llvm.org/D131632
Joseph Huber [Wed, 24 Aug 2022 14:16:08 +0000 (09:16 -0500)]
[OpenMP] Deprecate the old driver for OpenMP offloading
Recently OpenMP has transitioned to using the "new" driver which
primarily merges the device and host linking phases into a single
wrapper that handles both at the same time. This replaced a few tools
that were only used for OpenMP offloading, such as the
`clang-offload-wrapper` and `clang-nvlink-wrapper`. The new driver
carries some marked benefits compared to the old driver that is now
being deprecated. Things like device-side LTO, static library
support, and more compatible tooling. As such, we should be able to
completely deprecate the old driver, at least for OpenMP. The old driver
support will still exist for CUDA and HIP, although both of these can
currently be compiled on Linux with `--offload-new-driver` to use the new
method.
Note that this does not deprecate the `clang-offload-bundler`, although
it is unused by OpenMP now, it is still used by the HIP toolchain both
as their device binary format and object format.
When I proposed deprecating this code I heard some vendors voice
concernes about needing to update their code in their fork. They should
be able to just revert this commit if it lands.
Reviewed By: jdoerfert, MaskRay, ye-luo
Differential Revision: https://reviews.llvm.org/D130020
Dmitry Preobrazhensky [Fri, 26 Aug 2022 18:44:31 +0000 (21:44 +0300)]
[AMDGPU][MC][GFX11][NFC] Add missing asm tests for VOP1 instructions
Differential Revision: https://reviews.llvm.org/D132649
Dmitry Preobrazhensky [Fri, 26 Aug 2022 18:37:40 +0000 (21:37 +0300)]
[AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOPC and VOPC.DPP instructions
Differential Revision: https://reviews.llvm.org/D132737
Michael Jones [Wed, 15 Jun 2022 23:08:28 +0000 (16:08 -0700)]
[libc] add compile option for printf arg type array
This patch allows for adjusting the size of the array that printf uses
to track the types of arguments in index mode. This is useful for
optimizing the tradeoff between memory usage and performance.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D131993
Dmitry Preobrazhensky [Fri, 26 Aug 2022 18:32:55 +0000 (21:32 +0300)]
[AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOP2 and VOP2.DPP instructions
Differential Revision: https://reviews.llvm.org/D132733
Dmitry Preobrazhensky [Fri, 26 Aug 2022 18:28:46 +0000 (21:28 +0300)]
[AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOP1 and VOP1.DPP instructions
Differential Revision: https://reviews.llvm.org/D132731
Leonard Chan [Fri, 26 Aug 2022 18:22:17 +0000 (18:22 +0000)]
[clang] Do not instrument the rtti_proxies under hwasan
We run into a duplicate symbol error when instrumenting the rtti_proxies
generated as part of the relative vtables ABI with hwasan:
```
ld.lld: error: duplicate symbol: typeinfo for icu_71::UObject
(.rtti_proxy)
>>> defined at brkiter.cpp
>>>
arm64-hwasan-shared/obj/third_party/icu/source/common/libicuuc.brkiter.cpp.o:(typeinfo
for icu_71::UObject (.rtti_proxy))
>>> defined at locavailable.cpp
>>>
arm64-hwasan-shared/obj/third_party/icu/source/common/libicuuc.locavailable.cpp.o:(.data.rel.ro..L_ZTIN6icu_717UObjectE.rtti_proxy.hwasan+0xE00000000000000)
```
The issue here is that the hwasan alias carries over the visibility and
linkage of the original proxy, so we have duplicate external symbols
that participate in linking. Similar to D132425 we can just disable
hwasan for the proxies for now.
Differential Revision: https://reviews.llvm.org/D132691
Leonard Chan [Fri, 26 Aug 2022 18:20:34 +0000 (18:20 +0000)]
[clang] Do not instrument relative vtables under hwasan
Full context in
https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=107017.
Instrumenting hwasan with globals results in a linker error under the
relative vtables abi:
```
ld.lld: error:
libunwind.cpp:(.rodata..L_ZTVN9libunwind12UnwindCursorINS_17LocalAddressSpaceENS_15Registers_arm64EEE.hwasan+0x8):
relocation R_AARCH64_PLT32 out of range:
6845471433603167792 is not in
[-
2147483648,
2147483647]; references
libunwind::AbstractUnwindCursor::~AbstractUnwindCursor()
>>> defined in
libunwind/src/CMakeFiles/unwind_shared.dir/libunwind.cpp.obj
```
This is because the tag is included in the vtable address when
calculating the offset between the vtable and virtual function. A
temporary solution until we can resolve this is to just disable hwasan
instrumentation on relative vtables specifically, which can be done in
the frontend.
Differential Revision: https://reviews.llvm.org/D132425
Philip Reames [Fri, 26 Aug 2022 18:13:53 +0000 (11:13 -0700)]
Revert "[InstCombine] Canonicalize "and, add", "or, add", "xor, add""
This reverts commit
d2f110c693c88d1bb7caee4f72ebb14766f85239. test/Transforms/InstCombine/freeze.ll fails on ninja check-llvm on x86_64.
Philip Reames [Fri, 26 Aug 2022 17:59:17 +0000 (10:59 -0700)]
[LV] Consistently use vputils::isUniformAfterVectorization [mostly nfc]
I'd extracted isUniform, and Florian moved isUniformAfterVectorization out of VPlan at basically the same time. Let's go ahead and merge them.
For the VPTransformState::get path, a VPValue without a def (which corresponds to an external IR value outside of VPLan) is explicitly handled above the uniform check. On the scalarizeInstruction path, I'm less sure why the change isn't visible, but test cases which would seem likely to hit it were already being handled as uniform through some other mechanism. It would be correct to consider values defined outside of vplan uniform here.
Eric Gullufsen [Wed, 24 Aug 2022 15:58:47 +0000 (11:58 -0400)]
[InstCombine] Canonicalize "and, add", "or, add", "xor, add"
Canonicalize
```
((x + C1) & C2) --> ((x & C2) + C1)
((x + C1) ^ C2) --> ((x ^ C2) + C1)
((x + C1) | C2) --> ((x | C2) + C1)
```
for suitable constants `C1` and `C2`.
Alive2 proofs: [[ https://alive2.llvm.org/ce/z/BqMDVZ | add, or --> or, add ]]
[[ https://alive2.llvm.org/ce/z/BhAeCl | add, xor --> xor, add ]]
[[ https://alive2.llvm.org/ce/z/jYRHEt | add, and --> and, add ]]
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D131142
Eric Gullufsen [Wed, 24 Aug 2022 14:44:04 +0000 (10:44 -0400)]
[NFC][InstCombine] Add baseline tests for canonicalizing "and, add", "or, add", "xor, add"
Baseline tests for canonicalizing "logic op, add"
```
((x + C1) & C2) --> ((x & C2) + C1)
((x + C1) ^ C2) --> ((x ^ C2) + C1)
((x + C1) | C2) --> ((x | C2) + C1)
```
for suitable constants `C1` and `C2`.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D131140
Sanjay Patel [Fri, 26 Aug 2022 15:15:09 +0000 (11:15 -0400)]
[InstCombine] fold test of equality to 0.0 with bitcast operand
fcmp oeq/une (bitcast X), 0.0 --> (and X, SignMaskC) ==/!= 0
https://alive2.llvm.org/ce/z/ZKATGN
Sanjay Patel [Fri, 26 Aug 2022 14:20:37 +0000 (10:20 -0400)]
[InstCombine] add tests for fcmp with bitcast operand; NFC
Simon Pilgrim [Fri, 26 Aug 2022 17:42:42 +0000 (18:42 +0100)]
[CostModel][X86] Add CodeSize handling for and/or/xor ops
Eventually this will be part of the cost table lookup
Florian Hahn [Fri, 26 Aug 2022 17:26:32 +0000 (18:26 +0100)]
[VPlan] Move isUniformAfterVectorization from VPlan to vputils (NFC).
This allows re-using the utility without a VPlan object. The helper also
doesn't access any data from VPlan.
Alexey Bataev [Fri, 26 Aug 2022 17:21:35 +0000 (10:21 -0700)]
[SLP][NFC]Add a test for vectorization of stores with float constants,
NFC.
Benjamin Kramer [Fri, 26 Aug 2022 17:17:05 +0000 (19:17 +0200)]
Philip Reames [Fri, 26 Aug 2022 16:37:45 +0000 (09:37 -0700)]
[LV] Extract utility for checking if VPValue is uniform [nfc]
Mircea Trofin [Fri, 26 Aug 2022 16:49:53 +0000 (09:49 -0700)]
[mlgo] Don't set the source permissions when copying over tf files
This is akin to the `install` behavior. It should make build directory
deletable on certain build bots.
Shafik Yaghmour [Fri, 26 Aug 2022 16:12:29 +0000 (09:12 -0700)]
[Clang] Fix assert in Sema::LookupTemplateName so that it does not attempt an unconditional cast to TagType
In Sema::LookupTemplateName(...) seeks to assert that the ObjectType is complete
or being defined. If the type is incomplete it will attempt to unconditionally
cast it to a TagType and not all incomplete types are a TagType. For example the
type could be void or it could be an IncompleteArray.
This change adds an additional check to confirm it is a TagType before attempting
to check if it is incomplete or being defined
Differential Revision: https://reviews.llvm.org/D132712
Simon Pilgrim [Fri, 26 Aug 2022 16:34:43 +0000 (17:34 +0100)]
[CostModel][X86] Add CodeSize handling for fneg ops
Eventually this will be part of the cost table lookup
Simon Pilgrim [Fri, 26 Aug 2022 15:24:35 +0000 (16:24 +0100)]
[CostModel][X86] getArithmeticInstrCost - use the cost tables for all cost kinds
The tables currently only have TCK_RecipThroughput costs, but we should now be able to add individual entries without any further refactoring
Mahesh Ravishankar [Fri, 26 Aug 2022 16:29:02 +0000 (16:29 +0000)]
[mlir][TilingInterface] Enabling tiling `tensor.pad` using `TilingInterface`.
Update the implementation of `TilingInterface` for `tensor.pad`
operations to allow tiling the op using the existing patterns for the
interface. Verify that tests that pass with existing pad tiling
patterns producer the same results through TilingInterface patterns.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D132720
Florian Hahn [Fri, 26 Aug 2022 16:28:41 +0000 (17:28 +0100)]
[LV] Add another test for incorrect runtime check generation.
Add a variation of @nested_loop_outer_iv_addrec_invariant_in_inner with
the dependence sink and source swapped to extend test coverage.
Also simplifies the test by removing an unneeded reduction.
Xiang Li [Wed, 20 Jul 2022 22:27:41 +0000 (15:27 -0700)]
[HLSL] Move DXIL validation version out of ModuleFlags
Put DXIL validation version into separate NamedMetadata to avoid update ModuleFlags.
Currently DXIL validation version is saved in ModuleFlags in clang codeGen.
Then in DirectX backend, the data will be extracted from ModuleFlags and cause rebuild of ModuleFlags.
This patch will build NamedMetadata for DXIL validation version and remove the code to rebuild ModuleFlags.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D130207
Mahesh Ravishankar [Fri, 26 Aug 2022 16:15:08 +0000 (16:15 +0000)]
[mlir][Linalg] Drop check for output indexing maps.
The current check for form of the output indexing maps disallows
generic ops that return both a reduced and unreduced value. Such an op
seems like it could fall within the scope of a Strucutred op. Drop the
check. The only load-bearing place this was found to cause isseus was
during vectorization, but the fix for that seems to be simple.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D132716
Nicolas Vasilache [Fri, 19 Aug 2022 15:33:09 +0000 (08:33 -0700)]
[mlir][MemRef] Introduce a memref.extract_metadata op.
This is the counterpart of `memref.reinterpret_cast` and is useful to lift
strided memref manipulation out of the LLVM dialect.
Discussion: https://discourse.llvm.org/t/extracting-dynamic-offsets-strides-from-memref/64170
Differential Revision: https://reviews.llvm.org/D132243
Corentin Jabot [Fri, 26 Aug 2022 08:20:12 +0000 (10:20 +0200)]
[Clang] Fix crash in coverage of if consteval.
Clang crashes when encountering an `if consteval` statement.
This is the minimum fix not to crash.
The fix is consistent with the current behavior of if constexpr,
which does generate coverage data for the discarded branches.
This is of course not correct and a better solution is
needed for both if constexpr and if consteval.
See https://github.com/llvm/llvm-project/issues/54419.
Fixes #57377
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D132723
Nikolas Klauser [Mon, 22 Aug 2022 00:59:09 +0000 (02:59 +0200)]
[libc++] Enable hash only for the correct types
Also implement LWG3705.
Fixes https://github.com/llvm/llvm-project/issues/55823
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D132338
Nikolas Klauser [Fri, 26 Aug 2022 15:36:25 +0000 (17:36 +0200)]
[libc++][NFC] Remove reserved names from support/constexpr_char_traits.h
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D132341
Akira Hatanaka [Fri, 26 Aug 2022 04:34:09 +0000 (21:34 -0700)]
[compiler-rt][builtins] Add compiler flags to catch potential errors
that can lead to security vulnerabilities
Also, fix a few places that were causing -Wshadow and
-Wformat-nonliteral warnings to be emitted.
This reapplies the patch that was reverted in
caaafe4ae250 because it
broke Fuchsia builders.
I reverted the changes I made to InstrProfData.inc and instead renamed
the variables in InstrProfilingWriter.c. Also fixed a bug in function
add_security_warnings that was causing it to pass -Wformat-nonliteral
when the compiler doesn't support it.
Florian Hahn [Fri, 26 Aug 2022 15:29:20 +0000 (16:29 +0100)]
[LV] Add test for incorrect runtime check generation #57315.
Test for PR57315 based on a test provided by @kpdev42.
Thomas Raoux [Thu, 25 Aug 2022 19:35:26 +0000 (19:35 +0000)]
[mlir][tensor] Remove incorrect parallel_insert_slice folder
parallel_insert_slice doesn't return a value therefore we shouldn't try
to fold the result. The insert folding don't apply to this op.
The current folding would cause pattern rewrite to not be able to
converge.
Differential Revision: https://reviews.llvm.org/D132668
Aaron Ballman [Fri, 26 Aug 2022 15:17:43 +0000 (11:17 -0400)]
Fix the lldb test bots
This addresses an accidental change in behavior from
41667a8b9b624e282e7c08fadf7091223728d1c1 to get the bots back to green.
However, I think there's an issue with LLDB assuming it's valid to
enable support for keywords in language modes that don't support the
keyword (as other parts of Clang are not expecting to be able to do
that).
This should fix (and others):
https://lab.llvm.org/buildbot/#/builders/68/builds/38374
Simon Pilgrim [Fri, 26 Aug 2022 15:09:02 +0000 (16:09 +0100)]
[CostModel][X86] Convert AVX2 SRA by uniform constant to cost table
When adding cost kind support it will be easier to maintain these if we're not calculating on the fly
Simon Pilgrim [Fri, 26 Aug 2022 14:09:50 +0000 (15:09 +0100)]
[CostModel][X86] getArithmeticInstrCost - move SLM reduceVMULWidth cost handling into the generic MUL handling
This is still SLM specific atm, but converting this to more closely match the codegen from reduceVMULWidth should be straightforward
Simon Pilgrim [Fri, 26 Aug 2022 13:51:43 +0000 (14:51 +0100)]
[CostModel][X86] Convert AVX1/SSE41 SREM/SDIV by constants to cost tables
When adding cost kind support it will be easier to maintain these if we're not calculating on the fly
Paul Walker [Fri, 26 Aug 2022 13:32:46 +0000 (14:32 +0100)]
[CostModel][SVE] Correct cost model of SK_Splice shuffles for <vscale x 1 x Ty> vector types.
AArch64TTIImpl::getSpliceCost() is now used more aggressively and
LNT (MultiSource/Benchmarks/mafft) exposed a failure case for
<vscale x 1 x i1>. I've tested other element types and whilst they
can be costed they cannot be code generated, so this patch returns
InstructionCost::getInvalid() for all cases.
Florian Hahn [Fri, 26 Aug 2022 15:02:38 +0000 (16:02 +0100)]
[LV] Convert runtime diff check test to use opaque pointers.
Modernize the test to make it easier to extend with up-to-date IR.
Thomas Raoux [Thu, 25 Aug 2022 15:27:40 +0000 (15:27 +0000)]
[mlir][tensor] Remove folding of tensor.extract_slice during tiling
Blindly folding tensor.extract_slice makes the bufferization
transformation harder. This kind of transformation should happen
separatley if needed rather than doing it within makeShape that is
called during tiling.
Also removed makeComposedExtractSliceOp as it is not tested outside of
this code.
Differential Revision: https://reviews.llvm.org/D132666
Michael Liao [Fri, 26 Aug 2022 14:21:52 +0000 (10:21 -0400)]
[CSKY] Fix warnings on the use of deprecated methods. NFC.
Jean Perier [Fri, 26 Aug 2022 14:11:49 +0000 (16:11 +0200)]
[flang] Adding a guideline for flang design documentation
The goal of this document is to:
- Allow the community to contribute to flang design by defining the
expectations.
- Ensure there is a minimum of consistency between future design docs.
Differential Revision: https://reviews.llvm.org/D130166
Florian Hahn [Fri, 26 Aug 2022 14:09:46 +0000 (15:09 +0100)]
[LCSSA] Skip updating users in unreachable blocks.
Don't waste time trying to update users in unreachable blocks.
Aaron Ballman [Fri, 26 Aug 2022 14:04:06 +0000 (10:04 -0400)]
Fix the Sphinx build bot
This addresses an accidental break from
41667a8b9b624e282e7c08fadf7091223728d1c1
Benjamin Kramer [Fri, 26 Aug 2022 14:02:34 +0000 (16:02 +0200)]
[Basic] Drop header-only dependency from Basic to Lex
It's still a bit weird for IdentifierTable to depend on Lex diagnostics,
but we can get away with including the enum info that's in Basic already.
Daniil Fukalov [Wed, 17 Aug 2022 23:34:22 +0000 (02:34 +0300)]
[TTI] NFC: Reduce InstructionCost::getValue() usage...
in order to propagate `InstructionCost` value upper.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D103406
Alexey Bataev [Fri, 26 Aug 2022 13:28:38 +0000 (06:28 -0700)]
[SLP][NFC]Add a test for incorrectly calculated cost for extracted
buildvector sequence, NFC.
Simon Pilgrim [Fri, 26 Aug 2022 13:23:31 +0000 (14:23 +0100)]
[X86] Add SimplifyMultipleUseDemandedBitsForTargetNode X86ISD::ANDNP handling
See if we can remove X86ISD::ANDNP nodes by checking the state of the knownbits of the demanded elements.
This is equivalent to the generic ISD::AND handling, but flips the bits of the LHS operand to account for ANDNP.
Differential Revision: https://reviews.llvm.org/D128216
Simon Pilgrim [Fri, 26 Aug 2022 13:13:24 +0000 (14:13 +0100)]
[CostModel][X86] getArithmeticInstrCost - use cost kind specific look up tables
Building on D132216, use CostKindTblEntry cost tables to simplify the transition to supporting cost kinds other than recip-throughput
Adding full cost kinds support is going to take a while, but by converting to CostKindTblEntry first it will make it easier to support the costs on a per-ISD basis.
Pavel Labath [Wed, 24 Aug 2022 13:59:46 +0000 (15:59 +0200)]
[lldb] Make CommunicationTest compatible with windows
Our (TCP) socket support is in a much better state than pipes. Use that
for testing the Communication class.
Move the CreateTCPConnectedSockets function
(SocketTestUtilities.{h,cpp}) to a place where it can be used from
Communication tests.
Muhammad Usman Shahid [Fri, 26 Aug 2022 13:17:14 +0000 (09:17 -0400)]
Diagnosing the Future Keywords
The patch diagnoses an identifier as a future keyword if it exists in a
future language mode, such as:
int restrict;
in C modes earlier than C99. We now give a warning to the user that
such an identifier is a future keyword. Handles keywords from C as well
as C++.
Differential Revision: https://reviews.llvm.org/D131683
Adrian Vogelsgesang [Wed, 24 Aug 2022 17:27:23 +0000 (10:27 -0700)]
[Coro][Debuginfo] Add debug info to `__NoopCoro_ResumeDestroy` function
With this commit, we now attach an `DISubprogram` to the LLVM-generated
`_NoopCoro_ResumeDestroy` function. Thereby, lldb can show a
`std::coroutine_handle` to a `std::noop_coroutine` as
```
continuation = coro frame = 0x555555560d98 {
resume = 0x0000555555555c50 (a.out`__NoopCoro_ResumeDestroy)
destroy = 0x0000555555555c50 (a.out`__NoopCoro_ResumeDestroy)
}
```
instead of
```
continuation = coro frame = 0x555555560d98 {
resume = 0x0000555555555c50 (a.out`___lldb_unnamed_symbol211)
destroy = 0x0000555555555c50 (a.out`___lldb_unnamed_symbol211)
}
```
I renamed the function from `NoopCoro.ResumeDestroy` to
`_NoopCoro_ResumeDestroy` because:
* the leading `_` makes sure this is a reserved name and should not
clash with any user-provided names
* the `.` was replaced by a `_`, so the name is now a valid identifier
in C, making it allows me to type its name in the debugger
Differential Revision: https://reviews.llvm.org/D132580
Utkarsh Saxena [Fri, 26 Aug 2022 12:34:55 +0000 (14:34 +0200)]
Typo fix in Release notes.
Alexey Lapshin [Wed, 24 Aug 2022 21:36:13 +0000 (00:36 +0300)]
[dsymutil][DWARFv5] fix DW_FORM_addrx attribute offset calculation.
DWARFLinker::DIECloner::cloneAddressAttribute() contains call to
relocateIndexedAddr(StartOffset, EndOffset). StartOffset is
incorrectly calculated. Val.getRawUValue() is an index into the
.debug_addr table, so it should be multiplied
by Unit.getOrigUnit().getAddressByteSize().
Differential Revision: https://reviews.llvm.org/D132644
Benjamin Kramer [Fri, 26 Aug 2022 12:11:21 +0000 (14:11 +0200)]
[ADT] GCC 7 doesn't have constexpr char_traits, add a workaround
LLVM still supports GCC 7. This workaround can be removed when GCC 8
becomes the oldest supported GCC version.
Fixes #57057
Pavel Labath [Fri, 26 Aug 2022 12:03:27 +0000 (14:03 +0200)]
[lldb] Skip TestCoroutineHandle.py on libstdc++<11
LLVM GN Syncbot [Fri, 26 Aug 2022 11:23:06 +0000 (11:23 +0000)]
[gn build] Port
56c54cf66bcd
LLVM GN Syncbot [Fri, 26 Aug 2022 11:23:05 +0000 (11:23 +0000)]
[gn build] Port
3e39b2710168
Nico Weber [Fri, 26 Aug 2022 11:22:35 +0000 (07:22 -0400)]
[gn build] port
bb26ebb4d18c
Sam McCall [Tue, 23 Aug 2022 13:54:48 +0000 (15:54 +0200)]
[pseudo] Placeholder disambiguation strategy: always choose second
Mostly mechanics here. Interesting decisions:
- apply disambiguation in-place instead of copying the forest
debatable, but even the final tree size is significant
- split decide/apply into different functions - this allows the hard part
(decide) to be tested non-destructively and combined with HTML forest easily
- add non-const accessors to forest to enable apply
- unit tests but no lit tests: my plan is to test actual C++ disambiguation
heuristics with lit, generic disambiguation mechanics without the C++ grammar
Differential Revision: https://reviews.llvm.org/D132487
Matheus Izvekov [Fri, 26 Aug 2022 11:09:55 +0000 (13:09 +0200)]
Revert "Clang: fix AST representation of expanded template arguments."
This reverts commit
1d1a56929b725f9a79d98877f12d0a14f8418b38.
Matthias Gehre [Wed, 25 May 2022 11:19:28 +0000 (12:19 +0100)]
[llvm/CodeGen] Add ExpandLargeDivRem pass
Adds a pass ExpandLargeDivRem to expand div/rem instructions
with more than 128 bits into a loop computing that value.
As discussed on https://reviews.llvm.org/D120327, this approach has the advantage
that it is independent of the runtime library. This also helps the clang driver,
which otherwise would need to understand enough about the runtime library
to know whether to allow _BitInts with more than 128 bits.
Targets are still free to disable this pass and instead provide a faster
implementation in a runtime library.
Fixes https://github.com/llvm/llvm-project/issues/44994
Differential Revision: https://reviews.llvm.org/D126644
Felipe de Azevedo Piovezan [Tue, 23 Aug 2022 15:11:06 +0000 (11:11 -0400)]
[lldb] Fix dotest argument order
When running LLDB API tests, a user can override test arguments with
LLDB_TEST_USER_ARGS. However, these flags used to be concatenated with a
CMake-derived variable LLDB_TEST_COMMON_ARGS, as below:
```
set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}
CACHE INTERNAL STRING)
```
This is problematic, because LLDB_TEST_COMMON_ARGS must be processed
first, while LLDB_TEST_USER_ARGS args must be processed last, so that
user overrides are respected. Currently, if a user attempts to override
one of the "inferred" flags, the user's request is ignored. This is the
case, for example, with `--libcxx-include-dir` and
`--libcxx-library-dir`. Both flags are needed by the greendragon bots.
This commit removes the concatenation above, keeping the two original
variables throughout the entire flow, processing the user's flag last.
The variable LLDB_TEST_COMMON_ARGS needs to be a CACHE property, but it
is modified throughout the CMake file with `set` or `list` or `string`
commands, which don't work with properties. As such, a temporary
variable `LLDB_TEST_COMMON_ARGS_VAR` is created.
This was tested locally by invoking CMake with:
-DLLDB_TEST_USER_ARGS="--libcxx-include-dir=blah --libcxx-library-dir=blah2"
and checking that tests failed appropriately.
Differential Revision: https://reviews.llvm.org/D132642
Simon Pilgrim [Fri, 26 Aug 2022 10:47:44 +0000 (11:47 +0100)]
[DAG] Strip poison generating flags in freeze(op()) -> op(freeze()) fold
This patch follows the InstCombine approach of stripping poison generating flags (nsw/nuw from add/sub etc.) to allow us to push a freeze() through the op. Unlike InstCombine it doesn't retain any flags, but we have plenty of DAG folds that do the same thing already. We assert that the newly generated op isGuaranteedNotToBeUndefOrPoison.
Similar to the ValueTracking approach, isGuaranteedNotToBeUndefOrPoison has been updated to confirm that if an op can't create undef/poison and its operands are guaranteed not to be undef/poison - then its not undef/poison. This is just for the generic opcodes - target specific opcodes will need to do this manually just in case they have some special cases.
Differential Revision: https://reviews.llvm.org/D132333
Pavel Samolysov [Fri, 26 Aug 2022 10:21:29 +0000 (13:21 +0300)]
Revert "[Pipelines] Introduce DAE after ArgumentPromotion"
The commit breaks the compiler when a function is used as a function
parameter (hm... for a function from the standard C library?):
```
static float strtof(char *, char *) {}
void a() { strtof(a, 0); }
```
This reverts commit
879f5118fc74657e4a5c4eff6810098e1eed75ac.
Nicolas Vasilache [Fri, 26 Aug 2022 10:34:39 +0000 (03:34 -0700)]
[mlir][Vector] Support 0-D vectors in TransposeOp
Co-authored-by: Michal Terepeta <michalt@google.com>
Reviewed-by: ftynse
Differential Revision: https://reviews.llvm.org/D115743
Simon Pilgrim [Fri, 26 Aug 2022 10:16:57 +0000 (11:16 +0100)]
[CostModel][X86] getTypeBasedIntrinsicInstrCost - adjustTableCost - split CostTblEntry into ISD/Cost pair. NFC
This will be necessary to allow us to reuse this for other cost kind types
Paul Walker [Fri, 19 Aug 2022 17:51:02 +0000 (18:51 +0100)]
[SVE] Lower fixed-length floating point loads and stores to integer variants.
There's no advatange to emitting floating point scalable accesses,
whereas by lowering them to integer variants we can benefit from
several combines that seek to replace explicit extends/truncates
with extending/truncating accesses.
Differential Revision: https://reviews.llvm.org/D132393
Daniil Dudkin [Fri, 26 Aug 2022 10:00:06 +0000 (13:00 +0300)]
[flang] Remove obsolete TODO
As the comment tells, the TODO was added because
there was no conversion for abstract results in function types inside GlobalOps.
Since the conversion was added, this TODO is obsolete, so it is removed.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D130369
Florian Hahn [Fri, 26 Aug 2022 10:00:08 +0000 (11:00 +0100)]
[LAA] Rename printing pass to print<access-info>.
This updates the naming for the LAA printing pass to be in line with
most other analysis printing passes.
The old name has come up as confusing multiple times already, e.g. in
D131924.
Matthias Gehre [Wed, 25 May 2022 15:00:54 +0000 (16:00 +0100)]
Revert "[SelectionDAG] Emit calls to __divei4 and friends for division/remainder of large integers"
This reverts https://reviews.llvm.org/D120329.
I abandoned the PR [0] to add __divei4 functions to compiler-rt
in favor of adding a pass to transform div/rem [1].
This removes the backend code that was supposed to emit calls to the __divei4 functions.
[0] https://reviews.llvm.org/D120327
[1] https://reviews.llvm.org/D130076
Differential Revision: https://reviews.llvm.org/D130079
WANG Xuerui [Fri, 26 Aug 2022 04:12:26 +0000 (12:12 +0800)]
[LoongArch] Port over minimal applyFixup from RISCV
Many DebugInfo tests now pass with native builds.
Differential Revision: https://reviews.llvm.org/D132323
Alex Richardson [Thu, 25 Aug 2022 12:34:12 +0000 (12:34 +0000)]
[ARM] Use getSymbolPreferLocal() in GetARMGVSymbol
This allows relaxing some relocations to symbol+offset instead of emitting
a relocation against a symbol.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D131433
Alex Richardson [Thu, 25 Aug 2022 12:15:47 +0000 (12:15 +0000)]
Mark the $local function begin symbol as a function
While this does not matter for most targets, when building for Arm Morello,
we have to mark the symbol as a function and add size information, so that
LLD can correctly evaluate relocations against the local symbol.
Since Morello is an out-of-tree target, I tried to reproduce this with
in-tree backends and with the previous reviews applied this results in
a noticeable difference when targeting Thumb.
Background: Morello uses a method similar Thumb where the encoding mode is
specified in the LSB of the symbol. If we don't mark the target as a
function, the relocation will not have the LSB set and calls will end up
using the wrong encoding mode (which will almost certainly crash).
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D131429
Michael Buch [Fri, 26 Aug 2022 09:28:28 +0000 (10:28 +0100)]
[lldb][Test] Add missing breakpoint in TestNamespaceLookup.py
Michael Buch [Thu, 25 Aug 2022 22:41:47 +0000 (23:41 +0100)]
[lldb][ClangExpression] Fix LLDB_LOG incorrect format specifier
Previously this would log:
```
FindExternalLexicalDecls on (ASTContext*)0x00000005CE825200 'Expression
ASTContext for '<user expression 0>'' in 'weak_ptr'
(%sDecl*)ClassTemplateSpecialization
FindExternalLexicalDecls on (ASTContext*)0x00000005CE825200 'Expression
ASTContext for '<user expression 0>'' in '__shared_count'
(%sDecl*)CXXRecord
```
Note that the `%s` isn't actually respected. This patch fixes this
by providing the format specifiers that `lldb::formatv` supports.
Differential Revision: https://reviews.llvm.org/D132709
Nicolai Hähnle [Fri, 26 Aug 2022 09:02:00 +0000 (11:02 +0200)]
Revert "ManagedStatic: remove from DebugCounter"
This reverts commit
b5b6ef1500af29b6aba71330d8aaf82ecccb1f37.
Utkarsh Saxena [Thu, 25 Aug 2022 14:05:50 +0000 (16:05 +0200)]
PotentiallyEvaluatedContext in a ImmediateFunctionContext.
Body of `consteval` should be in an `ImmediateFunctionContext` instead of `ConstantEvaluated`.
PotentiallyEvaluated expressions in Immediate functions are in a `ImmediateFunctionContext` as well.
Fixes https://github.com/llvm/llvm-project/issues/51182
Original divergence: https://godbolt.org/z/vadGT5j6f
Differential Revision: https://reviews.llvm.org/D132659