Sanjay Patel [Mon, 1 Nov 2021 14:46:54 +0000 (10:46 -0400)]
[InstCombine] add tests for bitwise logic folds; NFC
Jinsong Ji [Mon, 1 Nov 2021 15:36:42 +0000 (15:36 +0000)]
[NFC][PowerPC] Update testcases using script
For D106555.
Kazu Hirata [Mon, 1 Nov 2021 15:31:54 +0000 (08:31 -0700)]
[X86] Remove X86ELFObjectWriter in X86AsmBackend.cpp (NFC)
Note that the identically named class is defined in an anonymous
namespace in X86ELFObjectWriter.cpp.
Jay Foad [Mon, 1 Nov 2021 15:29:35 +0000 (15:29 +0000)]
[AMDGPU] Use MachineInstrBuilder::addReg. NFC.
Weiwei Li [Mon, 1 Nov 2021 14:47:47 +0000 (22:47 +0800)]
[mlir][SPIRVToLLVM] Add shufflevector conversion
Add the shufflevector conversion. It only handles the static, i.e., IntegerAttr, index.
Co-authored: Xinyi Liu <xyliuhelen@gmail.com>
Reviewed by: antiagainst
Differential revision: https://reviews.llvm.org/D112161
Raphael Isemann [Mon, 1 Nov 2021 14:55:16 +0000 (15:55 +0100)]
[lldb] Add a test for class loading via member typedefs
This is currently only tested indirectly in the huge stdlibc++ formatter tests.
Jay Foad [Mon, 1 Nov 2021 14:23:58 +0000 (14:23 +0000)]
[AMDGPU] Add tests for legacy multiply-add with immediate
Louis Dionne [Fri, 29 Oct 2021 15:12:21 +0000 (11:12 -0400)]
[libc++] Refactor num_put::do_put to reduce duplication
I was going to make a change in that area of the code and I noticed that
we basically duplicated the same code 5 times to handle integral types
and floating point types. This commit simply pulls the duplication into
a function.
Differential Revision: https://reviews.llvm.org/D112830
Jay Foad [Mon, 1 Nov 2021 09:45:46 +0000 (09:45 +0000)]
[AMDGPU] Shrink v_mac_legacy_f32 and v_fmac_legacy_f32
Differential Revision: https://reviews.llvm.org/D112917
Jinsong Ji [Mon, 1 Nov 2021 13:44:23 +0000 (13:44 +0000)]
[AIX][NFC] Unsupported object-c test
Matt Morehouse [Mon, 1 Nov 2021 13:29:34 +0000 (06:29 -0700)]
[HWASan] Apply TagMaskByte to every global tag.
Previously we only applied it to the first one, which could allow
subsequent global tags to exceed the valid number of bits.
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D112853
Matt Morehouse [Mon, 1 Nov 2021 13:22:48 +0000 (06:22 -0700)]
[sanitizer] Disable posix_spawn.c test on Android.
Sanjay Patel [Sun, 31 Oct 2021 16:50:05 +0000 (12:50 -0400)]
[InstCombine] allow vector splat matching for bitwise logic folds
This fold was added long ago (part of fixing PR4216),
and it matched scalars only. Intermediate folds have
been added subsequently, so extra uses are required
to exercise this code.
General proof:
https://alive2.llvm.org/ce/z/G6BBhB
One of the specific tests:
https://alive2.llvm.org/ce/z/t0JhEB
Sanjay Patel [Sun, 31 Oct 2021 16:12:37 +0000 (12:12 -0400)]
[InstCombine] reduce code duplication with commutative matcher; NFC
Sanjay Patel [Sun, 31 Oct 2021 15:46:18 +0000 (11:46 -0400)]
[InstCombine] add tests for bitwise logic folds; NFC
The extra uses are needed to prevent intermediate folds.
Without that, there would be no coverage currently.
The vector tests show an artificial limitation in the code.
Dmitry Makogon [Mon, 1 Nov 2021 11:51:30 +0000 (18:51 +0700)]
[Test] Fix tests showing generation of already existent PHIs by GVN
This is a fix for tests added by
96591a14cd25bc30519c293efa8e01b4c7e869f6.
A function which was called in tests wasn't marked as 'readonly', and the
GVN performed PRE for the loads, but they were supposed to be non-local.
So added 'readonly' to the called function.
Mubashar Ahmad [Mon, 1 Nov 2021 11:55:24 +0000 (11:55 +0000)]
[AArch64] Enablement of Cortex-X2
Enables support for Cortex-X2 cores.
Differential Revision: https://reviews.llvm.org/D112459
Simon Pilgrim [Mon, 1 Nov 2021 11:11:00 +0000 (11:11 +0000)]
[CostModel][X86] Remove old FIXME comments for AVX512F vector splitting
Similar to AVX1, the cost of splitting/merging 512-bit -> 256-bits vectors for arithmetic operations are typically hidden due to different used ports etc.
gbreynoo [Mon, 1 Nov 2021 11:04:37 +0000 (11:04 +0000)]
[llvm-dwarfdump] Improve testing of --summarize-types
Differential Revision: https://reviews.llvm.org/D112151
Simon Pilgrim [Mon, 1 Nov 2021 10:45:50 +0000 (10:45 +0000)]
[X86][AVX] Prefer VINSERTF128 over VPERM2F128 for 128->256 subvector concatenations
The VINSERTF128 instruction is often much quicker, and never slower, than the more general VPERM2F128 instruction, so we should try to use that in more circumstances.
This requires a fallback to a commuted VPERM2F128 for the case where we need to fold the 256-bit vector source instead of the 128-bit subvector source.
There is one interesting side effect - DAGCombine's narrowExtractedVectorLoad combine gets called in a number of locations, this often creates an extracted subvector load without regard to other uses of the original wider load. I'm expecting AVX cpus to be capable of merging such aliased loads, but I do wonder whether narrowExtractedVectorLoad's call to X86TargetLowering::shouldReduceLoadWidth needs to be altered to check for more partial uses?
Noticed while investigating the quality of interleaved load/store codegen.
Differential Revision: https://reviews.llvm.org/D111960
David Sherwood [Wed, 27 Oct 2021 10:40:01 +0000 (11:40 +0100)]
[LoopVectorize] Change getRuntimeVFAsFloat to use unsigned int->FP conversion
We never expect the runtime VF to be negative so we should use
the uitofp instruction instead of sitofp.
Differential revision: https://reviews.llvm.org/D112610
Diana Picus [Wed, 27 Oct 2021 09:09:31 +0000 (09:09 +0000)]
[flang] Implement GET_ENVIRONMENT_VARIABLE(VALUE)
Implement the second entry point for GET_ENVIRONMENT_VARIABLE. Reuse
existing bits and pieces wherever possible.
This patch also increases CFI_* error codes in order to avoid conflicts.
GET_ENVIRONMENT_VARIABLE is required to return a status of 1 if an
environment variable does not exist and 2 if environment variables are
not supported. However, if we add status codes for that they will
conflict with CFI_ERROR_BASE_ADDR_NULL and CFI_ERROR_BASE_ADDR_NOT_NULL,
which are also 1 and 2 at the moment. We therefore move all CFI error
codes up (an arbitrary) 10 spots to make room. Hopefully this isn't
a problem, since we weren't matching the CFI error codes that gfortran
uses anyway. It may still be an issue if any other runtime functions
will need to return a status of 1 or 2, but we should probably deal with
that when/if it occurs.
Differential Revision: https://reviews.llvm.org/D112698
Yi Kong [Mon, 1 Nov 2021 09:14:19 +0000 (17:14 +0800)]
Revert "[opt-viewer] Use safe yaml load_all"
This reverts commit
1123e03a9d9401c5203ae55bff533dd4d133d8d2.
Broken on the AIX platform.
Roman Lebedev [Fri, 6 Nov 2020 11:06:00 +0000 (14:06 +0300)]
[CVP] Canonicalize signed relational comparisons of scalar integers to unsigned comparison predicates
Now that the reasoning was added to ConstantRange in D90924,
this replicates IndVars variant of this transform (D111836)
in a pass that uses value range reasoning for the transform.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D112895
Esme-Yi [Mon, 1 Nov 2021 08:43:32 +0000 (08:43 +0000)]
[XCOFF] [llvm-readobj] replace tests using binary as input
with tests generated by yaml2obj.
Summary: Because yaml2obj supports basic transforming for XCOFF,
some of the binary inputs used in the tests of llvm-readobj
can be replaced with yaml files.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D111699
Matthias Springer [Mon, 1 Nov 2021 08:15:12 +0000 (17:15 +0900)]
[ADT] Add Compare template param to EquivalenceClasses
This makes the class usable with types that do not provide their own operator<.
Update MLIR Linalg ComprehensiveBufferize to take advantage of the new template param.
Differential Revision: https://reviews.llvm.org/D112052
Jun Ma [Tue, 28 Sep 2021 08:53:27 +0000 (16:53 +0800)]
[Taildup] Don't tail-duplicate loop header with multiple successors as its latches
when Taildup hit loop with multiple latches like:
// 1 -> 2 <-> 3 |
// \ <-> 4 |
// \ <-> 5 |
// \---> rest |
it may transform this loop into multiple loops by duplicate loop header.
However, this change may has little benefit while makes cfg much complex.
In some uncommon cases, it causes large compile time regression (offered by
@alexfh in D106056).
This patch disable tail-duplicate of such cases.
TestPlan: check-llvm
Differential Revision: https://reviews.llvm.org/D110613
Jun Ma [Wed, 29 Sep 2021 02:28:29 +0000 (10:28 +0800)]
[TailDup] Add testcase for interpreter switch loop, NFC.
Jun Ma [Tue, 28 Sep 2021 01:44:00 +0000 (09:44 +0800)]
Revert "Revert "Recommit "Revert "[CVP] processSwitch: Remove default case when switch cover all possible values.""""
This reverts commit
3a998c06a8e93989319238e12b56a731198cc1c2.
David Carlier [Mon, 1 Nov 2021 07:18:43 +0000 (07:18 +0000)]
[sanitizer] msan build fix on non linux platforms
Kazu Hirata [Mon, 1 Nov 2021 05:58:56 +0000 (22:58 -0700)]
[AArch64] Remove unused declaration hasSwiftExtendedFrame (NFC)
Mogball [Fri, 29 Oct 2021 16:26:08 +0000 (16:26 +0000)]
[mlir][arith] `traits` need to be passed to parent op
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D112828
Max Kazantsev [Mon, 1 Nov 2021 04:36:47 +0000 (11:36 +0700)]
[SCEV][NFC] Factor out common API for getting unique operands of a SCEV
This function is used at least in 2 places, to it makes sense to make it separate.
Differential Revision: https://reviews.llvm.org/D112516
Reviewed By: reames
Chen Zheng [Mon, 1 Nov 2021 04:07:17 +0000 (04:07 +0000)]
[PowerPC] turn off chain commoning by default.
Fangrui Song [Mon, 1 Nov 2021 03:30:00 +0000 (20:30 -0700)]
[ELF] Simplify R_DTPREL. NFC
Itay Bookstein [Mon, 1 Nov 2021 03:00:57 +0000 (20:00 -0700)]
[Verifier] Add verification logic for GlobalIFuncs
Verify that the resolver exists, that it is a defined
Function, and that its return type matches the ifunc's
type. Add corresponding check to BitcodeReader, change
clang to emit the correct type, and fix tests to comply.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D112349
Zi Xuan Wu [Mon, 1 Nov 2021 02:06:56 +0000 (10:06 +0800)]
[CSKY] First patch to construct codegen infra and generate first add instruction
Ooops. It constructs codegen infra and provide only basic code to generate first add instruction successfully.
Differential Revision: https://reviews.llvm.org/D112206
Shoaib Meenai [Sat, 30 Oct 2021 23:45:06 +0000 (16:45 -0700)]
[MachO] Use error instead of fatal for missing -arch
`fatal` should only be used for malformed inputs according to
ErrorHandler.h; `error` is more appropriate for missing arguments,
accompanied by a check to bail out early in case of the error. Some
tests need to be adjusted accordingly.
Makes `lld/test/MachO/arch.s` pass with `LLD_IN_TEST=2`.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D112879
Shoaib Meenai [Sat, 30 Oct 2021 23:49:20 +0000 (16:49 -0700)]
[TimeProfiler] Reset variable to nullptr
Otherwise we'll hit a spurious assert failure when we reset and then
reinitialize TimeProfiler on the same thread, as can happen when e.g.
using LLD as a library and running it multiple times in the same
process.
Makes `lld/test/MachO/time-trace.s` pass with `LLD_IN_TEST=2`, which
runs the linker twice in the same process and exposed the issue.
Reviewed By: MaskRay, mehdi_amini
Differential Revision: https://reviews.llvm.org/D112880
Shoaib Meenai [Sat, 30 Oct 2021 23:35:30 +0000 (16:35 -0700)]
[MachO] Properly reset global state
We need to reset global state between runs, similar to the other ports.
There's some file-static state which needs to be reset as well and we
need to add some new helpers for that.
With this change, most LLD Mach-O tests pass with `LLD_IN_TEST=2` (which
runs the linker twice on each test). Some tests will be fixed by the
remainder of this stack, and the rest are fundamentally incompatible
with that mode (e.g. they intentionally throw fatal errors).
Fixes PR52070.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D112878
Nico Weber [Sat, 30 Oct 2021 15:22:55 +0000 (11:22 -0400)]
[lld/coff] Add parsing for /pdbpagesize: flag
It's not used for anything yet, but we now accept `/pdbpagesize:4096`
(the default behavior) and we give arguably more useful diagnostics
for other values.
It's plumbed through to the MSF layer, so just uncommenting out
the bit in DriverUtils.cpp that rejects args other than 4096 is enough
to try other values.
Differential Revision: https://reviews.llvm.org/D112871
Fangrui Song [Sun, 31 Oct 2021 20:12:26 +0000 (13:12 -0700)]
[ELF] Replace "symbol '...' has no type" diagnostic with "relocation ... cannot be used against symbol '...'"
The "symbol 'foo' has no type" diagnostic tries to inform that copy
relocation/canonical PLT entry cannot be used, but the diagnostic is often
incorrect and confusing.
Roman Lebedev [Fri, 6 Nov 2020 11:06:00 +0000 (14:06 +0300)]
[ConstantRange] Sign-flipping of signedness-invariant comparisons
For certain combination of LHS and RHS constant ranges,
the signedness of the relational comparison predicate is irrelevant.
This implements complete and precise model for all predicates,
as confirmed by the brute-force tests. I'm not sure if there are
some more cases that we can handle here.
In a follow-up, CVP will make use of this.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D90924
Fangrui Song [Sun, 31 Oct 2021 19:38:36 +0000 (12:38 -0700)]
[ELF] Untangle R_GOT style TLS IE and processRelocAux. NFC
Vitaly Buka [Mon, 25 Oct 2021 00:17:39 +0000 (17:17 -0700)]
[NFC][sanitizer] Atomix relaxed in TwoLevelMap
This is NOOP in x86_64.
On arch64 it avoids Data Memory Barrier with visible improvements on micro benchmarks.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D112391
Vitaly Buka [Fri, 29 Oct 2021 08:39:03 +0000 (01:39 -0700)]
[sanitizer] Add posix_spawn interceptor
To make pid initialized for Msan.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D112784
Fangrui Song [Sun, 31 Oct 2021 19:10:42 +0000 (12:10 -0700)]
[ELF] Remove -Wl,-z,notext hint
The hint does not pull its weight:
* adding -Wl,-z,notext often won't work (relocation types other than `symbolRel`, e.g. `R_AARCH64_LDST32_ABS_LO12_NC`)
* for pure (no assembly) C/C++ projects, the "-fPIC" hint is sufficient
Lang Hames [Sun, 31 Oct 2021 17:52:43 +0000 (10:52 -0700)]
[ORC-RT] Add missing file that was left out of
ff846fcb64c.
Fangrui Song [Sun, 31 Oct 2021 17:46:42 +0000 (10:46 -0700)]
[ELF] Simplify isStaticLinkTimeConstant. NFC
Lang Hames [Sun, 31 Oct 2021 17:07:14 +0000 (10:07 -0700)]
[ORC][ORC-RT] Switch MachO EH/TLV registration from EPC-calls to alloc actions.
MachOPlatform used to make an EPC-call (registerObjectSections) to register the
eh-frame and thread-data sections for each linked object with the ORC runtime.
Now that JITLinkMemoryManager supports allocation actions we can use these
instead of an EPC call. This saves us one EPC-call per object linked, and
manages registration/deregistration in the executor, rather than the controller
process. In the future we may use this to allow JIT'd code in the executor to
outlive the controller object while still being able to be cleanly destroyed.
Since the code for allocation actions must be available when the actions are
run, and since the eh-frame registration code lives in the ORC runtime itself,
this change required that MachO eh-frame support be split out of
macho_platform.cpp and into its own macho_ehframe_registration.cpp file that has
no other dependencies. During bootstrap we start by forcing emission of
macho_ehframe_registration.cpp so that eh-frame registration is guaranteed to be
available for the rest of the bootstrap process. Then we load the rest of the
MachO-platform runtime support, erroring out if there is any attempt to use
TLVs. Once the bootstrap process is complete all subsequent code can use all
features.
Lang Hames [Sun, 31 Oct 2021 05:10:47 +0000 (22:10 -0700)]
[JITLink] Fix alloc action call signature in InProcessMemoryManager.
Alloc actions should return a CWrapperFunctionResult. JITLink does not have
access to this type yet, due to library layering issues, so add a cut-down
version with a fixme.
Craig Topper [Fri, 29 Oct 2021 16:52:36 +0000 (09:52 -0700)]
[RISCV] Expand scalable vector bswap. Fix crash for bitreverse.
Fix LegalizeVectorOps to not try shuffle or unrolling expansions for
scalable vectors.
Differential Revision: https://reviews.llvm.org/D112236
Kazu Hirata [Sun, 31 Oct 2021 14:57:36 +0000 (07:57 -0700)]
[CodeGen] Use make_early_inc_range (NFC)
Kazu Hirata [Sun, 31 Oct 2021 14:57:34 +0000 (07:57 -0700)]
[CodeGen, Target] Use MachineBasicBlock::terminators (NFC)
Kazu Hirata [Sun, 31 Oct 2021 14:57:32 +0000 (07:57 -0700)]
[Transforms] Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC)
Jake Egan [Sun, 31 Oct 2021 13:48:54 +0000 (09:48 -0400)]
[DWARF] Standardize checks and remove verbose where possible in DWARF tests
This patch removes the verbose option from tests that do not need it and simplifies the checks. For tests that do have the verbose option, the checks were standardized to be more readable and consistent.
Reviewed By: shchenz, dblaikie
Differential Revision: https://reviews.llvm.org/D112636
Jake Egan [Sun, 31 Oct 2021 13:32:56 +0000 (09:32 -0400)]
[AIX] Disable cfi-version test on AIX
`.debug_frame` is not emitted on AIX, so this patch disables the test.
Reviewed By: shchenz, jsji
Differential Revision: https://reviews.llvm.org/D112593
Alex Zinenko [Sun, 31 Oct 2021 08:37:20 +0000 (09:37 +0100)]
[mlir][python] allow for detaching operations from a block
Provide support for removing an operation from the block that contains it and
moving it back to detached state. This allows for the operation to be moved to
a different block, a common IR manipulation for, e.g., module merging.
Also fix a potential one-past-end iterator dereference in Operation::moveAfter
discovered in the process.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D112700
Matthias Springer [Sun, 31 Oct 2021 07:58:48 +0000 (16:58 +0900)]
[mlir][linalg][bufferize][NFC] Add bufferizesToAliasOnly
The list of operations that do neither read nor write, but create an alias when bufferizing inplace, is getting longer. This commit adds a helper function so that we do not have to spell out the entire list each time.
Differential Revision: https://reviews.llvm.org/D112515
Matthias Springer [Sun, 31 Oct 2021 07:52:27 +0000 (16:52 +0900)]
[mlir][linalg][bufferize] tensor::CastOp is an alias-only op
tensor::CastOp by itself does not bufferize to memory read/write.
Differential Revision: https://reviews.llvm.org/D112514
Fangrui Song [Sun, 31 Oct 2021 06:31:38 +0000 (23:31 -0700)]
[ELF] Make getImplicitAddend return 0 for R_ARM_V4BX. NFC
Will be useful if we move R_ARM_V4BX handling around.
Fangrui Song [Sun, 31 Oct 2021 04:58:43 +0000 (21:58 -0700)]
[ELF][Mips] Use R_DTPREL for R_MIPS_TLS_DTPREL*
Kazu Hirata [Sun, 31 Oct 2021 02:00:23 +0000 (19:00 -0700)]
[MachineCSE] Use make_early_inc_range (NFC)
Kazu Hirata [Sun, 31 Oct 2021 02:00:21 +0000 (19:00 -0700)]
[clang, llvm] Use Optional::getValueOr (NFC)
Kazu Hirata [Sun, 31 Oct 2021 02:00:19 +0000 (19:00 -0700)]
Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC)
Lang Hames [Sat, 30 Oct 2021 22:43:21 +0000 (15:43 -0700)]
[ORC] Move CWrapperFunctionResult out of the detail:: namespace.
This type has been moved up into the llvm::orc::shared namespace.
This type was originally put in the detail:: namespace on the assumption that
few (if any) LLVM source files would need to use it. In practice it has been
needed in many places, and will continue to be needed until/unless
OrcTargetProcess is fully merged into the ORC runtime.
Nico Weber [Sat, 30 Oct 2021 02:25:23 +0000 (22:25 -0400)]
[lld/mac] Fix mislink with ICF
When comparing relocations against two symbols, ICF's equalsConstant() did not
look at the value of the two symbols. With subsections_via_symbols, the value
is usually 0 but not always: In particular, it isn't 0 for constants in string
and literal sections. Since we ignored the value, comparing two constant string
symbols or two literal symbols always compared the 0th's element, so functions
in the same TU always compared as equal.
This can cause mislinks, and, with -dead_strip, crashes.
Fixes PR52349, see that bug for lots of details and examples of mislinks.
While here, make the existing assembly in icf-literals.s a bit more realistic
(use leaq instead of movq with strings, and use foo(%rip) instead of
foo@gotpcrel(%rip)). This has no interesting effect, it just maybe makes the
test look a bit less surprising.
Differential Revision: https://reviews.llvm.org/D112862
Danil Stefaniuc [Sat, 30 Oct 2021 21:48:26 +0000 (14:48 -0700)]
[formatters] Add a libstdcpp formatter for multiset and unify tests across stdlibs
This diff adds a data formatter for libstdcpp's multiset. Besides, it improves and unifies the tests for multiset for libcxx and libstdcpp for maintainability.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D112785
Frederic Cambus [Thu, 14 Oct 2021 12:36:12 +0000 (14:36 +0200)]
[clang][scan-build] Use uname -s to detect the operating system.
We only need the operating system name, not all information.
Differential Revision: https://reviews.llvm.org/D111797
Danil Stefaniuc [Sat, 30 Oct 2021 19:53:19 +0000 (12:53 -0700)]
[formatters] Add a libstdcpp formatter for multimap and unify modify tests across stdlibs
This diff adds a data formatter for libstdcpp's multimap. Besides, it improves and unifies the tests for multimap for libcxx and libstdcpp for maintainability.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D112752
Shilei Tian [Sat, 30 Oct 2021 18:43:59 +0000 (14:43 -0400)]
[OpenMP][DeviceRTL] Fixed an issue that causes hang in SU3
The synchronization at the end of parallel region cannot make sure all threads
exit the scope. As a result, the assertions right after it might be hit, and
further the `state::assumeInitialState(IsSPMD)` in `__kmpc_target_deinit` may
not hold as well. We either add a synchronization right after the parallel region,
or remove the assertions and assuptions. Here we choose the first one as those
assertions and assumptions can help optimizations.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D112861
Ludovic Jozeau [Sat, 30 Oct 2021 16:42:51 +0000 (17:42 +0100)]
[docs][clang-format] warn on \code block indentation error
There is an indentation issue in Format.h causing the html to not render correctly
It's a `\code` block in the documentation of SpacesInLineComment
- fix intentation of `SpacesInLineComment`
- warn on indentation error
- also warn on `\code` `\endcode` mismatch
- generate precise warnings
- fix some minor and style issues:
- avoid confusion with the built-in `type` function
- fix wrong print on `os.sys.stderr` (instead of `sys.stderr`)
- use `with as` pattern for files
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D112572
xndcn [Fri, 29 Oct 2021 14:45:18 +0000 (22:45 +0800)]
[mlir][spirv] Add conversions from arith.bitcast, std.br, std.cond_br to spirv.
Differential Revision: https://reviews.llvm.org/D112819
Erik Larsson [Sat, 30 Oct 2021 16:23:55 +0000 (17:23 +0100)]
[clang-format] Add --staged/--cached option to git-clang-format
When running git-clang-format in a pre-commit hook it's very useful to be able to tell git-clang-format to only look at the --staged/--cached files and not the working directory.
Note this patch is a rebase/fork from {D41147 } which is a fork of {D15465 }
Reviewed By: MyDeveloperDay, HazardyKnusperkeks, lodato
Differential Revision: https://reviews.llvm.org/D90996
Co-authored-by: Mark Lodato <lodato@google.com>
Kazu Hirata [Sat, 30 Oct 2021 15:43:43 +0000 (08:43 -0700)]
[Hexagon] Remove chksetELFHeaderEFlags (NFC)
The function was introduced without any use on Nov 9, 2015 in commit
7cd0892729801c45b170918159bc249bd9ee2b6b.
Kazu Hirata [Sat, 30 Oct 2021 15:43:41 +0000 (08:43 -0700)]
[Hexagon] Remove ValidArch (NFC)
This function seems to be unused for at least one year.
Kazu Hirata [Sat, 30 Oct 2021 15:43:39 +0000 (08:43 -0700)]
[Hexagon] Remove unused struct InstTy (NFC)
Roman Lebedev [Sat, 30 Oct 2021 14:36:23 +0000 (17:36 +0300)]
[NFCI] Introduce `ICmpInst::compare()` and use it where appropriate
As noted in https://reviews.llvm.org/D90924#inline-1076197
apparently this is a pretty common pattern,
let's not repeat it yet again, but have it in a common place.
There may be some more places where it could be used,
but these are the most obvious ones.
David Green [Sat, 30 Oct 2021 13:27:38 +0000 (14:27 +0100)]
[ValueTracking] Teach computeConstantRange that the maximum value of a half is 65504
The maximal value of a half is 0x7bff, which is 65504 when converted to
an integer. This patch teaches that to computeConstantRange to compute a
constant range with the correct maximum value.
https://alive2.llvm.org/ce/z/BV_Spb
https://alive2.llvm.org/ce/z/Nwuqvb
The maximum value for a float converted in the same way is 3.4e38, which
requires 129bits of data. I have not added that here as integer types so
larger are rare, compared to integers types larger than 17 bits require
for half floats.
The MVE tests change because instsimplify happens to be run as a part of
the backend, where it doesn't tend to for other backends.
Differential Revision: https://reviews.llvm.org/D112694
Groverkss [Sat, 30 Oct 2021 12:09:03 +0000 (17:39 +0530)]
[MLIR] FlatAffineConstraints: Ensure dimensionalities match when calling mergeLocalIds
This patch reorders mergeLocalIds usage to merge locals only after number of
dimensions and symbols are same. This does not change any functionality
because it does not matter in what order identifiers are merged, since
the reason to do it is to ensure that two FACs are aligned.
The order ensured in this patch simplifies a subsequent patch to improve
mergeLocalIds which requires dimensions and symbols to be aligned.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D112841
Raphael Isemann [Sat, 30 Oct 2021 11:29:36 +0000 (13:29 +0200)]
[lldb][NFC] Modernize for-loops in ModuleList
Reviewed By: mib
Differential Revision: https://reviews.llvm.org/D112379
Raphael Isemann [Sat, 30 Oct 2021 11:22:48 +0000 (13:22 +0200)]
[lldb] Make SBType::IsTypeComplete more consistent by forcing the loading of definitions
Currently calling SBType::IsTypeComplete returns true for record types if and
only if the underlying record in our internal Clang AST has a definition.
The function however doesn't actually force the loading of any external
definition from debug info, so it currently can return false even if the type is
actually defined in a program's debug info but LLDB hasn't lazily created the
definition yet.
This patch changes the behaviour to always load the definition first so that
IsTypeComplete now consistently returns true if there is a definition in the
module/target.
The motivation for this patch is twofold:
* The API is now arguably more useful for the user which don't know or care
about the internal lazy loading mechanism of LLDB.
* With D101950 there is no longer a good way to ask a Decl for a definition
without automatically pulling in a definition from the ExternalASTSource. The
current behaviour doesn't seem useful enough to justify the necessary
workarounds to preserve it for a time after D101950.
Note that there was a test that used this API to test lazy loading of debug info
but that has been replaced with TestLazyLoading by now (which just dumps the
internal Clang AST state instead).
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D112615
Raphael Isemann [Sat, 30 Oct 2021 11:13:57 +0000 (13:13 +0200)]
[lldb] Update field offset/sizes when encountering artificial members such as vtable pointers
`DWARFASTParserClang::ParseSingleMember` turns DWARF DIEs that describe
struct/class members into their respective Clang representation (e.g.,
clang::FieldDecl). It also updates a record of where the last field
started/ended so that we can speculatively fill any holes between a field and a
bitfield with unnamed bitfield padding.
Right now we are completely ignoring 'artificial' members when parsing the DWARF
of a struct/class. The only artificial member that seems to be emitted in
practice for C/C++ seems to be the vtable pointer.
By completely skipping both the Clang AST node creation and the updating of the
last-field record, we essentially leave a hole in our layout with the size of
our artificial member. If the next member is a bitfield we then speculatively
fill the hole with an unnamed bitfield. During CodeGen Clang inserts an
artificial vtable pointer into the layout again which now occupies the same
offset as the unnamed bitfield. This later brings down Clang's
`CGRecordLowering::insertPadding` when it checks that none of the fields of the
generated record layout overlap.
Note that this is not a Clang bug. We explicitly set the offset of our fields in
LLDB and overwrite whatever Clang makes up.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D112697
Christudasan Devadasan [Fri, 22 Oct 2021 11:20:05 +0000 (07:20 -0400)]
GlobalISel/Utils: Use incoming regbank while constraining the superclasses
Register operands with superclasses can possibly have multiple regBanks
if they have different register types. The regBank ambiguity resolved
during regbankselect should be used to constrain the operand regclass
instead of obtaining one from the MCInstrDesc.
This is a prerequisite patch for D109300 that introduces allocatable AV_*
Superclasses for AMDGPU by combining both VGPRs and AGPRs and we want to
restrain the regclass to either A or V based on the incoming regbank.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D112323
Raphael Isemann [Sat, 30 Oct 2021 11:00:07 +0000 (13:00 +0200)]
[ASTImporter] Remove ASTNodeImporter::IsStructuralMatch overload for EnumConstantDecl
1. Moves the check to ASTStructuralEquivalence.cpp like all the other checks.
2. Adds the missing checks for identifier and init expression. Also add the
respective tests for that stuff.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D112804
David Green [Sat, 30 Oct 2021 11:08:17 +0000 (12:08 +0100)]
[ARM] Add some fp convert with saturate MVE tests. NFC
Nikolas Klauser [Sat, 30 Oct 2021 10:53:10 +0000 (12:53 +0200)]
[libc++] reformatted test_allocator.h
reformatted test_allocator.h by request of @ldionne for D110994
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D112219
Mark de Wever [Sat, 23 Oct 2021 12:57:47 +0000 (14:57 +0200)]
[libc++][format] Mark LWG-issues as complete.
Most of the code has been implemented using the eel.is draft. It seems
some issues were inplemented but not marked as completed yet.
Note the wording of LWG-3372 has been implemented, but has been changed
in the current draft due to P2216, see D110494.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D112363
Mark de Wever [Sat, 23 Oct 2021 12:29:10 +0000 (14:29 +0200)]
[libc++][format] Use preferred_name attribute.
This was suggested by @vitaut in D110494.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D112362
Mark de Wever [Thu, 28 Oct 2021 15:48:27 +0000 (17:48 +0200)]
[libc++] Update clang-format to C++20.
We now use clang-format-13 which has the option SpacesInAngles. This
allows us to switch the default language version to C++20, which should
avoid breaking code when formatting due to the adding of whitespace.
For example `u8"foo"` no longer is formatted as `u8 "foo"`.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D112728
Mark de Wever [Thu, 28 Oct 2021 15:41:35 +0000 (17:41 +0200)]
[libc++] Remove Clang-11 support.
Since we no longer officially support Clang 11 remove the work-arounds
for this version.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D112727
David Green [Sat, 30 Oct 2021 08:06:21 +0000 (09:06 +0100)]
[InstCombine] Fix type of constant in canonicalizeClampLike
As a followup to D108049, one of the constants could now be generated
with an incorrect type, now that the input could be truncated.
Kazu Hirata [Sat, 30 Oct 2021 03:26:09 +0000 (20:26 -0700)]
Ensure newlines at the end of files (NFC)
Kazu Hirata [Sat, 30 Oct 2021 03:26:07 +0000 (20:26 -0700)]
Use {DenseSet,SmallPtrSet}::contains (NFC)
Lang Hames [Sat, 30 Oct 2021 03:06:03 +0000 (20:06 -0700)]
[ORC] Move all pass config into MachOPlatformPlugin::modifyPassConfig.
NFC, this just makes it easier to see and reason about pass ordering.
Vladimir Vereschaka [Sat, 30 Oct 2021 01:26:10 +0000 (18:26 -0700)]
[CMake] Update Cmake cache file for Win to ARM Linux cross builds. NFC
Workaround to fix broken remote execution for the libunwind tests.
https://reviews.llvm.org/D112082
wren romano [Fri, 29 Oct 2021 23:03:59 +0000 (16:03 -0700)]
[mlir][sparse] Improve handling of dynamic-sizes for sparse=>dense conversion
Allows the result to be more dynamically-sized than the source.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D112854
Phoebe Wang [Fri, 29 Oct 2021 23:59:19 +0000 (07:59 +0800)]
[X86][NFC] Pre-commit test to show prolog insert problem
Duncan P. N. Exon Smith [Fri, 29 Oct 2021 23:50:10 +0000 (16:50 -0700)]
Support: Remove sys::path::is_style_native()
Remove sys::path::is_style_native(), which was added alongside
is_style_windows() and is_style_posix().
Thinking a bit about the windows forward-slash style variant in
https://reviews.llvm.org/D111879, it's not clear to me how the new
sys::path::is_style_native() should behave for them.
- Should it return true for both `windows_slash` and
`windows_backslash`?
- Should it return true for only one of them?
I can think of hypothetical uses and justifications for either one, and
I could also imagine clients guessing either behaviour when just looking
at the function name in code.
Call sites will probably be more clear if they don't use this function,
and instead write out the code:
```
// Is "S" the coarse-grained native style?
if (is_style_windows(S) == is_style_windows(Style::native))
// Is "S" the fine-grained native style?
if (is_style_windows(S) == is_style_windows(Style::native) &&
preferred_separator(S) == preferred_separator(Style::native))
```
Can always add this again if someone needs it and can justify one
behaviour over the other, but for now might as well avoid growing users.
Duncan P. N. Exon Smith [Thu, 21 Oct 2021 18:01:41 +0000 (11:01 -0700)]
Support: Reduce stats in fs::copy_file on Darwin
fs::copy_file() on Darwin has a nice optimization to clone the file when
possible. Change the implementation to use clonefile() directly, instead
of the higher-level copyfile(). The latter does the wrong thing for
symlinks, which requires calling `stat` first...
With that out of the way, optimistically call clonefile() all the time,
and then for any error that's recoverable try again with copyfile()
(without the COPYFILE_CLONE flag, as before).
Differential Revision: https://reviews.llvm.org/D112250