Johannes Doerfert [Sun, 9 Jan 2022 03:11:51 +0000 (21:11 -0600)]
[Attributor][FIX] Remove assumption that doesn't have to hold
There is no guarantee we strip all GEPOperators and the conservative
handling doesn't even require us to.
Nicolas Vasilache [Sun, 9 Jan 2022 16:51:58 +0000 (11:51 -0500)]
[mlir][Bufferize] NFC - Introduce areCastCompatible assertions to catch misformed CastOp early
Differential Revision: https://reviews.llvm.org/D116893
Florian Hahn [Sun, 9 Jan 2022 18:38:41 +0000 (18:38 +0000)]
[SCEVExpander] Simplify cleanup, skip sorting by dominance.
There is no need to sort inserted instructions by dominance, as the
deletion loop still requires RAUW with undef before deleting. Removing
instructions in reverse insertion order should still insure that the
number of uselist updates is kept to a minimum.
Jake Egan [Sun, 9 Jan 2022 17:20:38 +0000 (12:20 -0500)]
[AIX] Disable tests that fail because of no 64-bit XCOFF object file support
The modified tests fail because 64-bit XCOFF object files are not currently supported on AIX. This patch disables these tests on 64-bit AIX for now.
This patch is similar to D111887 except the failures on this patch are on a 64-bit build.
Reviewed By: shchenz, #powerpc
Differential Revision: https://reviews.llvm.org/D113049
Sanjay Patel [Sun, 9 Jan 2022 13:59:48 +0000 (08:59 -0500)]
[x86] exclude "X==0 ? Y :-1" from math/logic transform
This is the last step in a series to improve lowering
via "SBB" asm:
68defc0134
aab1f55e33
...and fixes #53006
Florian Hahn [Thu, 6 Jan 2022 21:13:04 +0000 (21:13 +0000)]
[SCEVExpander] Only check overflow if it is needed.
9345ab3a4550 updated generateOverflowCheck to skip creating checks that
always evaluate to false. This in turn means that we only need to check
for overflows if the result of the multiplication is actually used.
Sink the Or for the overflow check into ComputeEndCheck, so it is only
created when there's an actual check.
Sanjay Patel [Sun, 9 Jan 2022 11:17:11 +0000 (06:17 -0500)]
[InstCombine] (~A | B) & (A ^ B) -> ~A & B
This is part of a set of 2-variable logic optimizations
suggested here:
https://lists.llvm.org/pipermail/llvm-dev/2021-December/154470.html
The 'not' op must not propagate undef elements of a vector,
so this patch creates a new 'full' not, but I am not counting
that as an extra-use restriction because it should get folded
with the existing value by CSE.
https://alive2.llvm.org/ce/z/7v65im
Sanjay Patel [Fri, 7 Jan 2022 19:40:55 +0000 (14:40 -0500)]
[InstCombine] add tests for and(orn, xor); NFC
Sanjay Patel [Fri, 7 Jan 2022 18:35:59 +0000 (13:35 -0500)]
[x86] use SETCC_CARRY instead of SBB node for select lowering
This is a suggested follow-up to D116765.
This removes a clear of the register operand, so it is better
for code size, but it does potentially create a false register
dependency on surrounding code. If that is a problem, it should
be solvable using dependency-breaking code that is used for
other instructions.
Differential Revision: https://reviews.llvm.org/D116804
Kazu Hirata [Sun, 9 Jan 2022 08:19:51 +0000 (00:19 -0800)]
[clang] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
Kazu Hirata [Sun, 9 Jan 2022 08:19:49 +0000 (00:19 -0800)]
[clang] Fix bugprone argument comments (NFC)
Identified with bugprone-argument-comment.
Kazu Hirata [Sun, 9 Jan 2022 08:19:47 +0000 (00:19 -0800)]
[clang] Use true/false instead of 1/0 (NFC)
Identified with modernize-use-bool-literals.
Casey Carter [Wed, 29 Dec 2021 22:31:23 +0000 (14:31 -0800)]
[libcxx][test] `_VSTD` doesn't belong in test code
Johannes Doerfert [Sat, 8 Jan 2022 19:53:39 +0000 (13:53 -0600)]
[OpenMP][FIX] Emit debug declares only if debug info is available
The `EmitDeclareOfAutoVariable` introduced in D114504 and D115510 has a
precondition that cannot be violated. It is unclear if we should call it
directly given the sparse usage in clang but for now we should at least
not crash if the debug info kind is too low.
Fixes #52938.
Differential Revision: https://reviews.llvm.org/D116865
Johannes Doerfert [Sat, 8 Jan 2022 18:17:04 +0000 (12:17 -0600)]
[Attributor][FIX] Ensure order for multiple references into map
If we have multiple references into a map we need to ensure the ones
created late do not invalidate the ones created early. To do that we
need to make sure all but the first are not modifying the map, hence
for them the keys have to be present already.
Fixes #52875.
Craig Topper [Sat, 8 Jan 2022 21:56:40 +0000 (13:56 -0800)]
[RISCV] Add i8/i16 fptosi/fptoui and fptosi_sat/fptoui_sat tests. NFC
Use signext/zeroext return attributes to show unnecessary ands or
shifts in the saturating tests.
Eric Schweitz [Fri, 7 Jan 2022 23:45:18 +0000 (15:45 -0800)]
[fir] Correct and reenable test that was removed by MLIR.
See https://github.com/llvm/llvm-project/issues/53064
The original test required a cast to be correct.
Correct the CHECK lines. Prune unused ones.
Differential Revision: https://reviews.llvm.org/D116842
Arthur O'Dwyer [Thu, 6 Jan 2022 00:31:24 +0000 (19:31 -0500)]
[libc++] [test] Remove `UNSUPPORTED: stdlib=msvc` from lock.pass.cpp.
Casey Carter says, "We run std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
on every CI and it works fine with MSVC STL. I'm guessing this annotation predates
Billy's rewrite of std::lock in 2017-ish."
Differential Revision: https://reviews.llvm.org/D116712
Craig Topper [Sat, 8 Jan 2022 20:38:43 +0000 (12:38 -0800)]
[RISCV] Add nounwind to remove some cfi directives from test CHECKs. NFC
Florian Hahn [Sat, 8 Jan 2022 20:46:31 +0000 (20:46 +0000)]
[LV] Improve check lines in existing tests.
Update the check lines in 2 existing tests to use patterns + variables
to match some IR to make them independent of value naming.
Craig Topper [Sat, 8 Jan 2022 20:27:46 +0000 (12:27 -0800)]
[RISCV] Add nounwind to remove some cfi directives from test CHECKs. NFC
Craig Topper [Sat, 8 Jan 2022 19:10:05 +0000 (11:10 -0800)]
[docs] Fix documentation of -fno-strict-float-cast-overflow after D115804.
Previously this was documented as having the behavior of the
"target's native float-to-int conversion". After D115804, clang
uses saturating FP cast intrinsics which have the same behavior
on all targets.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D116856
Mehdi Amini [Sat, 8 Jan 2022 20:06:50 +0000 (20:06 +0000)]
Fix clang-tidy readability-redundant-smartptr-get in MLIR ModuleTranslation.cpp (NFC)
Mehdi Amini [Sat, 8 Jan 2022 19:23:16 +0000 (19:23 +0000)]
Enable readability-redundant-smartptr-get in MLIR local clang-tidy config
Kazu Hirata [Sat, 8 Jan 2022 19:56:44 +0000 (11:56 -0800)]
[llvm] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
Kazu Hirata [Sat, 8 Jan 2022 19:56:42 +0000 (11:56 -0800)]
Remove duplicate forward declarations (NFC)
Kazu Hirata [Sat, 8 Jan 2022 19:56:40 +0000 (11:56 -0800)]
[clang] Remove unused forward declarations (NFC)
Kazu Hirata [Sat, 8 Jan 2022 19:56:38 +0000 (11:56 -0800)]
[llvm] Fix bugprone argument comments (NFC)
Identified with bugprone-argument-comment.
Philip Reames [Sat, 8 Jan 2022 18:29:09 +0000 (10:29 -0800)]
[instcombine] Key deref vs deref_or_null annotation of allocation sites off nonnull attribute
Goal is to remove use of isOpNewLike. I looked at a couple approaches to this, and this turned out to be the cheapest one. Just letting deref_or_null be generated causes a bunch of test diffs, and I couldn't convince myself there wasn't a real regression somewhere. A generic instcombine to convert deref_or_null + nonnull to deref is annoying complicated since you have to mix facts from callsite and declaration while manipulating only existing call site attributes. It just wasn't worth the code complexity.
Note that the change in new-delete-itanium.ll is a real regression. If you have a callsite which overrides the builtin status of a nobuiltin declaration, *and* you don't put the apppriate attributes on that callsite, you may lose the deref fact. I decided this didn't matter; if anyone disagrees, you can add this case to the generic non-null inference.
Arthur O'Dwyer [Tue, 4 Jan 2022 01:49:24 +0000 (20:49 -0500)]
[libc++] [ranges] Add namespace __cpo to ranges::{advance,next,prev}.
The reason for those nested namespaces is explained in D115315:
> AIUI, this keeps the CPO's own type from ADL'ing into the `std::ranges`
> namespace; e.g. `foobar(std::ranges::uninitialized_default_construct)`
> should not consider `std::ranges::foobar` a candidate, even if
> `std::ranges::foobar` is not a CPO itself. Also, of course, consistency
> (Chesterton's Fence, the economist's hundred-dollar bill): if it were
> safe to omit the namespace, we'd certainly want to do it everywhere,
> not just here.
This makes these three niebloids more consistent with the other Ranges
niebloids we've already implemented, such as the `ranges::begin` group
and the `ranges::uninitialized_default_construct` group.
FWIW, we still have three different indentation-and-comment styles
among these three groups.
Differential Revision: https://reviews.llvm.org/D116569
Dave Lee [Sat, 8 Jan 2022 17:35:13 +0000 (09:35 -0800)]
Revert "[lldb] Set result error state in 'frame variable'"
This reverts commit
2c7d10c41278181e3e45c68f28b501cd95193a8a.
Dave Lee [Fri, 7 Jan 2022 03:38:31 +0000 (19:38 -0800)]
[lldb] Set result error state in 'frame variable'
Ensure that errors in `frame variable` are reflected in result object.
The statistics for `frame variable` show invocations as being successful, even
when executing one of the error paths.
This change replaces `result.GetErrorStream()` with `result.AppendError()`,
which also sets the status to `eReturnStatusFailed`.
Differential Revision: https://reviews.llvm.org/D116788
Simon Pilgrim [Sat, 8 Jan 2022 16:18:46 +0000 (16:18 +0000)]
[CGObjCMac] Use castAs<> instead of getAs<> to avoid dereference of nullptr inside BuildRCBlockVarRecordLayout
This will assert the cast is correct instead of returning nullptr (UnionType is a subtype of RecordType so this should be clean).
Florian Hahn [Sat, 8 Jan 2022 15:44:52 +0000 (15:44 +0000)]
[LSR] Auto-generate check lines for test.
Checking the full output provides more context and makes it easier to
review changes to the test in a follow-up patch.
Florian Hahn [Sat, 8 Jan 2022 15:43:30 +0000 (15:43 +0000)]
[LoopUnroll] Make test more robust by removing undef.
Replace a uses of undef in the tests. The undef causes runtime checks
to be trivially fold/removeable, which does defeat the purpose of the test.
Florian Hahn [Fri, 7 Jan 2022 22:06:22 +0000 (22:06 +0000)]
[LV] Make tests more robust by removing undef.
Replace some uses of undef in the tests. The undef causes runtime checks
to be trivially fold/removeable, which does defeat the purpose of the tests.
Simon Pilgrim [Sat, 8 Jan 2022 14:57:00 +0000 (14:57 +0000)]
[X86] LowerRotate - enable ROTL vXi16 rotate-by-splat-amount on pre-AVX targets
To enable this on all targets there's still a number of regressions due to getSplatValue/getTargetVShiftNode but these don't really affect pre-AVX targets.
Simon Pilgrim [Sat, 8 Jan 2022 14:30:10 +0000 (14:30 +0000)]
[DivergenceAnalysis] Simplify inRegion test based on whether the RegionLoop pointer is null or not
More closely matches the documentation
Requested by @nikic
Simon Pilgrim [Sat, 8 Jan 2022 14:26:09 +0000 (14:26 +0000)]
[CGExpr] Use castAs<> instead of getAs<> to avoid dereference of nullptr
This will assert the cast is correct instead of returning nullptr
Simon Pilgrim [Sat, 8 Jan 2022 13:57:33 +0000 (13:57 +0000)]
[DivergenceAnalysis] Fix static analyzer warning about dereference of nullptr
We're testing that the RegionLoop pointer is null in the first part of the check, so we need to check that its non-null before dereferencing it in a later part of the check.
Simon Pilgrim [Sat, 8 Jan 2022 13:47:35 +0000 (13:47 +0000)]
[OpenMPOpt] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr. NFC
Simon Pilgrim [Sat, 8 Jan 2022 12:19:25 +0000 (12:19 +0000)]
[X86][SSE] Add initial FSHL/FSHR vXi8 lowering support
This is very similar to the existing ROTL/ROTR support for scalar shifts in LowerRotate, I think as time goes on we should be able to share much of this code in helpers between Funnel Shift + Rotation lowering.
Uday Bondhugula [Mon, 27 Dec 2021 19:12:14 +0000 (00:42 +0530)]
Multiple fixes to affine loop tiling return status and checks
Fix crash in the presence of yield values. Multiple fixes to affine loop
tiling pre-condition checks and return status. Do not signal pass
failure on a failure to tile since the IR is still valid. Detect index
set computation failure in checkIfHyperrectangular and return failure.
Replace assertions with proper status return. Move checks to an
appropriate place earlier in the utility before mutation happens.
Differential Revision: https://reviews.llvm.org/D116738
Florian Hahn [Sat, 8 Jan 2022 10:29:19 +0000 (10:29 +0000)]
[SCEVExpander] Skip creating <u 0 check, which is always false.
Unsigned compares of the form <u 0 are always false. Do not create such
a redundant check in generateOverflowCheck.
The patch introduces a new lambda to create the check, so we can
exit early conveniently and skip creating some instructions feeding the
check.
I am planning to sink a few additional instructions as follow-ups, but I
would prefer to do this separately, to keep the changes and diff
smaller.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D116811
Groverkss [Sat, 8 Jan 2022 10:08:30 +0000 (15:38 +0530)]
[MLIR][NFC] Move PresburgerSet to Presburger/ directory
This patch moves PresburgerSet to Presburger/ directory. This patch is purely
mechincal, it only moves and renames functionality and tests.
This patch is part of a series of patches to move presburger functionality to
Presburger/ directory.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D116836
Jay Foad [Fri, 7 Jan 2022 12:19:49 +0000 (12:19 +0000)]
[GlobalISel] Use getPreferredShiftAmountTy in one more G_UBFX combine
Change CombinerHelper::matchBitfieldExtractFromShrAnd to use
getPreferredShiftAmountTy for the shift-amount-like operands of G_UBFX
just like all the other G_[SU]BFX combines do. This better matches the
AMDGPU legality rules for these instructions.
Differential Revision: https://reviews.llvm.org/D116803
Jay Foad [Fri, 7 Jan 2022 11:44:49 +0000 (11:44 +0000)]
[GlobalISel] Fix legality checks for G_UBFX combines
1. Fix CombinerHelper::matchBitfieldExtractFromAnd to check legality
with the correct types for the G_UBFX that it builds.
2. Fix AMDGPUTargetLowering::isConstantUnsignedBitfieldExtractLegal to
match the legality rules: result and first operand can be s32 or s64
but the "shift amount" operands are always s32.
3. Add AMDGPU tests where the post-legalizer combiner would create
illegal MIR without the above fixes.
Differential Revision: https://reviews.llvm.org/D116802
Christian Sigg [Fri, 7 Jan 2022 21:44:41 +0000 (22:44 +0100)]
Fix GDB printers test
- Prevent symbols from being stripped so that it can run with 'RelWithDebInfo'.
- Adjust llvm-support CHECKs after code changes.
- Polish mlir-support CHECKs as suggested in https://reviews.llvm.org/D116646.
Differential Revision: https://reviews.llvm.org/D116837
Lang Hames [Sat, 8 Jan 2022 06:46:14 +0000 (17:46 +1100)]
[ORC-RT] Add missing headers from
1d82e19f37d.
This should fix the build failure at
https://lab.llvm.org/buildbot/#/builders/165/builds/12997
Lang Hames [Wed, 22 Dec 2021 02:58:43 +0000 (13:58 +1100)]
[ORC-RT] Add debug logging macros.
Inspired by LLVM_DEBUG, but using environment variables rather than command line
options.
Code can use ORC_RT_DEBUG(...) (if ORC_RT_DEBUG_TYPE is set), or
ORC_RT_DEBUG_WITH_TYPE(<type>, ...) (if ORC_RT_DEBUG_TYPE is not set. E.g. in
headers).
Debug logging is enabled in the executor by setting the ORC_RT_DEBUG environment
variable. Debug logging can be restricted by type by setting the
ORC_RT_DEBUG_TYPES environment variable to a comma separated list of types,
e.g. ORC_RT_DEBUG_TYPES=macho_platform,sps.
Differential Revision: https://reviews.llvm.org/D116139
Lang Hames [Sat, 8 Jan 2022 06:26:48 +0000 (17:26 +1100)]
[ORC] Add missing header from
089acf25223.
Lang Hames [Sat, 8 Jan 2022 01:08:06 +0000 (12:08 +1100)]
[ORC][JITLink] Merge JITLink AllocActionCall and ORC WrapperFunctionCall.
These types performed identical roles. Merging them simplifies interoperability
between JITLink and ORC APIs (allowing us to address a few FIXMEs).
Kazu Hirata [Sat, 8 Jan 2022 05:20:36 +0000 (21:20 -0800)]
[Target] use range-based for loops (NFC)
owenca [Sat, 8 Jan 2022 05:09:54 +0000 (21:09 -0800)]
[clang-format][NFC] Fix a bug in getPreviousToken() in the parser
Differential Revision: https://reviews.llvm.org/D116318
Tanya Lattner [Sat, 8 Jan 2022 04:24:35 +0000 (20:24 -0800)]
Add first draft of the discourse migration guide.
Craig Topper [Sat, 8 Jan 2022 03:50:44 +0000 (19:50 -0800)]
[RISCV] Add a command line option to control the LMUL used by TTI's getRegisterBitWidth.
By default we return the width of an LMUL=1 register. We can enable
testing with larger LMUL values by returning a larger bit width.
This patch adds a RISCV specific option to provide a LMUL which will be
multiplied by the LMUL=1 bit width.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D116339
Kazu Hirata [Sat, 8 Jan 2022 04:00:34 +0000 (20:00 -0800)]
[llvm] Remove unused forward declarations (NFC)
Kito Cheng [Mon, 3 Jan 2022 07:32:49 +0000 (15:32 +0800)]
[RISCV] Set getMinVectorRegisterBitWidth to 16 if enable fixed length vector code gen for RVV
getMinVectorRegisterBitWidth means what vector types is supported in
this target, and actually RISC-V support all fixed length vector types with
vector length less than `getMinRVVVectorSizeInBits`, so set it to 16,
means 2 x i8, that is minimal fixed length vector size in theory.
That also fixed one issue, some testcase migth become non-vectorizable
when `-riscv-v-vector-bits-min` set to larger value, because the vector size is
smaller than `-riscv-v-vector-bits-min`.
For example, following code can vectorize by SLP with
`-riscv-v-vector-bits-min=128` or `-riscv-v-vector-bits-min=256`, but
can't vectorize `-riscv-v-vector-bits-min=512` or larger:
```
void foo(double *da) {
da[0] = 0;
da[1] = 1;
da[2] = 2;
da[3] = 3;
}
```
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116534
Jun Zhang [Sat, 8 Jan 2022 02:36:09 +0000 (10:36 +0800)]
[NFC] Test commit.
This is just a test commit to check whether the permission I got is
correct or not.
Mehdi Amini [Sat, 8 Jan 2022 01:40:24 +0000 (01:40 +0000)]
Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set
a32300a changed it to create a ThreadPool eagerly so that it gets reused
across buffers, however it also made it so that we create a ThreadPool
early even if we're not gonna use it later because of the command line
option `--mlir-disable-threading` is provided.
Fix #53056
Reland
45adf608024 after build fixes
Differential Revision: https://reviews.llvm.org/D116848
Mehdi Amini [Sat, 8 Jan 2022 02:23:30 +0000 (02:23 +0000)]
Revert "Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set"
This reverts commit
45adf608024655d3594993d041af9602da41780f.
Build is broken
Nico Weber [Sat, 8 Jan 2022 02:19:01 +0000 (21:19 -0500)]
[gn build] (manually) port
feeff8a37c35
This reverts commit
3ca69283442183d71f13700d860f5912b631bcb0.
492de35df44 relanded in
feeff8a37c35.
The reland only uses CMAKE_INSTALL_INCLUDEDIR and not CMAKE_INSTALL_BINDIR
in llvm-config, so this reland reflects that.
John Demme [Sat, 8 Jan 2022 01:56:57 +0000 (01:56 +0000)]
[MLIR] Fix compilation with LLVM_ENABLE_THREADS=OFF
Currently, compiles with LLVM_ENABLE_THREADS=OFF fail due to this symbol missing. Add it but assert as calling code is (and should be) checking that threading is enabled.
Differential Revision: https://reviews.llvm.org/D116846
Mehdi Amini [Sat, 8 Jan 2022 01:40:24 +0000 (01:40 +0000)]
Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set
a32300a changed it to create a ThreadPool eagerly so that it gets reused
across buffers, however it also made it so that we create a ThreadPool
early even if we're not gonna use it later because of the command line
option `--mlir-disable-threading` is provided.
Fix #53056
Differential Revision: https://reviews.llvm.org/D116848
Ben Wagner [Sat, 8 Jan 2022 01:34:05 +0000 (17:34 -0800)]
[libc++] Disable coverage with sanitize-coverage=0
When building libcxx, libcxxabi, and libunwind the build environment may
specify any number of sanitizers. For some build feature tests these
sanitizers must be disabled to prevent spurious linking errors. With
-fsanitize= this is straight forward with -fno-sanitize=all. With
-fsanitize-coverage= there is no -fno-sanitize-coverage=all, but there
is the equivalent undocumented but tested -fsanitize-coverage=0.
The current build rules fail to disable 'trace-pc-guard'. By disabling
all sanitize-coverage flags, including 'trace-pc-guard', possible
spurious linker errors are prevented. In particular, this allows libcxx,
libcxxabi, and libunwind to be built with HonggFuzz.
CMAKE_REQUIRED_FLAGS is extra compile flags when running CMake build
configuration steps (like check_cxx_compiler_flag). It does not affect
the compile flags for the actual build of the project (unless of course
these flags change whether or not a given source compiles and links or
not). So libcxx, libcxxabi, and libunwind will still be built with any
specified sanitize-coverage as before. The build configuration steps
(which are mostly checking to see if certain compiler flags are
available) will not try to compile and link "int main() { return 0;}"
(or other specified source) with sanitize-coverage (which can fail to
link at this stage in building, since the final compile flags required
are yet to be determined).
The change to LIBFUZZER_CFLAGS was done to keep it consistent with the
obvious intention of disabling all sanitize-coverage. This appears to
be intentional, preventing the fuzzer driver itself from showing up in
any coverage calculations.
Reviewed By: #libunwind, #libc, #libc_abi, ldionne, phosek
Differential Revision: https://reviews.llvm.org/D116050
Kazu Hirata [Sat, 8 Jan 2022 01:45:09 +0000 (17:45 -0800)]
[llvm] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
Julian Lettner [Sat, 8 Jan 2022 01:35:52 +0000 (17:35 -0800)]
[Darwin][Sanitizer] Lower Python requirement for iOS simulator testing
Lower Python requirements: 3.7 -> 3.6
Workaround introduced in:
ebd8eee62a431a6744c3f187fcda58e5dea08499
Vitaly Buka [Fri, 7 Jan 2022 18:30:50 +0000 (10:30 -0800)]
Don't pass uninitialized QueryKind
Even if findImplementors does not use
uninitialized parameter it's still UB and
it's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116827
Julian Lettner [Sat, 8 Jan 2022 00:47:37 +0000 (16:47 -0800)]
[Darwin] Apply workaround to make symbolication in iOS simulators work
Specify `ASAN_SYMBOLIZER_PATH` when running simulator tests. This will
unblock simulator testing in GreenDragon (Apple's open source testing).
John Ericson [Sat, 11 Dec 2021 01:36:24 +0000 (01:36 +0000)]
[llvm] Use `GNUInstallDirs` to support custom installation dirs
This is the patch for LLVM proper in my series for adding GNUInstallDirs support in all project.
Additionally:
Create a new `CACHE STRING` variable, `LLVM_EXAMPLES_INSTALL_DIR`, to control where the examples are installed on analogy with the other variables.
---
This patch supersedes D28234, which tried to do the same thing but hand-rolled without GNUInstallDirs.
This patch nearly reverts commit 3
0fc88bf1dc15a72e2d9809d28019d386b7a7cc0, which was a revert of a prior attempt."
(I had to add a space here or else Phabricator detects a reference cycle and won't let me do the form submit.)
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D100810
Yuanfang Chen [Sat, 8 Jan 2022 00:34:38 +0000 (16:34 -0800)]
[CMake][WinMsvc] Fix user passed compiler/linker flags
Users could pass flags by environment variables like CFLAGS/CXXFLAGS/LDFLAGS
or by using CMAKE_<LANG>_FLAGS_INIT/CMAKE_<t>_LINKER_FLAGS_INIT. So this
toolchain file should append to INIT flags instead. Otherwise, user
flags would be discarded here by assigning to CMAKE_<LANG>_FLAGS
directly.
Reviewed By: smeenai, mstorsjo
Differential Revision: https://reviews.llvm.org/D116709
Walter Erquinigo [Fri, 17 Dec 2021 22:33:54 +0000 (14:33 -0800)]
[formatters] Improve documentation
This adds some important remarks to the data formatter documentation.
Differential Revision: https://reviews.llvm.org/D115974
Jonas Devlieghere [Fri, 7 Jan 2022 23:25:20 +0000 (15:25 -0800)]
[lldb] Remove lldbconfig module
The lldbconfig module was necessary to run the LLDB test suite against a
reproducer. Since this functionality has been removed, the module is no
longer necessary.
John Ericson [Sat, 1 Jan 2022 01:20:32 +0000 (01:20 +0000)]
Make separate config variable for `LLVM_LIBRARY_DIRS`
@beanz tells me it should in fact exists, and it would be bad to put a
list of dirs in `LLVM_LIBRARY_DIR`. I am therefore making some changes
to help avoid this an other mistakes:
- Use a separate `LLVM_CONFIG_LIBRARY_DIR` (no "S") variable so we don't
start putting a list in `LLVM_LIBRARY_DIR` by mistake.
- Define the individual dir variables first, and the define the list of
dirs variables programmatically.
Also, I rearranged the definitions of the "regular" single dirs below so
`LLVM_BINARY_DIR`, which is the unsuffixed one, comes first before the
suffixed ones.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D116497
Baoshan Pang [Fri, 7 Jan 2022 23:29:22 +0000 (15:29 -0800)]
[RISCV] Materializing constants with 'rori'
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116574
Vitaly Buka [Fri, 7 Jan 2022 18:36:47 +0000 (10:36 -0800)]
Initialize output parameter
Or code like this have UB passing uninitialized CmpValue:
```
int64_t CmpMask, CmpValue;
if (!TII->analyzeCompare(MI, SrcReg, SrcReg2, CmpMask, CmpValue))
return false;
if (TII->optimizeCompareInstr(MI, SrcReg, SrcReg2, CmpMask, CmpValue, MRI)) {
```
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116831
Vitaly Buka [Fri, 7 Jan 2022 18:36:01 +0000 (10:36 -0800)]
Initialize ExtAddrMode::Scale
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116830
Vitaly Buka [Fri, 7 Jan 2022 18:35:22 +0000 (10:35 -0800)]
Initialize fields of TypeRecord subclasses
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116829
Vitaly Buka [Fri, 7 Jan 2022 18:32:24 +0000 (10:32 -0800)]
Initialize HighlightingsBuilder::Resolver
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116828
Vitaly Buka [Fri, 7 Jan 2022 18:22:35 +0000 (10:22 -0800)]
Initialize output parameters
If the function returns true, it should
set all output paremeters, similar to Output::preflightElement, or we
have UB on code like:
```
void *SaveInfo;
if (io.preflightFlowElement(i, SaveInfo))
io.postflightFlowElement(SaveInfo);
```
It's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1
Differential Revision: https://reviews.llvm.org/D116826
Sumanth Gundapaneni [Fri, 7 Jan 2022 22:42:54 +0000 (14:42 -0800)]
[Hexagon] Reconize M2_mnaci in HexagonBitTracker
Amy Huang [Thu, 23 Dec 2021 23:09:30 +0000 (15:09 -0800)]
[-fms-extensions] Make some exception specification warnings/errors compatible with what cl.exe does
Make clang-cl error when a function definition is missing 'noexcept',
and succeed without warnings when missing '__declspec(nothrow)' or 'throw'.
Fixes pr52860
Differential Revision: https://reviews.llvm.org/D116256
Nick Desaulniers [Fri, 7 Jan 2022 22:10:57 +0000 (14:10 -0800)]
[Clang][CFG] check children statements of asm goto
When performing CFG based analyses, don't forget to check the child
statements of an asm goto, such as the expressions used for
inputs+outputs.
Fixes: https://github.com/llvm/llvm-project/issues/51024
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1439
Reviewed By: void, jyknight, jyu2, efriedma
Differential Revision: https://reviews.llvm.org/D116059
Philip Reames [Fri, 7 Jan 2022 21:55:32 +0000 (13:55 -0800)]
[MemoryBuiltin] Cleanup stale todo comments [NFC]
strdup/strndup are already partially implemented, move remaining comment to relevant place. Remaining named routines are copy routines and mostly handled via intrinsics already - they do not allocate new memory.
Jonas Devlieghere [Fri, 7 Jan 2022 21:34:06 +0000 (13:34 -0800)]
[lldb] Use lit_config.note to print module cache message
Groverkss [Fri, 7 Jan 2022 21:23:22 +0000 (02:53 +0530)]
[MLIR] Add IntegerPolyhedron::getUniverse
This operation already exists in FlatAffineConstraints but is added to
IntegerPolyhedron to keep consistancy in available methods.
Roman Lebedev [Fri, 7 Jan 2022 21:18:14 +0000 (00:18 +0300)]
[NFCI] `ScalarEvolution::getRangeRef()`: collapse `SCEVMinMaxExpr` handling
Arthur Eubanks [Fri, 7 Jan 2022 21:11:18 +0000 (13:11 -0800)]
Revert "[Inline] Attempt to delete any discardable if unused functions"
This reverts commit
335a3163aab4ab3a52c7c15d03bcf1ce9ba79fbb.
Causes crashes when building llvm-test-suite's kc under ReleaseLTO-g.
Krzysztof Parzyszek [Fri, 7 Jan 2022 20:45:22 +0000 (12:45 -0800)]
[Hexagon] Use map from HexagonDepArch instead of local one, NFC
Co-authored-by: Brian Cain <bcain@quicinc.com>
John Ericson [Sun, 2 Jan 2022 06:29:26 +0000 (06:29 +0000)]
[lld] Deprecate using llvm-config to detect llvm installation
This is continuing in the path of D51714, which did this for Clang.
I have rearranged the source code Clang so one can diff the top-level
CMakeLists.txt of Clang and LLD, ensuring we use the same strategy for
both.
Besides diffing the two files, `git diff --color-moved` on LLD also helps review.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D116492
Shafik Yaghmour [Fri, 7 Jan 2022 19:56:57 +0000 (11:56 -0800)]
[LLDB] Fix setting of success in Socket::Close()
Both close and closesocket should return 0 on success so using !! looks incorrect. I replaced this will a more readable == 0 check.
Differential Revision: https://reviews.llvm.org/D116768
Adrian Prantl [Fri, 7 Jan 2022 20:40:08 +0000 (12:40 -0800)]
Update DWARF fission extension attributes
This patch brings the transitional DWARF 4 + fission attributes up to date.
Patch by David Anderson!
Differential Review: https://reviews.llvm.org/D116065
Krzysztof Parzyszek [Fri, 7 Jan 2022 20:10:54 +0000 (12:10 -0800)]
[Hexagon] Extract condition into function, NFC
Co-authored-by: Brian Cain <bcain@quicinc.com>
Julian Lettner [Thu, 23 Dec 2021 06:30:46 +0000 (22:30 -0800)]
[ASan][Darwin] Avoid crash during ASan initialization
Always pass `depth=1` to `vm_region_recurse_64()`. `depth` is a in-out
parameter and gets reset to 0 after the first call, so we incorrectly
pass `depth=0` on subsequent calls.
We want to avoid the following crash:
```
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000180000000
Exception Codes: 0x0000000000000001, 0x0000000180000000
VM Region Info: 0x180000000 is not in any region. Bytes after previous region:
277577729 Bytes before following region:
384270336
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
Stack
16f64c000-
16f748000 [ 1008K] rw-/rwx SM=PRV thread 0
---> GAP OF 0x27730000 BYTES
unused shlib __TEXT
196e78000-
196eac000 [ 208K] r-x/r-x SM=COW ... this process
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [767]
```
Crashing code:
```
static mach_header *get_dyld_image_header() {
unsigned depth = 1;
vm_size_t size = 0;
vm_address_t address = 0;
kern_return_t err = KERN_SUCCESS;
mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
while (true) {
struct vm_region_submap_info_64 info;
err = vm_region_recurse_64(mach_task_self(), &address, &size, &depth,
(vm_region_info_t)&info, &count);
if (err != KERN_SUCCESS) return nullptr;
if (size >= sizeof(mach_header) && info.protection & kProtectionRead) {
mach_header *hdr = (mach_header *)address;
if ((hdr->magic == MH_MAGIC || hdr->magic == MH_MAGIC_64) && // << CRASH: sanitizer_procmaps_mac.cpp:176
hdr->filetype == MH_DYLINKER) {
return hdr;
}
}
address += size;
}
}
```
Radar-Id: rdar://problem/
86773501
Differential Revision: https://reviews.llvm.org/D116240
Krzysztof Parzyszek [Fri, 7 Jan 2022 20:21:02 +0000 (12:21 -0800)]
[Hexagon] Fix release build break after
547658567353d
John Ericson [Mon, 3 Jan 2022 02:25:06 +0000 (02:25 +0000)]
[CMake] Factor out config prefix finding logic
See the docs in the new function for details.
I think I found every instance of this copy pasted code. Polly could
also use it, but currently does something different, so I will save the
behavior change for a future revision.
We get the shared, non-installed CMake modules following the pattern
established in D116472.
It might be good to have LLD and Flang also use this, but that would be
a functional change and so I leave it as future work.
Reviewed By: beanz, lebedev.ri
Differential Revision: https://reviews.llvm.org/D116521
John Ericson [Mon, 3 Jan 2022 07:51:54 +0000 (07:51 +0000)]
[cmake] Add read-me for the common CMake utils
Now that I am adding more things there, I thought it prudent to document
what should and should not go there, and how it is used.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D116524
Michael Lambert [Fri, 7 Jan 2022 19:55:45 +0000 (11:55 -0800)]
[Hexagon] Duplex error: wrong branch hint
colinl [Fri, 7 Jan 2022 19:51:56 +0000 (11:51 -0800)]
[Hexagon] Consider direction hint forming dealloc_return duplex
Groverkss [Fri, 7 Jan 2022 19:52:29 +0000 (01:22 +0530)]
[MLIR][NFC] Move presburger functionality from FlatAffineConstraints to IntegerPolyhedron
This patch moves all presburger functionality from FlatAffineConstraints to
IntegerPolyhedron. This patch is purely mechanical, it only moves and renames
functionality and tests.
This patch is part of a series of patches to move presburger functionality to
Presburger/ directory.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D116681