Nikita Popov [Tue, 18 Apr 2023 16:22:37 +0000 (18:22 +0200)]
[GlobalOpt] Don't evaluate large memset (PR62191)
If the memset is large, checking every single byte of the global
may be very slow. Add an upper bound on the size of memset we
handle.
For the common special case of memset zeroinitializer to zero,
add a fastpath that checks just that and is not length limited.
Fixes https://github.com/llvm/llvm-project/issues/62191.
Siva Chandra Reddy [Tue, 18 Apr 2023 08:09:18 +0000 (08:09 +0000)]
[libc][NFC] Move ExecuteFunction test util to test/UnitTest.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D148611
Slava Zakharin [Tue, 18 Apr 2023 00:06:14 +0000 (17:06 -0700)]
[flang] Fixed substr access in embox/rebox CodeGen.
The code was using the original operand of the operation, while
it should have been using the remapped operands via the adaptor.
Differential Revision: https://reviews.llvm.org/D148587
Guillaume Chatelet [Tue, 18 Apr 2023 15:24:24 +0000 (15:24 +0000)]
Revert "[libc] handle memset sequence as a separate struct"
This patch broke the build bots.
This reverts commit
6fdc244e9f13d2ce20a26d05513f22a1e099f90a.
Guillaume Chatelet [Tue, 18 Apr 2023 15:16:20 +0000 (15:16 +0000)]
[libc] handle memset sequence as a separate struct
These sequence of calls don't really make sense for head_tail and loop_and_tail.
Simon Pilgrim [Tue, 18 Apr 2023 15:04:59 +0000 (16:04 +0100)]
[CostModel][X86] Add BSWAP cost model estimations
Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates
Alex Brachet [Tue, 18 Apr 2023 15:02:23 +0000 (15:02 +0000)]
[clang-scan-deps] Add clang-scan-deps to llvm-driver build
Differential Revision: https://reviews.llvm.org/D148583
Ivan Kosarev [Tue, 18 Apr 2023 14:26:09 +0000 (15:26 +0100)]
[AMDGPU][AsmParser] Refine parsing SDWA operands.
Removes the need for the custom code in parseCustomOperand().
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D147241
Vassil Vassilev [Tue, 18 Apr 2023 13:40:52 +0000 (13:40 +0000)]
Revert "[clang-repl] Enable debugging of JIT-ed code."
This reverts commit
1e4891e681c51f3e2a724b4ac4e42380ec4a9be1.
Some bots complain about undefined llvm_orc_registerJITLoaderGDBAllocAction.
Guillaume Chatelet [Tue, 18 Apr 2023 13:35:18 +0000 (13:35 +0000)]
[libc] Add debug messages to bcmp and memcmp tests
Vassil Vassilev [Sun, 16 Apr 2023 20:43:29 +0000 (20:43 +0000)]
[clang-repl] Enable debugging of JIT-ed code.
This change follows llvm/llvm-project@21b5ebd and makes use of the jitlink
infrastructure. In order to use this feature inside lldb one needs to run the
lldb command: settings set plugin.jit-loader.gdb.enable on
This works currently only on Darwin since jitlink is not a default ELF/x86-64
backend yet.
Differential revision: https://reviews.llvm.org/D148481
Nikita Popov [Tue, 18 Apr 2023 13:14:59 +0000 (15:14 +0200)]
[SCEV] Add additional tests for addrec nowrap flags (NFC)
Jay Foad [Tue, 18 Apr 2023 13:12:14 +0000 (14:12 +0100)]
[MC] Simplify uses of subregs/superregs. NFC.
Guillaume Chatelet [Tue, 18 Apr 2023 13:10:51 +0000 (13:10 +0000)]
[libc] Add AVX detectionwq
Max Kazantsev [Tue, 18 Apr 2023 13:06:46 +0000 (20:06 +0700)]
[Test] Add IRCE tests with non-canonical range check
Patch by Aleksandr Popov!
Differential Revision: https://reviews.llvm.org/D148224
Felipe de Azevedo Piovezan [Mon, 17 Apr 2023 21:17:04 +0000 (17:17 -0400)]
[coro][nfc] Use Load/Store instruction APIs
Instead of hard-coding operand indices, it is cleaner to use the APIs
provided by the Load/Store Inst classes.
Differential Revision: https://reviews.llvm.org/D148571
Igor Kirillov [Mon, 27 Mar 2023 16:32:40 +0000 (16:32 +0000)]
[CodeGen] Enable processing of interconnected complex number operations
With this patch, ComplexDeinterleavingPass now has the ability to handle
any number of interconnected operations involving complex numbers.
For example, the patch enables the processing of code like the following:
for (int i = 0; i < 1000; ++i) {
a[i] = w[i] * v[i];
b[i] = w[i] * u[i];
}
This code has multiple arrays containing complex numbers and a common
subexpression `w` that appears in two expressions.
Differential Revision: https://reviews.llvm.org/D146988
Max Kazantsev [Tue, 18 Apr 2023 12:35:49 +0000 (19:35 +0700)]
[BPI] Add method to swap outgoing edges probabilities
The motivation is need to update branch probability info after
swapping successors of branch instruction.
Differential Revision: https://reviews.llvm.org/D148237
Reviewed By: nikic
Jay Foad [Tue, 18 Apr 2023 12:58:35 +0000 (13:58 +0100)]
[MC] Fix M68k build after D148613
Alexey Bataev [Thu, 13 Apr 2023 18:28:54 +0000 (11:28 -0700)]
[SLP]Add final resize to ShuffleCostEstimator::finalize member function and basic add member functions.
Implemented the reshuffling in finalize member function + add basic
support for add member functions, used during vector build.
Part of D110978
Differential Revision: https://reviews.llvm.org/D148279
Zain Jaffal [Tue, 18 Apr 2023 12:48:41 +0000 (13:48 +0100)]
[llvm-remarkutil] Add an option to display DebugLoc when collecting counts for remarks.
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D148374
David Stuttard [Tue, 18 Apr 2023 10:38:49 +0000 (11:38 +0100)]
[AMDGPU] Remove unnecessary assert
Also remove the function attributes from the test. For PAL based shaders this isn't required.
Differential Revision: https://reviews.llvm.org/D148625
Max Kazantsev [Tue, 18 Apr 2023 12:31:08 +0000 (19:31 +0700)]
[BPI][Test] Check the probabilities after swapping branch successors
Patch by Aleksandr Popov!
Differential Revision: https://reviews.llvm.org/D148616
Nico Weber [Tue, 18 Apr 2023 12:29:50 +0000 (08:29 -0400)]
[gn] port
1ae57fed880688 and fix mistake from
1203a24764bfa
Jay Foad [Mon, 17 Apr 2023 20:09:19 +0000 (21:09 +0100)]
[MC] Use subregs/superregs instead of MCSubRegIterator/MCSuperRegIterator. NFC.
Differential Revision: https://reviews.llvm.org/D148613
pvanhout [Mon, 17 Apr 2023 13:26:24 +0000 (15:26 +0200)]
[AMDGPU] Refactor PromoteAlloca implementation
We're getting a lot of mileage out of PromoteAlloca, and the pass had grown somewhat organically over the year.
This patch attempts to clean up the implementation and restructure it. For instance,
the exact same code path is now used for both promote alloca to LDS and
promote alloca to vector - just with different parameters.
This removes some redundancy here and there.
I also reordered functions in a way that hopefully makes more sense (e.g. all of the pass API is in the same place)
No functionality change is intended in the patch, but some checks were movved around so I'm not using the NFC tag.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D148526
OCHyams [Tue, 18 Apr 2023 11:41:37 +0000 (12:41 +0100)]
[Assignment Tracking][SelectionDAG] Downgrade dbg.assigns to dbg.values if assignment tracking is not enabled
We shouldn't be able to reach this code path from source code but this provides
a better fail-safe than asserting. The result of the downgrade is a degraded
debugging experience, but it is better than nothing.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D148212
Louis Dionne [Sat, 15 Apr 2023 23:36:23 +0000 (00:36 +0100)]
[libunwind] Remove the legacy Unwind_AppleExtras.cpp
Unwind_AppleExtras.cpp contained annotations telling the linker that
some symbols are not available on some very old platforms. However,
those platforms are not supported anymore, so the annotations are not
used.
Why remove this? In addition to cleaning up the code base, this also
removes the possibility of implementing those annotations incorrectly
(which was the case previously), which could lead to important symbols
being hidden when they should have been visible.
Differential Revision: https://reviews.llvm.org/D148445
Nicolas Vasilache [Tue, 18 Apr 2023 11:28:45 +0000 (04:28 -0700)]
[mlir][NVGPU] Support cache all (.ca) in nvgpu.device_async_copy
This patch adds support for cache all (.ca) in conversion from nvgpu-to-nvvm for inline asm `cp.async`.
For sizes other than 16 bytes cp.async cache global is not allowed and cache all is required to generate a valid ptx.
Differential revision: https://reviews.llvm.org/D148604
Authored-by: Manish Gupta <manigupta@google.com>
Nicolas Vasilache [Tue, 18 Apr 2023 09:45:35 +0000 (02:45 -0700)]
[mlir][Linalg] NFC - Add builder for MatchOp
Nicolas Vasilache [Mon, 17 Apr 2023 14:36:52 +0000 (07:36 -0700)]
[mlir][Linalg] NFC - Pass TrackingListeners to all transforms
This commit properly passes tracking listeners to all Linalg transform operations.
It has no visible API or behavioral change but it helps downstream clients make better use of tracking facilities.
Nicolas Vasilache [Mon, 17 Apr 2023 14:16:04 +0000 (07:16 -0700)]
[mlir][Linalg] NFC - Add builder for TileToScfForOp
pvanhout [Mon, 17 Apr 2023 12:19:11 +0000 (14:19 +0200)]
[AMDGPU] Do not crash on agpr_hi16 in AMDGPUResourceUsageAnalysis
Reviewed By: #amdgpu, arsenm
Differential Revision: https://reviews.llvm.org/D148438
Akshay Khadse [Tue, 18 Apr 2023 11:07:28 +0000 (19:07 +0800)]
Fix uninitialized pointer members
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D148495
Kiran Chandramohan [Tue, 18 Apr 2023 11:08:16 +0000 (11:08 +0000)]
Revert "[Flang] Change fir.divc to perform library call rather than generate inline operations."
This reverts commit
a7bb8e273f433cceeb547e87d04114178573496a.
Revertin since this runs into an ABI issue.
Jay Foad [Mon, 17 Apr 2023 14:44:07 +0000 (15:44 +0100)]
[X86] Fix checks for illegal physreg COPY instructions
D105263 changed this test to not expect a MachineVerifier error on this
instruction:
; FP16 reg is sub_reg of xmm
%0:_(s16) = COPY $xmm0
D107082 changed the behaviour back again so that this instruction did
cause an error, but the test was not updated to expect the error.
Differential Revision: https://reviews.llvm.org/D148534
Akshay Khadse [Tue, 18 Apr 2023 09:47:00 +0000 (17:47 +0800)]
Fix uninitialized pointer members in TableGen
Fixes static code analysis errors
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D148464
Ilya Biryukov [Mon, 17 Apr 2023 11:50:59 +0000 (13:50 +0200)]
Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter
Fixes #61065.
This reverts commit
363c98b2d67986b9766bb1426739970ce6d9a6f3 and relands
db987b9589be1eb604fcb74c85b410469e31485f with fixes from
bc95f27337c7ed77c28e713c855272848f01802a.
The module-related issues surfaced there are fixed in the
previous commit.
Ilya Biryukov [Mon, 17 Apr 2023 12:02:48 +0000 (14:02 +0200)]
[Modules] Do not rewrite existing decls when deserializing class fields
Classes can have implicit members that were added before fields were
deserialized. These members were previously silently removed from
`decls()` when fields were deserialized after them.
This was the root cause of a compilation error exposed in
bc95f27337c7ed77c28e713c855272848f01802a, added a test for it.
Reviewed By: ChuanqiXu
Differential Revision: https://reviews.llvm.org/D148515
Nikita Popov [Tue, 18 Apr 2023 10:36:51 +0000 (12:36 +0200)]
[ValueTracking] Use SmallPtrSetImpl (NFC)
Don't hardcode set size in function signature.
Simon Pilgrim [Mon, 17 Apr 2023 22:05:07 +0000 (23:05 +0100)]
[CostModel][X86] Add more thorough BSWAP test coverage
Replace the existing tests with more complete coverage for all cost model kinds
Simon Pilgrim [Mon, 17 Apr 2023 21:23:29 +0000 (22:23 +0100)]
[CostModel][X86] Add BITREVERSE cost model estimations
Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates
Nikita Popov [Tue, 11 Apr 2023 08:46:20 +0000 (10:46 +0200)]
[InstCombine] Don't reassociate GEPs for loop invariance
Since D146813, LICM will reassociate GEPs to expose hoisting
opportunities itself. Don't perform this transform in InstCombine,
where it is fragile because it depends on an optional LoopInfo
analysis.
Stoorx [Tue, 18 Apr 2023 09:54:40 +0000 (09:54 +0000)]
[clang] Return std::unique_ptr<TargetInfo> from AllocateTarget
In file 'clang/lib/Basic/Targets.cpp' the function 'AllocateTarget' had a raw pointer as a return type, which have been wrapped in the 'std::unique_ptr' in all usages.
This commit changes the signature of the function to return an instance of 'std::unique_ptr' directly.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D148574
Victor Perez [Fri, 14 Apr 2023 08:54:38 +0000 (09:54 +0100)]
[mlir][llvm] Handle invoke op branching to block with its result as an argument
In LLVM, having an invoke instruction branching to a block with a phi
node receiving the invoke instruction result as an argument is
perfectly legal. However, the translation of this construct to MLIR
would result in an invoke with its result being used as a block
argument to a successor, i.e., the operation result would be used in
its definition.
In order to fix this issue due to different IR structures (phi nodes
vs block arguments), this construct is interpreted with an llvm.invoke
operation branching to a dummy block having a single llvm.br operation
passing the required block arguments (including the result of the
llvm.invoke operation) to the actual successor block.
Differential Revision: https://reviews.llvm.org/D148313
Nikita Popov [Tue, 18 Apr 2023 09:52:12 +0000 (11:52 +0200)]
[LV] Regenerate test checks (NFC)
Akshay Khadse [Tue, 18 Apr 2023 09:32:18 +0000 (17:32 +0800)]
Fix uninitialized pointer members in MC
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D148421
Bjorn Pettersson [Fri, 14 Apr 2023 21:41:07 +0000 (23:41 +0200)]
[llvm-opt-fuzzer] Skip creating/initializing legacy PM passes
Afaict llvm-opt-fuzzer is using the new pass manager. So there
shouldn't be a need to create/initialize/register the legacy PM
version of passes.
Differential Revision: https://reviews.llvm.org/D148512
Florian Hahn [Tue, 18 Apr 2023 09:29:17 +0000 (10:29 +0100)]
Recommit "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."
This reverts the revert commit
8c2276f89887d0a27298a1bbbd2181fa54bbb509.
The updated patch re-orders the getDefiningRecipe check in getVPalue to avoid
a use-after-free.
Original commit message:
Before this patch, a VPlan contained 2 mappings for Values -> VPValue:
1) Value2VPValue and 2) VPExternalDefs.
This duplication is unnecessary and there are already cases where
external defs are added to Value2VPValue. This patch replaces all uses
of VPExternalDefs with Value2VPValue.
It clarifies the naming of getOrAddVPValue (to getOrAddExternalVPValue)
and addVPValue (to addExternalVPValue).
At the moment, this is NFC, but will enable additional simplifications
in D147783.
Depends on D147891.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D147892
Graham Hunter [Tue, 18 Apr 2023 08:59:15 +0000 (09:59 +0100)]
[LV][AArch64] Autogenerate checks for scalable-strict-fadd.ll (NFC)
Precommit for D145163.
mydeveloperday [Tue, 18 Apr 2023 09:17:28 +0000 (10:17 +0100)]
[clang-format] C# short ternary operator misinterpreted as a CSharpNullable
Refactor the CSharpNullable assignment code to be a little easier to read (Honestly I don't like it when an if expression get really long and complicated).
Handle the case where '?' is actually a ternary operator.
Fixes: #58067
Reviewed By: owenpan, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D148473
Mats Petersson [Fri, 16 Dec 2022 18:52:28 +0000 (18:52 +0000)]
Add loop-versioning pass to improve unit-stride
Introduce conditional code to identify stride of "one element", and simplify the array accesses for that case.
This allows better loop performance in various benchmarks.
Reviewed By: tblah, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D141306
Alex Bradbury [Tue, 18 Apr 2023 08:50:53 +0000 (09:50 +0100)]
[RISCV][NFC] Fix comment in RISCVISAInfo after
f98ca363bed
My fault for missing this in initial review -
f98ca363bed7405a23ad4b77167e39505a1ca9dd didn't properly update the
comment to reflect the change.
Mats Petersson [Mon, 9 Jan 2023 15:30:29 +0000 (15:30 +0000)]
Add -f[no-]loop-versioning option
Add flags for loop-versioning pass enable/disable
Reviewed By: awarzynski, tblah
Differential Revision: https://reviews.llvm.org/D141307
Serguei Katkov [Tue, 18 Apr 2023 07:55:31 +0000 (14:55 +0700)]
[MachineCSE] Add a test with mutiple blocks between instructions.
Due to limitation that we consider only one alone predecessor
we cannot generate the code like
ucomiss
jp
ja
jne
Matthias Springer [Tue, 18 Apr 2023 08:29:19 +0000 (17:29 +0900)]
[mlir][Arith] Fix Windows build
Alex Bradbury [Tue, 18 Apr 2023 08:20:36 +0000 (09:20 +0100)]
[RISCV][test] Add test for RISCVISAInfo::OrderedExtensionMap ordering
David Spickett [Mon, 17 Apr 2023 13:08:04 +0000 (13:08 +0000)]
[llvm] Remove llvm-compilers-check script
I do not know of anyone currently using this and could not
find any uses over in llvm-zorg.
Differential Revision: https://reviews.llvm.org/D148522
Craig Topper [Tue, 18 Apr 2023 08:19:29 +0000 (01:19 -0700)]
[TableGen] Const-correct TreePatternNode::getChild. NFC
Make the const version return a const TreePatterNode* and add a non-const
version to return a non-const TreePatternNode*.
Jun Sha (Joshua) [Tue, 18 Apr 2023 08:20:08 +0000 (16:20 +0800)]
[RISCV] Modify arch string parsing order according to latest riscv spec
According to latest risc-v spec, the canonical order in which extension names must appear in the name string specified in Table 29.1 is different from before. In the latest table, non-standard extensions must be listed after all standard extensions. To keep consistent, we now change the parsing order in parseArchString().
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D148315
David Spickett [Tue, 18 Apr 2023 08:15:50 +0000 (08:15 +0000)]
[lldb] Use llvm::byteswap in DumpRegisterValue
7978abd5aef1ba84d7a1cefbc3443245acff2c48 fixed a build issue
on MSVC with some code I previously added, by adding some
ifdefs.
Now I realise that I should have been using llvm::byteswap
in the first place, which does exactly that.
Stephan Herhut [Mon, 17 Apr 2023 16:29:27 +0000 (18:29 +0200)]
[mlir][llvm] Fix for MemRefBuilder when using opaque pointers.
Loading the offset of an unranked memref descriptor is creating an invalid load.
Differential Revision: https://reviews.llvm.org/D148540
Kadir Cetinkaya [Mon, 17 Apr 2023 18:25:25 +0000 (20:25 +0200)]
[include-cleaner] Unify behaviour for static & instance members
Fixes https://github.com/llvm/llvm-project/issues/62185
Differential Revision: https://reviews.llvm.org/D148552
Matthias Springer [Tue, 18 Apr 2023 07:44:44 +0000 (16:44 +0900)]
[mlir][Arith] ValueBoundsOpInterface: Reify with Arith ops
This revision adds an additional `reifyValueBounds` helper that reifies the IR with Arith ops instead of Affine ops. This is needed to support value bounds for integer types different from `index` in a subsequent revision.
Differential Revision: https://reviews.llvm.org/D146524
Kriti Gupta [Tue, 18 Apr 2023 07:46:54 +0000 (08:46 +0100)]
[test] Remove occurences of br undef in CodeGen/AMDGPU tests
Differential Revision: https://reviews.llvm.org/D148041
OCHyams [Tue, 18 Apr 2023 07:11:31 +0000 (08:11 +0100)]
[Assignment Tracking] Skip empty-metadata dbg.declares in AssignmentTrackingPass
Debug intrinsics sometimes end up with empty metadata location operands. The
debug intrinsic interfaces return nullptr when retrieving location operand in
this case.
Skip empty-metadata dbg.declares to avoid dereferencing the nullptr. This
doesn't affect the final debug info in any way.
Reviewed By: jryans
Differential Revision: https://reviews.llvm.org/D148204
OCHyams [Tue, 18 Apr 2023 07:05:12 +0000 (08:05 +0100)]
[Assignment Tracking][SelectionDAG] Fix dbg.declare location nullptr deref
Debug intrinsics sometimes end up with empty metadata location operands. The
debug intrinsic interfaces return nullptr when retrieving location operand in
this case.
When assignment tracking is not enabled a dbg.declare with a nullptr location
operand is skipped. Do the same when assignment tracking is enabled (a nullptr
address component of a dbg.assign is already handled correctly.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D148203
Matthias Springer [Tue, 18 Apr 2023 07:27:02 +0000 (16:27 +0900)]
[mlir][affine][NFC] Split `reifyValueBound` in two functions
There are now two entry points. One for shaped values and one for index-typed values. This addresses a comment in D146524.
Differential Revision: https://reviews.llvm.org/D147987
Craig Topper [Tue, 18 Apr 2023 07:16:36 +0000 (00:16 -0700)]
[TableGen] Call std::vector::reserve to preallocate memory before a loop of push_back. NFC
Wang, Xin10 [Tue, 18 Apr 2023 06:49:18 +0000 (02:49 -0400)]
Add assert to avoid unexpected situation
In line 68, func getBlockFreqRelativeToEntryBlock assume getEntryFreq() is
non-zero, but the function could return 0, add assert to confirm it.
Reviewed By: HaohaiWen
Differential Revision: https://reviews.llvm.org/D148606
Martin Braenne [Tue, 18 Apr 2023 04:49:38 +0000 (04:49 +0000)]
[clang][dataflow] Associate `FunctionToPointerDecay` nodes with a value.
To ensure that we have a pointee for the `PointerValue`, we also create
storage locations for `FunctionDecl`s referenced in the function under analysis.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D148006
Noah Goldstein [Tue, 18 Apr 2023 06:23:40 +0000 (01:23 -0500)]
Revert "[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`"
May be related to PR62175
This reverts commit
a3fd060d4223c6a7470554561bc479d4b8e423f4.
Noah Goldstein [Tue, 18 Apr 2023 06:23:08 +0000 (01:23 -0500)]
Revert "[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and vice-versa"
May be related to PR62175
This reverts commit
57590d1dd47bbe9aa4b79a0f93cc3ec62cc5d060.
Max Kazantsev [Tue, 18 Apr 2023 06:17:45 +0000 (13:17 +0700)]
[Test] Add test showing that we can infer nsw
Martin Braenne [Tue, 18 Apr 2023 03:42:24 +0000 (03:42 +0000)]
[clang][dataflow] Add support for new expressions.
Reviewed By: xazax.hun, gribozavr2
Differential Revision: https://reviews.llvm.org/D147698
Noah Goldstein [Tue, 18 Apr 2023 00:49:27 +0000 (19:49 -0500)]
[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`
If Y is non-zero we can simplify the ge/le -> gt/lt
`(X ^ Y_NonZero) u>= X` --> `(X ^ Y_NonZero) u> X`
- https://alive2.llvm.org/ce/z/k482NQ
`(X ^ Y_NonZero) u<= X` --> `(X ^ Y_NonZero) u< X`
- https://alive2.llvm.org/ce/z/TuUDGy
`(X ^ Y_NonZero) s>= X` --> `(X ^ Y_NonZero) s> X`
- https://alive2.llvm.org/ce/z/vXQypR
`(X ^ Y_NonZero) s<= X` --> `(X ^ Y_NonZero) s< X `
- https://alive2.llvm.org/ce/z/fbUq-z
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D144608
Noah Goldstein [Thu, 23 Feb 2023 00:37:46 +0000 (18:37 -0600)]
[InstCombine] Add tests for transforming `(icmp (xor X, Y), X)`; NFC
Differential Revision: https://reviews.llvm.org/D144607
Noah Goldstein [Tue, 18 Apr 2023 00:49:36 +0000 (19:49 -0500)]
[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and vice-versa
For all shifts we can apply the same two optimizations.
1) `ShiftOp(KnownVal.One, Max(KnownCnt)) != 0`
-> result is non-zero
2) If already known `Val != 0` and we only shift out zeros (based
on `Max(KnownCnt)`)
-> result is non-zero
The former exists for `shl` and the latter (for constant `Cnt`) exists
for `ashr`/`lshr`.
This patch improves the latter to use `Max(KnownCnt)` instead of
relying on a constant shift `Cnt` and applies both techniques for all
shift ops.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D148404
Noah Goldstein [Fri, 14 Apr 2023 23:42:32 +0000 (18:42 -0500)]
[ValueTracking] Add more tests for `isKnownNonZero(Shift)`; NFC
Differential Revision: https://reviews.llvm.org/D148403
Craig Topper [Tue, 18 Apr 2023 03:26:47 +0000 (20:26 -0700)]
[TableGen] clang-format some recent changes. NFC
Vitaly Buka [Sat, 15 Apr 2023 05:50:28 +0000 (22:50 -0700)]
[NFC][lsan] Use LowLevelAllocator to allocate ThreadContext
This is more RAM and CPU efficient than allocating entire page per
context, and this approach is used by other sanitizers already.
With the patch "create_thread_loop2.cpp.tmp 5000" is 30% faster.
Manna, Soumi [Tue, 18 Apr 2023 02:21:03 +0000 (22:21 -0400)]
[NFC][Clang] Fix static analyzer tool remark about missing user-defined assignment operator
Reported by Coverity:
Copy without assign
This class has a user-defined copy constructor but no user-defined assignment operator. If the copy constructor is necessary to manage owned resources then a corresponding assignment operator is usually required. If an object of this type is assigned memory leaks and/or use-after-free errors may occur. Note that a compiler-generated assignment operator will perform only a bit-wise copy for any fields that do not have their own assignment operators defined.
Class has user-written copy constructor but no user-written assignment operator
copy_without_assign: Class <unnamed>::DeclUseTracker has a user-written copy constructor <unnamed>::DeclUseTracker::DeclUseTracker(<unnamed>::DeclUseTracker const &) =delete but no corresponding user-written assignment operator.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D148189
Wang, Xin10 [Tue, 18 Apr 2023 01:50:10 +0000 (21:50 -0400)]
remove useless condition in assert in SelectionDAG.cpp
The condition Opcode <= std::numeric_limits<int>::max() will
always be true here.
Reviewed By: skan
Differential Revision: https://reviews.llvm.org/D148306
Dave Lee [Tue, 18 Apr 2023 00:14:55 +0000 (17:14 -0700)]
[lldb] Add more asserts to TestExec
If this test fails, the error message isn't helpful:
```
self.assertEqual(len(threads), 1,
AssertionError: 0 != 1 : Stopped at breakpoint in exec'ed process
```
This change adds asserts to verify that:
1. The process is stopped
2. For each thread, that the stop reason is None, or Breakpoint
The latter will indicate if execution has stopped for some other reason, and if so what
that reason is.
Differential Revision: https://reviews.llvm.org/D148588
Michał Górny [Mon, 17 Apr 2023 05:54:57 +0000 (07:54 +0200)]
[compiler-rt] [test] Mark dfsan tests XFAIL on glibc-2.37
Mark the two dfsan tests that are known to be broken on glibc-2.37
as XFAIL, to make the test suite start passing on Gentoo again.
Bug: https://github.com/llvm/llvm-project/issues/60678
Differential Revision: https://reviews.llvm.org/D148496
Manna, Soumi [Tue, 18 Apr 2023 00:50:41 +0000 (20:50 -0400)]
[NFC][clang] Fix coverity static analyzer concerns about AUTO_CAUSES_COPY
Reported by Coverity:
AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.
1. [NFC] Fix auto keyword use without an & causes the copy of an object of type SimpleRegistryEntry in clang::getAttributePluginInstances()
2. [NFC] Fix auto keyword use without an & causes the copy of an object of type tuple in CheckStmtInlineAttr<clang::NoInlineAttr, 2>(clang::Sema &, clang::Stmt const *, clang::Stmt const *, clang::AttributeCommonInfo const &)
3. [NFC] Fix auto keyword use without an & causes the copy of an object of type QualType in <unnamed>::SystemZTargetCodeGenInfo::isVectorTypeBased(clang::Type const *, bool)
4. [NFC] Fix auto keyword use without an & causes the copy of an object of type Policy in <unnamed>::RISCVIntrinsicManagerImpl::InitIntrinsicList()
5. [NFC] Fix auto keyword use without an & causes the copy of an object of type pair in checkUndefinedButUsed(clang::Sema &)
Reviewed By: tahonermann
Differential Revision: <https://reviews.llvm.org/D147543>
Slava Zakharin [Sun, 16 Apr 2023 20:21:25 +0000 (13:21 -0700)]
[flang] Added missing _Complex for COMPLEX(10) C reduction API.
I noticed _Complex was missing for the long double case.
I might be missing something, but it looks like the compiler
does not call the C wrappers directly. Do we need to keep
the complex-reduction.[ch] at all?
Differential Revision: https://reviews.llvm.org/D148479
Johannes Doerfert [Tue, 18 Apr 2023 00:57:12 +0000 (17:57 -0700)]
[Attributor][FIX] Ensure to cache all intra procedural AA queries
We failed to cache queries without an exclusion set that resulted in
non-reachable results. That is obviously bad as changes to liveness can
influence the result.
Fixes: https://github.com/llvm/llvm-project/issues/61883
max [Tue, 18 Apr 2023 00:59:08 +0000 (19:59 -0500)]
[MLIR] Patch StandalonePlugin CMake for MacOS
Differential Revision: https://reviews.llvm.org/D148058
Alexander Yermolovich [Tue, 18 Apr 2023 00:48:54 +0000 (17:48 -0700)]
[BOLT][DWARF] Fix handling of CUs without TU reference
When input is DWP with DWARF5 bolt wasn't handling correctly CUs that didn't
have TU references. Which resulted in a crash.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D148589
Noah Goldstein [Tue, 18 Apr 2023 00:49:55 +0000 (19:49 -0500)]
[X86] Fix whitespace issue in CombineSetCC; NFC
Differential Revision: https://reviews.llvm.org/D148595
Vitaly Buka [Tue, 18 Apr 2023 00:37:11 +0000 (17:37 -0700)]
Revert "[sanitizer] Try to fix windows bot"
Not needed.
This reverts commit
e864e6f234b24ae2e05dcc1ea9a516859db9c9b5.
Vitaly Buka [Tue, 18 Apr 2023 00:35:52 +0000 (17:35 -0700)]
[sanitizer] Fix Windows build
Vitaly Buka [Tue, 18 Apr 2023 00:27:45 +0000 (17:27 -0700)]
[sanitizer] Try to fix windows bot
https://lab.llvm.org/buildbot/#/builders/127/builds/46887/steps/4/logs/stdio
Alex Langford [Mon, 17 Apr 2023 23:11:07 +0000 (16:11 -0700)]
[lldb] Change parameter type of StructuredData::ParseJSON
Instead of taking a `const std::string &` we can take an
`llvm::StringRef`. The motivation for this change is that many of the
callers of `ParseJSON` end up creating a temporary `std::string` from an existing
`StringRef` or `const char *` in order to satisfy the API. There's no
reason we need to do this.
Differential Revision: https://reviews.llvm.org/D148579
Vitaly Buka [Tue, 18 Apr 2023 00:19:57 +0000 (17:19 -0700)]
Revert "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."
Asan detects heap-use-after-free, see D147892.
This reverts commit
4fc190351e5af901b6107d162d07e1fbca90934f.
This reverts commit
668045eb77628be13e448ffbb855473ffca1cc43.
Prem Chintalapudi [Tue, 18 Apr 2023 00:14:30 +0000 (17:14 -0700)]
Expose PassBuilder extension point callbacks
This patch allows access to callbacks registered by TargetMachines to allow custom pipelines to run those callbacks.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D148561
Vitaly Buka [Tue, 18 Apr 2023 00:08:11 +0000 (17:08 -0700)]
[NFC][sanitizer] Clang-format some includes
Jorge Gorbe Moya [Mon, 17 Apr 2023 23:35:21 +0000 (16:35 -0700)]
[lldb] Build libcxx unique_ptr and shared_ptr test programs with -glldb.
The functionality added by https://reviews.llvm.org/D145803 is gated by
lldb tuning, so we need to build the test programs with `-glldb` to make
these tests print the expected preferred name.
Differential Revision: https://reviews.llvm.org/D148582
Aaron Siddhartha Mondal [Mon, 17 Apr 2023 23:53:46 +0000 (01:53 +0200)]
[Bazel] Use dynamic workspace root determination
The `clang:ast` and `clang:builtin_headers_gen` targets currently use hardcoded `external/llvm-project`
paths to access generated headers.
With bzlmod this path becomes dependent on the module name, module version and module extension,
so we need a more dynamic approach.
Does not affect the WORKSPACE build.
Reviewed By: GMNGeoffrey, #bazel_build
Differential Revision: https://reviews.llvm.org/D137007