Zahira Ammarguellat [Thu, 6 Apr 2023 19:21:14 +0000 (15:21 -0400)]
Set 'rounding_mode' to 'tonearest' with '#pragma STDC FENV_ACCESS OFF'.
In strict mode the 'roundin_mode' is set to 'dynamic'. Using this pragma to
get out of strict mode doesn't have any effect on the 'rounding_mode'.
See https://godbolt.org/z/zoGTf4j1G
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D147733
Simon Pilgrim [Wed, 12 Apr 2023 10:37:41 +0000 (11:37 +0100)]
[X86] Add test coverage for TESTPS/TESTPD showing the failure to demand only the sign bits
Part of Issue #60007
Simon Pilgrim [Wed, 12 Apr 2023 10:03:45 +0000 (11:03 +0100)]
[X86] combinePTESTCC - remove unnecessary legal vector type assertion
Most of these folds bitcast to the PTEST operand type anyway, and its only relevant for the PTEST->MOVMSK fold, which I'm looking at expanding to attempt to fold to PTEST->TESTP as well.
Noticed while beginning triage of Issue #60007
Pierre Gousseau [Wed, 12 Apr 2023 09:55:16 +0000 (10:55 +0100)]
[tsan] Add debugging interfaces into interface header.
Reviewed By: vitalybuka, dvyukov
Differential Revision: https://reviews.llvm.org/D147337
David Green [Wed, 12 Apr 2023 10:00:38 +0000 (11:00 +0100)]
[AArch64] Extend testing for folding fadd to predicated SVE insinstructions. NFC
This extends the existing tests to include negative zeros and additional
combinations. See D147724 and D147723.
Simon Pilgrim [Wed, 12 Apr 2023 09:37:51 +0000 (10:37 +0100)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFC
Nikita Popov [Wed, 12 Apr 2023 09:55:01 +0000 (11:55 +0200)]
[SCEV] Add additional tests for finite loop trip counts (NFC)
Add post-inc variations of tests.
Alexey Lapshin [Wed, 5 Apr 2023 18:45:00 +0000 (20:45 +0200)]
[Reland][ADT][ConcurrentHashTable] adapt ConcurrentHashTable and its users to LLVM_ENABLE_THREADS=0 mode.
This patch hides thread specific handling under LLVM_ENABLE_THREADS guard.
It also removes usages of thread_local variables, since it has a weak
support on some platforms. Instead, the patch uses single mutex for locking
allocator. That may be replaced with more effective allocator later.
f.e. D142318
Differential Revision: https://reviews.llvm.org/D147649
Wang, Xin10 [Wed, 12 Apr 2023 09:26:00 +0000 (05:26 -0400)]
Fix Mem leak in LLVMTargetMachine.cpp
If we go to line 302, with one of MCE or MAB is not nullptr, then we could
leak mem here.
Use unique_ptr to maintain these 2 pointer can avoid it.
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D148003
Jie Fu [Wed, 12 Apr 2023 09:19:06 +0000 (17:19 +0800)]
[mlir] Remove extra ';' outside of a function (NFC)
/data/llvm-project/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp:342:2: error: extra ';' outside of a function is incompatible with C++
98 [-Werror,-Wc++98-compat-extra-semi]
}; // namespace
Oleg Shyshkov [Wed, 12 Apr 2023 08:48:14 +0000 (10:48 +0200)]
[mlir][bufferization] Make function boundary type convertion logic dynamic.
Having to choose from only static or dynamic layout for all function is limiting.
Differential Revision: https://reviews.llvm.org/D148074
Balázs Kéri [Wed, 12 Apr 2023 07:33:51 +0000 (09:33 +0200)]
[clang][analyzer] Improve bug reports of StdLibraryFunctionsChecker.
Add an additional explanation of what is wrong if a constraint is
not satisfied, in some cases.
Additionally the bug report generation is changed to use raw_ostream.
Reviewed By: Szelethus, NoQ
Differential Revision: https://reviews.llvm.org/D144003
Nikita Popov [Wed, 12 Apr 2023 08:17:28 +0000 (10:17 +0200)]
[GVNHoist] Regenerate test checks (NFC)
Corentin Jabot [Tue, 11 Apr 2023 14:32:31 +0000 (16:32 +0200)]
[Clang] Fix crash caused by line splicing in doc comment
Because the comment parser does not support slices,
we emit a warning for comments that do contain
a splice within their delimiter, and do not add them as
documentation comment.
Fixes #62054
Reviewed By: shafik, aaron.ballman
Differential Revision: https://reviews.llvm.org/D148029
Nikita Popov [Wed, 12 Apr 2023 07:48:01 +0000 (09:48 +0200)]
[IR] Use switch in Instruction::mayThrow() (NFC)
Martin Storsjö [Sat, 8 Apr 2023 18:51:02 +0000 (21:51 +0300)]
[libcxx] Move the private header __std_stream into the src subdir
This header isn't used by any public header, so there shouldn't
be any need to install it or treat it as a heder.
Once it's part of the src subdirectory, I guess one could consider
giving it a more traditional name too.
Differential Revision: https://reviews.llvm.org/D147855
Martin Storsjö [Wed, 5 Apr 2023 11:51:36 +0000 (14:51 +0300)]
[libcxxabi] [test] Don't cast a pointer to long, fixing the test on Windows
Use uintptr_t instead. On Windows, long is 32 bit even on 64 bit
architectures.
Differential Revision: https://reviews.llvm.org/D147639
Martin Storsjö [Tue, 11 Apr 2023 08:59:31 +0000 (11:59 +0300)]
[compiler-rt] [test] Remove a leftover XFAIL
This test succeeds on aarch64 windows now (tested both in mingw
mode and with clang-cl), most probably since commit
ccd96b3e03e18653e909852bfef105fc10782acb / D146667 ([builtins][test] Fix
divmodti4_test.c on Windows).
Differential Revision: https://reviews.llvm.org/D148000
Martin Storsjö [Wed, 29 Mar 2023 21:35:56 +0000 (00:35 +0300)]
[libcxx] [test] Check for C++ headers before building a test that uses them
When the libcxx test framework is executed within libunwind, there
are no standard C++ headers available (libunwind builds with
-nostdinc++, but doesn't add any libcxx headers to the include path).
Check that a test that includes <iostream> can be compiled before trying
to build and execute a test program that includes it.
Previously, the compile error here would block all libunwind tests from
executing altogether.
Differential Revision: https://reviews.llvm.org/D147630
Matthias Springer [Wed, 12 Apr 2023 06:50:27 +0000 (15:50 +0900)]
[mlir][transform] TrackingListener: Drop mappings of tracked ops when all handles are dead
No replacement ops are needed for tracked ops who's handles are all dead.
Differential Revision: https://reviews.llvm.org/D147510
Kazu Hirata [Wed, 12 Apr 2023 06:52:05 +0000 (23:52 -0700)]
Remove forward declarations of llvm::Any
This patch removes forward declarations of llvm::Any as they are not
used. Removing them gets us a bit closer to the world where we use
std::any instead of llvm::Any because we won't forward-declare std::
classes.
Wang, Xin10 [Wed, 12 Apr 2023 06:49:02 +0000 (02:49 -0400)]
Add delete to fix resource leak in llc.cpp
From line 693 in file llc.cpp, it uses new operator to creates a ModulePass
and assigned to MMIWP. If the condition after take the true branch, it has
chance to go in to line 702 or line 709, the function will return without
cleaning the memory.
The second issue existed for the same reason, the ref TPC get the pointer
created from LLVMTM.createPassConfig, and will leak memory if goes into
line 709.
This patch uses delete in the issued branch.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D147993
Matthias Springer [Wed, 12 Apr 2023 06:41:40 +0000 (15:41 +0900)]
[mlir][transform] Better debugging facilites for invalid API usage
This revision adds additional "expensive-checks" checks to the transform dialect that detect the most common cases of:
* Missing `consumesHandle` side effects on transform ops.
* Patterns that remove operations but do not notify the transform dialect.
In essence, these additional checks are looking for dangling pointers to erased payload ops in the transform dialect state and crash the program execution (by dereferencing free'd memory) or triggering an assertion failure. It is recommended to run these extra checks with ASAN. Otherwise, certain failures may not be detected. The ASAN error message can also be used to find the faulty transform op/pattern.
This change also fixes a few faulty transform ops.
Differential Revision: https://reviews.llvm.org/D147447
Phoebe Wang [Wed, 12 Apr 2023 06:25:18 +0000 (14:25 +0800)]
[Windows SEH] Fix ehcleanup crash for Windows -EHa
`Builder.GetInsertBlock()` may return null sometimes. https://godbolt.org/z/n1Ph47jP1
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D147867
Max Kazantsev [Wed, 12 Apr 2023 06:41:51 +0000 (13:41 +0700)]
[Test] Regenerate checks in some tests using auto-update script
luxufan [Wed, 12 Apr 2023 04:50:46 +0000 (12:50 +0800)]
[GVNHoist][NFC] Remove --check-globals in test file
luxufan [Tue, 11 Apr 2023 12:59:35 +0000 (20:59 +0800)]
[GVNHoist][NFC] Regenerate test case
Matthias Springer [Wed, 12 Apr 2023 03:54:21 +0000 (12:54 +0900)]
[mlir][transform] Dump match failures in TrackingListener
Differential Revision: https://reviews.llvm.org/D147997
Ben Shi [Wed, 12 Apr 2023 03:50:21 +0000 (11:50 +0800)]
[LoongArch] Optimize multiplication with immediates
Optimize (mul x, imm) to (ADD (SLLI x, s0), (SLLI x, s1)) or
(SUB (SLLI x, s0), (SLLI x, s1)) if possible.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D147692
Ben Shi [Thu, 6 Apr 2023 08:27:06 +0000 (16:27 +0800)]
[LoongArch][NFC] Add tests of multiplication with immediates
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D147691
Ben Shi [Fri, 7 Apr 2023 03:45:05 +0000 (11:45 +0800)]
[AVR] Disable post increment load from program memory space
We temporarily only allow post increment load/store from/to data memory,
and disable post increment load from program space.
Updates https://github.com/llvm/llvm-project/issues/59914
Reviewed By: mzh
Differential Revision: https://reviews.llvm.org/D147761
wren romano [Tue, 11 Apr 2023 22:16:47 +0000 (15:16 -0700)]
[mlir][sparse] Canonicalizing arguments to genReshapeDstShape and foreachInSparseConstant
These functions don't need a`PatternRewriter`, they only need an `OpBuilder`. And, the builder should be the first argument, before the `Location`, to match the style used everywhere else in MLIR.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D148059
Hassnaa Hamdi [Tue, 11 Apr 2023 23:04:41 +0000 (23:04 +0000)]
Revert "[AArch64][DAGCombiner]: combine <2xi64> add/sub."
This reverts commit
6a8d8f3e28aed1b77356be74ee5109d7bdd37dd1.
Nico Weber [Tue, 11 Apr 2023 12:21:24 +0000 (08:21 -0400)]
[fuzzer] Fix -Wunreachable-code-aggressive warning in FuzzerDriver.cpp
Differential Revision: https://reviews.llvm.org/D148008
Rafael Auler [Tue, 11 Apr 2023 21:31:16 +0000 (14:31 -0700)]
[BOLT] Fix creation of invalid CFG in presence of dead code
When there is a direct jump right after an indirect one, in
the absence of code jumpting to this direct jump, this is obviously
dead code. However, BOLT was failing to recognize that by mistakenly
placing both jmp instructions in the same basic block, and creating
wrong successor edges. Fix that, so we can safely run UCE on
that. This bug also causes validateCFG to fail and BOLT to crash if it
is running ICP on that function.
Reviewed By: #bolt, Amir
Differential Revision: https://reviews.llvm.org/D148055
Jonas Devlieghere [Wed, 12 Apr 2023 00:03:49 +0000 (17:03 -0700)]
[lldb] Parse the crashlog only once
Now that we can pass Python objects to the scripted process instance, we
don't need to parse the crashlog twice anymore.
Differential revision: https://reviews.llvm.org/D148063
Lang Hames [Tue, 11 Apr 2023 04:17:37 +0000 (21:17 -0700)]
[ORC] Fix fallout from switch to _objc_map/load_images-based registration.
In
f448d44663a we switched to calling _objc_map_images and _objc_load_images
for MachO language metadata registration. This patch fixes some bugs arising
from that change:
(1) __objc_imageinfo processing was moved to a post-allocation pass, but this
prevents us from discarding the redundant copies. This commit moves
processing back to a pre-prune pass and inserts a symbol for the uniqued
__objc_image section. Runtime objects use an edge pointing to this symbol
to access the address.
(2) We were assuming that _objc_map_images & _objc_load_images were available
in the Objective-C runtime on 10.15, but these functions didn't become
available until later. This commit bumps the macOS version requirement to
13.1 where the functions should be available.
(3) The ORC-RT trivial-swift-types-section.S test was missing an
__objc_unwindinfo section, which triggered an assert that should have
been an error. The assert has been turned into an error, and the testcase
has been updated to include an __objc_imageinfo.
rdar://
107846455
Chia-hung Duan [Tue, 11 Apr 2023 22:42:02 +0000 (22:42 +0000)]
[scudo] Temporariy dispatch region from `RegionBeg`
In general, a region is located from region base and has size
`RegionSize`. However, some platforms may not support mapping from
region base. Before we have each platform implements their specific
MemMap to handle the offset. Temporarily dispatch the region from
`RegionBeg` instead.
Reviewed By: cferris, fabio-d
Differential Revision: https://reviews.llvm.org/D147792
Vitaly Buka [Tue, 11 Apr 2023 22:36:55 +0000 (15:36 -0700)]
[test][lsan] Reset pointer to leak memory
Aart Bik [Tue, 11 Apr 2023 18:42:29 +0000 (11:42 -0700)]
[mlir][sparse][gpu] put sparse compiler GPU end-to-end tests back
SM80 flag guards the test for targets that do not support A100 GPUs
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D147863
Vitaly Buka [Tue, 11 Apr 2023 22:32:22 +0000 (15:32 -0700)]
[lsan] Regression test for
7d328668691a
Caslyn Tonelli [Tue, 11 Apr 2023 21:18:29 +0000 (21:18 +0000)]
[libc] Fix typo in gnu_ext.td
Differential Revision: https://reviews.llvm.org/D148052
Ziqing Luo [Tue, 11 Apr 2023 22:01:59 +0000 (15:01 -0700)]
[-Wunsafe-buffer-usage] Match unsafe pointers being casted to bool or participating in pointer subtractions
Add two new unique cases to the Unspecified Pointer Context (UPC),
under which we match unsafe operation patterns:
- A pointer being casted to a boolean value is in a UPC;
- A pointer participating in pointer subtraction is in a UPC.
Reviewed by: NoQ (Artem Dergachev), malavikasamak (Malavika Samak)
Differential revision: https://reviews.llvm.org/D144064
Jonas Devlieghere [Tue, 11 Apr 2023 21:45:34 +0000 (14:45 -0700)]
[lldb] Parse image high address from JSON crashlogs
Use the base + size to correctly populate the image high address when
parsing JSON crashlogs.
Differential revision: https://reviews.llvm.org/D148053
Fangrui Song [Tue, 11 Apr 2023 21:44:43 +0000 (14:44 -0700)]
[bazel] Disable layering_check for llvm/unittests:mi_tests after D145707
Emilia Dreamer [Tue, 11 Apr 2023 21:33:12 +0000 (00:33 +0300)]
[clang-format] Don't modify template arguments on the LHS of assignment
After clang-format has determined that an equals sign starts an
expression, it will also go backwards and modify any star/amp/ampamp
binary operators on the left side of the assignment to be
pointers/references instead.
There already exists logic to skip over contents of parentheses and
square brackets, but this patch also expands that logic to apply to
angle brackets. This is so that binary operators inside of template
arguments would not be touched, primary arguments to non-type template
parameters.
Fixes https://github.com/llvm/llvm-project/issues/62055
Reviewed By: owenpan, MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D148024
OCHyams [Tue, 11 Apr 2023 21:25:16 +0000 (22:25 +0100)]
Revert (4) "[Assignment Tracking] Enable by default"
This reverts commit
a0525f09ac1eda3fbb74e8708b3aa5b7379df0c2 which
lands D146987.
Buildbot: https://lab.llvm.org/buildbot/#/builders/70/builds/36214
Devajith V S [Tue, 11 Apr 2023 20:55:59 +0000 (13:55 -0700)]
[mlir][matchers] Add m_Op(StringRef) and m_Attr matchers
This patch introduces support for m_Op with a StringRef argument and m_Attr matchers. These matchers will be very useful for mlir-query that is being developed currently.
Submitting this patch separately to reduce the final patch size and make it easier to upstream mlir-query.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D147262
Caslyn Tonelli [Fri, 7 Apr 2023 22:16:01 +0000 (22:16 +0000)]
[libc] Add memmem implementation
Introduce the `memmem` libc string function.
`memmem_implementation` performs shared logic for `strstr`,
`strcasestr`, and `memmem`; essentially reconfiguring what was the
`strstr_implementation` to support length parameters.
Differential Revision: https://reviews.llvm.org/D147822
Caroline Tice [Mon, 10 Apr 2023 21:45:59 +0000 (14:45 -0700)]
[PATCH][lldb] Fix dereference of null pointer.
The function DWARFASTParserClang::ParsePointerToMemberType attempts to make
two pointers and then immediately tries to dereference them, without
verifying that the pointesr were successfully created. Sometimes the pointer
creation fails, and the dereference then causes a segfault. This add a check
that the pointers are non-null before attempting to dereference them.
OCHyams [Tue, 11 Apr 2023 19:41:52 +0000 (20:41 +0100)]
Reapply (3) "[Assignment Tracking] Enable by default"
Re-land D146987.
This reverts commit
4f1954ed67c12aca3fd3e67151185c64dc941768 which
reverts D146987.
Mircea Trofin [Tue, 11 Apr 2023 19:52:06 +0000 (12:52 -0700)]
[mlgo] Fix the help message for interactive mode default advice
This avoids the use-after-free introduced by D147794 and fixed
in
437dfa5b0365.
Alexey Bataev [Fri, 7 Apr 2023 13:14:36 +0000 (06:14 -0700)]
[SLP][NFC]Introduce ShuffleCostEstimator and adjustExtracts member function.
Added ShuffleCostEstimator class and the first adjustExtracts member,
which is just a copy of previous AdjustExtractCost lambda.
Differential Revision: https://reviews.llvm.org/D147787
Congcong Cai [Tue, 11 Apr 2023 18:45:49 +0000 (20:45 +0200)]
[clang-tidy] support nested inline namespace in c++20 for modernize-concat-nested-namespaces
Fixed https://github.com/llvm/llvm-project/issues/56022
c++20 support namespace like `namespace a::inline b {}`.
If an inline namespace is not the first, it can be concatened.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D147946
Vlad Serebrennikov [Tue, 11 Apr 2023 19:14:29 +0000 (22:14 +0300)]
[clang] Add test for CWG1837
[[https://wg21.link/p1787 | P1787]]: CWG1837 is resolved by restricting `this` to referring to the innermost enclosing class.
Wording: see changes to [expr.prim.this] and [expr.prim.lambda].
Reviewed By: #clang-language-wg, erichkeane
Differential Revision: https://reviews.llvm.org/D148035
Vlad Serebrennikov [Tue, 11 Apr 2023 19:12:57 +0000 (22:12 +0300)]
[clang] Add test for CWG2007
[[https://wg21.link/p1787 | P1787]]: CWG2007 is resolved by skipping unqualified lookup for operators that must be member functions.
Wording: For the operators =, [], or ->, the set of non-member candidates is empty; otherwise, it includes the result of the unqualified lookup for operator@... ([over.match.oper]/3)
Reviewed By: #clang-language-wg, shafik
Differential Revision: https://reviews.llvm.org/D147839
Vlad Serebrennikov [Tue, 11 Apr 2023 19:03:13 +0000 (22:03 +0300)]
[clang] Add test for CWG2370
[[https://wg21.link/p1787 | P1787]]: CWG2370 is resolved by performing a search in (only) the immediate scope of any friend, per the [[ http://wiki.edg.com/bin/view/Wg21sandiego2018/CoreWorkingGroup#Core_issue_2370_friend_declarati | CWG opinion from San Diego ]].
Wording: In a friend declaration declarator whose declarator-id is a qualified-id whose lookup context is a class or namespace S, lookup for an unqualified name that appears after the declarator-id performs a search in the scope associated with S. If that lookup finds nothing, it undergoes unqualified name lookup. ([basic.lookup.unqual]/6).
Clarification for P1787 description: when applied to the test in this patch, "immediate scope" refers to `N`, and "(only)" refers to the fact that `type` is not searched in parent scope of `N`. See example after the wording if additional clarification is needed. The most relevant line there is `friend void A::f(F); // OK`.
Reviewed By: #clang-language-wg, shafik
Differential Revision: https://reviews.llvm.org/D147848
Craig Topper [Tue, 11 Apr 2023 18:30:15 +0000 (11:30 -0700)]
[RISCV] Add segment load/store to getTgtMemIntrinsic.
Vitaly Buka [Wed, 5 Apr 2023 23:46:42 +0000 (16:46 -0700)]
[hwasan] Don't require untagged pointer in __hwasan_tag_memory
Use likely have tagged pointer. I see no value making user to untag it.
Reviewed By: fmayer
Differential Revision: https://reviews.llvm.org/D147671
Caslyn Tonelli [Tue, 11 Apr 2023 02:57:38 +0000 (02:57 +0000)]
[libc] Fix swab placement
Per https://reviews.llvm.org/D147970#4256889, swab.cpp is moved out of
the /linux subdirectory and cmake specifications are amended to reflect
that swab is not OS-specific.
Differential Revision: https://reviews.llvm.org/D147988
Nitin John Raj [Fri, 7 Apr 2023 19:51:46 +0000 (12:51 -0700)]
[RISCV][Tablegen] Make VLXSched and VSXSched classes aware of data and index lmul
The LMUL for data and index are not guaranteed the same so we need different LMULs appended to the sched classes for them.
Differential Revision: https://reviews.llvm.org/D147814
Nitin John Raj [Fri, 7 Apr 2023 17:51:55 +0000 (10:51 -0700)]
[RISCV][Tablegen] Remove LMUL from ReadVLDX, ReadVSTX, ReadVLDSX, ReadVSTSX scheduler classes
This read is for a gpr pointer, and doesn't need to be LMUL aware.
Differential Revision: https://reviews.llvm.org/D147799
Alex Langford [Sat, 8 Apr 2023 01:39:24 +0000 (18:39 -0700)]
[lldb] Change return type of EventData::GetFlavor
There's no reason these strings need to be in the ConstString
StringPool, they're already string literals with static lifetime.
I plan on addressing other similar functions in follow up commits.
Differential Revision: https://reviews.llvm.org/D147833
Valentin Clement [Tue, 11 Apr 2023 17:42:44 +0000 (10:42 -0700)]
[mlir][openacc] Relax the single block constraint on acc.loop
The acc.loop operation was constrained by the SingleBlockImplicitTerminator.
This patch relax this constraint to allow multiple block in the loop.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D148025
Craig Topper [Tue, 11 Apr 2023 17:41:50 +0000 (10:41 -0700)]
[RISCV] Print a better error message when a rv32 CPU is used on rv64 and vice versa.
Instead of rejecting the CPU outright with no information, try
to diagnose that it doesn't match the triple.
Differential Revision: https://reviews.llvm.org/D147986
Craig Topper [Tue, 11 Apr 2023 17:41:46 +0000 (10:41 -0700)]
[RISCV] Remove getCPUFeaturesExceptStdExt.
This function was used to force +64bit or -64bit into the feature
string basd on -mcpu.
It's not entirely clear to me why this was needed. This informationo
is redundant with the triple. RISCVTargetInfo::initFeatureMap
independently recomputes it from the triple for the feature map.
It is ultimately needed in the backend, but that should be handled
by RISCVSubtarget processing the CPU name.
Differential Revision: https://reviews.llvm.org/D147978
Matthew Voss [Tue, 11 Apr 2023 17:13:58 +0000 (10:13 -0700)]
[PS4][clang] Pass -flto-jobs argument to orbis-ld
Pass -flto-jobs to orbis-ld correctly.
Differential Revision: https://reviews.llvm.org/D147660
OCHyams [Tue, 11 Apr 2023 17:03:51 +0000 (18:03 +0100)]
[Assignment Tracking] Trunc fragments for stores to vars smaller than the alloca
In D147777 emitDbgAssign was fixed to discard assignments which touched any
bits outside the bounds of a variable. This patch changes emitDbgAssign to
discard assignments which touch bits only outside the variable bounds, and
creates a truncated fragment expression for stores partially overlapping the
variable. This is necessary because the alloca is interpreted as a store (of
undef), meaning without this patch emitDbgAssign would discard the inital
dbg.assign for a variable that is smaller than the alloca.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D148018
OCHyams [Tue, 11 Apr 2023 16:36:39 +0000 (17:36 +0100)]
[Assignment Tracking][SROA] Don't un-poison dbg.assigns using multiple loc ops
Some dbg.assigns using poison become un-poisoned in SROA. The reason this
happens at all is because dbg.assigns linked to memory intrinsics use poison to
indicate they can't describe the stored value, but the value becomes available
after some optimisations. This needs reworking eventually, but for now we need
to ensure that when it does occur we don't create invalid expressions.
D147312 prevented this occuring when the dbg.assign uses DIArgLists, but that
wasn't a complete fix. We also need to ensure we avoid un-poisoning when the
existing expression uses more than one location operand (DW_OP_arg, n).
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D148020
Simon Pilgrim [Tue, 11 Apr 2023 17:01:32 +0000 (18:01 +0100)]
[X86] widen-load-of-small-alloca tests - use X86 check prefix for i686 triples
We try to use X32 just for gnux32 triples
Florian Hahn [Tue, 11 Apr 2023 16:51:10 +0000 (17:51 +0100)]
[LV] Use std::make_optional to fix build failure after
082a0046.
Some compilers require std::make_optional(std::move()) to force construction
of the std::optional return value. This should fix the build failure in
https://lab.llvm.org/buildbot#builders/67/builds/10991
Mark de Wever [Sun, 9 Apr 2023 11:24:21 +0000 (13:24 +0200)]
[libc++][format] Mark range formaters as complete.
The __cpp_lib_format_ranges feature-test macro only depends on P2286R8
and P2585R0. Note since LWG3750 only affects these two C++23 papers
there is nothing to do for older language versions.
(The __cpp_lib_format feature-test macro depends on the incomplete
formatting for chrono. So this part can't be marked as complete yet.)
This completes
- P2286R8 Formatting ranges
- P2585R0 Improving default container formatting
This partly implements
- LWG3750 Too many papers bump __cpp_lib_format
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D147880
Louis Dionne [Tue, 11 Apr 2023 16:44:58 +0000 (17:44 +0100)]
[libc++][NFC] Update precondition comments when testing subspan assertions
Mark de Wever [Sun, 9 Apr 2023 15:19:17 +0000 (17:19 +0200)]
[libc++][format] Improves tests.
This is based on the last open review comment in D144331 and is applied
to all occurrences.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D147885
Mark de Wever [Wed, 15 Mar 2023 07:07:05 +0000 (08:07 +0100)]
[libc++][CI] Prepares building C++ modules.
D144994 adds modules to libc++. In order to test them some newer and
additional tools are required.
CMake 3.26
This is in combination with Clang 16 or newer makes it possible to
conveniently build modules with CMake. Unfortunately CMake 3.26 in our
setup has an issue with unused linker flags. This causes libunwind not
to compile at all. D145596 contains a quick-fix which is in the module
patch. The patch D142957 and followups will contain a proper fix.
Therefore install CMake 3.26 in a separate location, allowing to test
the module patch in the CI.
Ninja 1.11
Building modules requires dynamic rules, which requires this version.
This is a CMake 3.26 requirement to use modules. Note that without using
modules CMake still accepts older Ninja versions.
clang-scan-deps (in the tools package)
This tool is used by CMake to get the module dependencies. Note
strictly this currently will only be used for Clang 16 and Clang 17.
Clang 15 and Clang 14 are not needed. They are installed to keep
updating to Clang 18 and later easier.
(In the future we might not test modular build with all Clang versions,
however at the moment the feature is still in development in both Clang
and libc++ so it would be good to detect regressions.)
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D146822
Mark de Wever [Sun, 9 Apr 2023 16:00:01 +0000 (18:00 +0200)]
[libc++] Formats the sytem_error headers.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D147886
OCHyams [Tue, 11 Apr 2023 15:56:05 +0000 (16:56 +0100)]
[Assignment Tracking] Fix replaceVariableLocationOp for dbg.assign with DIArgList
The last time this function was updated DIArgLists were not supported for
dbg.assigns. Without this patch it's possible to now dereference an invalid
(the end) iterator. This occurs when the Address component gets replaced and
there's a DIArgList for the Value component (the contained values are
irrelevant).
The added unittest crashes without the code change in this patch.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D147922
Quinn Dawkins [Sat, 1 Apr 2023 19:17:45 +0000 (15:17 -0400)]
[mlir][linalg] Enable propagation of pack/unpack ops through non-elementwise
Allows pack propagation through non-elementwise generics as long as all
tiled dimensions have parallel iterator types and are only indexed with
affine dim expressions by any of the operands.
This enables unpack propagation cases where the result type is different
from the current unpack destination tensor and thus motivates a similar
helper as the for pack for creating a destination tensor based on
pack information.
Outer dim permutations are allowed to permute reduction dims, however
remains unsupported for non-affine dim indexing map results.
Additionally ops with gather semantics now explicitly prohibit propagation.
Pack/unpack propagation through reductions may not always be beneficial
so user control over propagation decisions is made available through
a control function similar to the one for fusion.
Differential Revision: https://reviews.llvm.org/D147508
Michael Liao [Thu, 23 Mar 2023 20:29:14 +0000 (16:29 -0400)]
[InstCombine] Teach alloca replacement to handle `addrspacecast`
- As the address space cast may not be valid on a specific target,
`addrspacecast` is not handled when an `alloca` is able to be replaced
with the source of memcpy/memmove. This patch addresses that by
querying a target hook on whether that address space cast is valid.
For example, on most GPU targets, the cast from a global pointer to a
generic pointer is valid.
- If that cast is allowedd (by querying `isValidAddrSpaceCast`), the
replacement is enhanced to handle that `addrspacecast` as well.
Reviewed By: yaxunl
Differential Revision: https://reviews.llvm.org/D147025
Felix Schneider [Tue, 11 Apr 2023 15:36:41 +0000 (17:36 +0200)]
[mlir][MemRef] fix error message in ReinterpretCastOp::verify
The error message that is displayed when the offset in the MemRefType of
the Op's result is unexpected was the wrong way around, mixing up
expected and actual offset.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D148009
Akash Banerjee [Tue, 11 Apr 2023 15:36:57 +0000 (16:36 +0100)]
[MLIR][OpenMP] Add conversion support from FIR to LLVM Dialect for OMP Target
This enables conversion of OpenMP Target op with region from FIR Dialect to LLVM IR Dialect.
Differential Revision: https://reviews.llvm.org/D147439
Alex Zinenko [Tue, 11 Apr 2023 13:23:13 +0000 (13:23 +0000)]
[mlir] fix a crash in linalg.generic parser
Report an error when the `iterator_types` attribute is missing.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D148015
Akash Banerjee [Tue, 11 Apr 2023 15:34:56 +0000 (16:34 +0100)]
[Flang][OpenMP] Add Fortran lowering support for Target directive
This patch adds Fortran lowering support for OMP Target directive along with tests.
Differential Revision: https://reviews.llvm.org/D147339
Alex Zinenko [Tue, 11 Apr 2023 13:25:37 +0000 (13:25 +0000)]
[mlir] make transform interpreter debug spew less verbose
In particular, move the printing of the top-level payload after each
transform under the "full output" debug flag, it is rarely useful and
excessively long. Also don't print the regions of the transform
operation being applied as each individual operation in the region is
likely going to be applied later by itself and therefore printed.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D148014
Akash Banerjee [Tue, 11 Apr 2023 12:49:19 +0000 (13:49 +0100)]
[MLIR][OpenMP] Added map clause support for Target
Added map clause support for the OMP Target directive with test.
Differential Revision: https://reviews.llvm.org/D147247
Ellis Hoag [Tue, 11 Apr 2023 14:58:47 +0000 (07:58 -0700)]
[InstrProf] Temporal Profiling
As described in [0], this extends IRPGO to support //Temporal Profiling//.
When `-pgo-temporal-instrumentation` is used we add the `llvm.instrprof.timestamp()` intrinsic to the entry of functions which in turn gets lowered to a call to the compiler-rt function `INSTR_PROF_PROFILE_SET_TIMESTAMP()`. A new field in the `llvm_prf_cnts` section stores each function's timestamp. Then in `llvm-profdata merge` we convert these function timestamps into a //trace// and add it to the indexed profile.
Since these traces could significantly increase the profile size, we've added `-max-temporal-profile-trace-length` and `-temporal-profile-trace-reservoir-size` to limit the length of a trace and the number of traces in a profile, respectively.
In a future diff we plan to use these traces to construct an optimized function order to reduce the number of page faults during startup.
Special thanks to Julian Mestre for helping with reservoir sampling.
[0] https://discourse.llvm.org/t/rfc-temporal-profiling-extension-for-irpgo/68068
Reviewed By: snehasish
Differential Revision: https://reviews.llvm.org/D147287
Nikita Popov [Tue, 11 Apr 2023 15:16:10 +0000 (17:16 +0200)]
[Attributor] Name instructions in tests (NFC)
Anna Thomas [Thu, 6 Apr 2023 21:04:52 +0000 (17:04 -0400)]
[GuardUtils] Add asserts about loop varying widenable conditions
We have now seen two miscompiles because of widening widenable
conditions at incorrect IR points and thereby changing a branch's loop
invariant condition to a loop-varying one (see PR60234 and PR61963).
This patch adds asserts in common guard utilities that we use for
widening to proactively catch these bugs in future.
Note that these asserts will not fire if we were to sink a widenable
condition from out of a loop into a loop (that's also incorrect for the
same reason as above).
Tested this without the fix for PR60234 (guard widening miscompile) and
confirmed the assert fires.
WARNING: Sometimes, the assert can fire if we failed to hoist the
invariant condition out of the loop. This is a pass-ordering issue or a
limitation in LICM, which would need an investigation. See details in
review.
Differential Revision: https://reviews.llvm.org/D147752
Nikita Popov [Tue, 11 Apr 2023 14:41:33 +0000 (16:41 +0200)]
[Transforms] Convert some tests to opaque pointers (NFC)
Florian Hahn [Tue, 11 Apr 2023 14:41:17 +0000 (15:41 +0100)]
[VPlan] Allow building a VPlan to may fail.
Update the planning code constructing VPlan to allow building VPlans to
fail. This allows us to gradually shift some legality checks to VPlan
construction. The first candidate is checking if all users of
first-order recurrence phis can be sunk past the recipe computing the
previous value.
The new functionality will be used by D142886 which is approved and will
be landed shortly.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D142885
Nikita Popov [Tue, 11 Apr 2023 14:30:09 +0000 (16:30 +0200)]
[FunctionAttrs] Add cleanuppad test (NFC)
Joe Nash [Mon, 10 Apr 2023 18:23:42 +0000 (14:23 -0400)]
[AMDGPU] NFC. Clean up check prefixes in fcmp test
Fix the test introduced in D136592 which appeared to have a few check lines
containing an un-checked prefix "GISEL-GFX".
Also canonicalize the other prefixes to minimize churn if SDag and GISel
diverge.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D147958
Balaji V. Iyer [Tue, 11 Apr 2023 13:43:15 +0000 (13:43 +0000)]
[mlir][math] Expand math.ceilf to truncate, compares and increments
Ceilf are pushed directly to libm. This is problematic for
situations where libm is not available. This patch will break down
a ceilf function to truncate followed by an increment if the
truncated value is smaller than the input value.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D147974
David Green [Tue, 11 Apr 2023 13:49:46 +0000 (14:49 +0100)]
[ARM] Increase the Scalarized cost of masked gather/scatter operations
If a gather/scatter is masked and will need to be scalarized then the cost
should be higher than we currently produce. An additional cost for scalarizing
the mask, extracting i1s and branching on the result needs to be added, which
this patch gives a cost of 5.
Differential Revision: https://reviews.llvm.org/D147331
Amaury Séchet [Fri, 7 Apr 2023 23:31:13 +0000 (23:31 +0000)]
[DAG] Peek through zext/trunc when matching (or (and X, (not Y)), Y).
This shows up in the wild, notably as a regression in D127115 .
Depends on D147821
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D147827
Tue Ly [Fri, 7 Apr 2023 02:38:04 +0000 (22:38 -0400)]
[libc][math] Update range reduction step for log2f and improve its performance.
Simplify the range reduction steps by choosing the reduction constants
carefully so that the reduced arguments v = r*m_x - 1 and v^2 are exact in double
precision, even without FMA instructions, and -2^-8 <= v < 2^-7.
Reviewed By: zimmermann6
Differential Revision: https://reviews.llvm.org/D147759
Congcong Cai [Tue, 11 Apr 2023 13:41:28 +0000 (15:41 +0200)]
[NFC] format llvm/lib/Target/WebAssembly/AsmParser
Reviewed By: aheejin
Differential Revision: https://reviews.llvm.org/D147884
Nicolas Vasilache [Tue, 11 Apr 2023 12:52:48 +0000 (05:52 -0700)]
[mlir][Linalg] NFC - Improve debug messages around padding
Simon Pilgrim [Tue, 11 Apr 2023 13:18:35 +0000 (14:18 +0100)]
[X86] Remove unnecessary OneUse limit from combineToExtendBoolVectorInReg (vXi1 bitcast(iX Cond)) select expansion
We already allow multiple uses when calling from combineSext/combineZext - adding hasOneUse seems to have been a copy+paste from some of the similar AVX512 vselect folds.
Fixes #62014
Amaury Séchet [Tue, 11 Apr 2023 12:51:08 +0000 (12:51 +0000)]
[NFC] Add test cases for D147827