Commit Graph

413008 Commits

Author SHA1 Message Date
Kazu Hirata cda7b6aaf3 [Analysis] Drop an unnecessary const from a return type (NFC)
Identified with readability-const-return-type.
2022-01-30 16:04:58 -08:00
Kazu Hirata 152d61a821 [llvm] Use = default (NFC) 2022-01-30 16:04:56 -08:00
Fangrui Song 0e691aed7e [mlgo][regalloc] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after a8a7bf922c 2022-01-30 15:18:30 -08:00
Fangrui Song 7cd0c45364 [ELF] Simplify SectionBase::partition handling and make it live by default. NFC
Previously an InputSectionBase is dead (`partition==0`) by default.
SyntheticSection calls markLive and BssSection overrides that with markDead.

It is more natural to make InputSectionBase live by default and let
--gc-sections mark InputSectionBase dead.

When linking a Release build of clang:

* --no-gc-sections:, the removed `inputSections` loop decreases markLive time from 4ms to 1ms.
* --gc-sections: the extra `inputSections` loop increases markLive time from 0.181296s to 0.188526s.
  This is as of we lose the removing one `inputSections` loop optimization (4374824ccf).
  I believe the loss can be mitigated if we refactor markLive.
2022-01-30 15:12:09 -08:00
Mircea Trofin a8a7bf922c [mlgo][regalloc] Fix register masking
If AllocationOrder has less than 32 elements, we were treating the extra
positions as if they were valid. This was detected by a subsequent
assert. The fix also tightens the asserts.
2022-01-30 14:59:08 -08:00
Alexandre Ganea dc3b9365b6 [mlir] Silence warnings when building with MSVC
Differential Revision: https://reviews.llvm.org/D118536
2022-01-30 17:31:35 -05:00
Sanjoy Das 8f66ab1c2e Replace OwningModuleRef with OwningOpRef<ModuleOp>
This addresses a TODO in BuiltinOps.h.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D118574
2022-01-30 14:07:10 -08:00
Fangrui Song 73fd7d2304 [ELF] Change splitSections to objectFiles based parallelForEach. NFC
The work is more balanced.
2022-01-30 13:34:27 -08:00
Craig Topper 744be8c502 [RISCV] Lower riscv_zip/unzip intrinsic to RISCVISD::SHFL/UNSHFL.
These are special versions of the more general shfli/unshfli
instructions. We can use the general ISD opcodes with the correct
immediates.
2022-01-30 13:27:41 -08:00
Markus Böck e0b11c7659 [Support][NFC] Fix generic `ChildrenGetterTy` of `IDFCalculatorBase`
Both IDFCalculatorBase and its accompanying DominatorTreeBase only supports pointer nodes. The template argument is the block type itself and any uses of GraphTraits is therefore done via a pointer to the node type.
However, the ChildrenGetterTy type of IDFCalculatorBase has a use on just the node type instead of a pointer to the node type. Various parts of the monorepo has worked around this issue by providing specializations of GraphTraits for the node type directly, or not been affected by using specializations instead of the generic case. These are unnecessary however and instead the generic code should be fixed instead.

An example from within Tree is eg. A use of IDFCalculatorBase in InstrRefBasedImpl.cpp. It basically instantiates a IDFCalculatorBase<MachineBasicBlock, false> but due to the bug above then goes on to specialize GraphTraits<MachineBasicBlock> although GraphTraits<MachineBasicBlock*> exists (and should be used instead).

Similar dead code exists in clang which defines redundant GraphTraits to work around this bug.

This patch fixes both the original issue and removes the dead code that was used to work around the issue.

Differential Revision: https://reviews.llvm.org/D118386
2022-01-30 22:09:07 +01:00
Craig Topper e1075186a6 [RISCV] Custom lower brev8 intrinsic to RISCVISD::GREV.
We can use the RISCVISD::GREV encoding that swaps the bits in
each byte.  This allows it to use the existing computeKnownBits
support for RISCVISD::GREV.
2022-01-30 12:41:09 -08:00
Kazu Hirata 780f8a0051 [OpenMP] Use nullptr instead of NULL (NFC)
Identified with modernize-use-nullptr.
2022-01-30 12:32:59 -08:00
Kazu Hirata 49fdee13c1 [Analysis] Use != to compare strings (NFC)
Identified with readability-string-compare.
2022-01-30 12:32:57 -08:00
Kazu Hirata fdd0e745c3 [clang] Remove redundant string initialization (NFC)
Identified with readability-redundant-string-init.
2022-01-30 12:32:55 -08:00
Kazu Hirata 5423839929 [lldb] Forward-declare ClangExpressionParser (NFC)
ClangUserExpression.h is relying on the forward declaration of
ClangExpressionParser in ClangFunctionCaller.h.  This patch moves the
forward declaration to ClangUserExpression.h.
2022-01-30 12:32:53 -08:00
Kazu Hirata 2bea207d26 [CodeGen] Use default member initialization (NFC)
Identified with modernize-use-default-member-init.
2022-01-30 12:32:51 -08:00
Simon Pilgrim 156f83adc2 [X86] combineVectorTruncation - use PACKUSDW(BLENDW(X,0),BLENDW(Y,0)) for v8i32->v8i16 truncation
Limit this to SSE41 - AVX1 targets to avoid UNPCKL(PSHUFB,PSHUFB), pre-SSE41 we don't have PACKUSDW/BLENDW and with AVX2 we can perform this as PERMQ(PSHUFB()).
2022-01-30 20:07:04 +00:00
Anatoly Trosinenko 4bcd2588a9 [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z
`__builtin_c[tl]z` accepts `unsigned int` argument that is not always the
same as uint32_t. For example, `unsigned int` is uint16_t on MSP430.

Reviewed By: aykevl

Differential Revision: https://reviews.llvm.org/D86547
2022-01-30 23:04:07 +03:00
Matthias Springer dab72a35e9 [mlir][bufferize] Clean up remaining references to `tensor-constant-bufferize` 2022-01-31 05:02:11 +09:00
Philip Sigillito d1aed486ef [clang-format] Handle C variables with name that matches c++ access specifier
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D117416
2022-01-30 20:56:50 +01:00
Mehdi Amini 446425f898 Apply clang-tidy fixes for llvm-include-order in AttrOrTypeFormatGen.cpp (NFC) 2022-01-30 19:49:23 +00:00
Mehdi Amini bb31503989 Apply clang-tidy fixes for performance-move-const-arg in TestLinalgCodegenStrategy.cpp (NFC) 2022-01-30 19:49:23 +00:00
Mehdi Amini d7ab71f7b9 Apply clang-tidy fixes for readability-identifier-naming in TosaOps.cpp (NFC) 2022-01-30 19:49:23 +00:00
Mehdi Amini 70ed93ec4c Apply clang-tidy fixes for readability-identifier-naming in PolynomialApproximation.cpp (NFC) 2022-01-30 19:49:22 +00:00
Mehdi Amini bb6119eb77 Apply clang-tidy fixes for performance-for-range-copy in SCFInterfaceImpl.cpp (NFC) 2022-01-30 19:49:22 +00:00
Mehdi Amini 3b3fbd56ec Apply clang-tidy fixes for modernize-use-equals-default in BufferizableOpInterface.cpp (NFC) 2022-01-30 19:49:22 +00:00
Mehdi Amini f65994c9f1 Apply clang-tidy fixes for readability-identifier-naming in AsyncToLLVM.cpp (NFC) 2022-01-30 19:49:22 +00:00
Anatoly Trosinenko 9595f00510 [compiler-rt][builtins] Use explicitly-sized integer types for LibCalls
Use s[iu]_int instead of `(unsigned) int` and d[ui]_int instead of
`(unsigned) long long` for LibCall arguments.

Note: the `*vfp` LibCall versions were NOT touched.

Reviewed By: aykevl

Differential Revision: https://reviews.llvm.org/D86546
2022-01-30 21:10:54 +03:00
Keith Smiley a6298fb160 [lld-macho] Add support for -add_empty_section
This is a ld64 option equivalent to `-sectcreate seg sect /dev/null`
that's useful for creating sections like the RESTRICT section.

Differential Revision: https://reviews.llvm.org/D117749
2022-01-30 10:03:41 -08:00
Simon Pilgrim b7e04ccd99 [X86][AVX] matchUnaryShuffle - avoid creation of on-the-fly nodes (PR45974)
Don't extract the ANY/ZERO_EXTEND_VECTOR_INREG subvector source until we're definitely combining to a new node.
2022-01-30 17:59:14 +00:00
Keith Smiley 0ab09a9009 [test][lld-macho] Improve LC_FUNCTION_STARTS test coverage
Previously functions that aren't included in the symtab were also
excluded from the function starts. Symbols missing from function starts
degrades the debugger experience in the case you don't have debug info
for them.

Differential Revision: https://reviews.llvm.org/D114275
2022-01-30 09:46:36 -08:00
Simon Pilgrim 2cdbaca394 [X86] Attempt to fold MOVMSK(CMPEQ(AND(X,C1),0)) -> MOVMSK(NOT(SHL(X,C2)))
Allows pow2 mask tests to avoid an unnecessary constant load.

Noticed while investigating how to extend MatchVectorAllZeroTest to support more allof/anyof patterns.
2022-01-30 15:53:21 +00:00
Simon Pilgrim 4e3ba526bf [X86] Add tests showing failure to fold MOVMSK(CMPEQ(AND(X,C1),0)) -> MOVMSK(NOT(SHL(X,C2)))
This would allow pow2 mask tests to avoid an unnecessary constant load.

Noticed while investigating how to extend MatchVectorAllZeroTest to support more allof/anyof patterns.
2022-01-30 15:42:59 +00:00
Ricky Zhou 30ac5f9e64 [InstCombine] Do not combine atomic and non-atomic loads
Before this change, InstCombine was willing to fold atomic and
non-atomic loads through a PHI node as long as the first PHI argument
is not an atomic load. The combined load would be non-atomic, which is
incorrect.

Fix this by only combining the loads in a PHI node when all of the
arguments are non-atomic loads.

Thanks to Eli Friedman for pointing out the bug at
https://github.com/llvm/llvm-project/issues/50777#issuecomment-981045342!

Fixes #50777

Differential Revision: https://reviews.llvm.org/D115113
2022-01-30 10:05:11 -05:00
Ricky Zhou 2d283528ba [InstCombine] Add test reproducing PR51435 (NFC)
Baseline test for D115113

Differential Revision: https://reviews.llvm.org/D118554
2022-01-30 10:03:49 -05:00
Sanjay Patel 69b835486f Revert "[InstCombine] Do not combine atomic and non-atomic loads"
This reverts commit a2bb7313e6.

The baseline test was not pre-committed as expected.
2022-01-30 10:02:20 -05:00
Ricky Zhou a2bb7313e6 [InstCombine] Do not combine atomic and non-atomic loads
Before this change, InstCombine was willing to fold atomic and
non-atomic loads through a PHI node as long as the first PHI argument
is not an atomic load. The combined load would be non-atomic, which is
incorrect.

Fix this by only combining the loads in a PHI node when all of the
arguments are non-atomic loads.

Thanks to Eli Friedman for pointing out the bug at
https://github.com/llvm/llvm-project/issues/50777#issuecomment-981045342!

Fixes #50777

Differential Revision: https://reviews.llvm.org/D115113
2022-01-30 09:28:56 -05:00
Ricky Zhou de80b53d1a [InstCombine] Use range for loops (NFC)
Preliminary clean-up for D115113

Differential Revision: https://reviews.llvm.org/D116086
2022-01-30 09:10:39 -05:00
Ricky Zhou 4aabed05a8 [InstCombine] Uppercase some variable names (NFC)
Uppercase some variable names, per LLVM coding standards. This change
intentionally does not rename every miscased variable, as a follow-up
change ( D116086 ) intends to eliminate many of those by switching
loops to range for loops.

Differential Revision: https://reviews.llvm.org/D118553
2022-01-30 09:10:39 -05:00
Matthias Springer 6700a26d5f [mlir][linalg][bufferize] Fix insertion point InitTensorElimination
There was a bug where some of the OpOperands needed in the replacement op were not in scope.

It does not matter where the replacement op is inserted. Any insertion point is OK as long as there are no dominance errors. In the worst case, the newly inserted op will bufferize out-of-place. This is no worse than not eliminating the InitTensorOp at all.

Differential Revision: https://reviews.llvm.org/D117685
2022-01-30 22:25:39 +09:00
Mark de Wever ab0554b2ec [libc++][format][nfc] Move tests.
The formatter specialization tests were placed in the wrong
subdirectory. This moves them to the proper place.
2022-01-30 14:21:13 +01:00
Mark de Wever 7927b69a6b [libc++][doc] Update the release notes.
I had a look at the changes since the last release and updated the
release notes with interesting changes.

It seems this time the release notes were already rather up to date :-)

If there are more interesting changes, please let me know and I'll
update the patch. I'd like to commit these changes latest next weekend
so they land before branching the 14.0 release.

I've added most active libc++ contributors. If I forgot anybody please add them.

Reviewed By: Quuxplusone, ldionne, philnik, #libc

Differential Revision: https://reviews.llvm.org/D117948
2022-01-30 14:16:56 +01:00
Matthias Springer e448c793c6 [mlir][bufferize][NFC] Move std BufferizableOpInterfaceImpl to std dialect
Also reimplement `std-bufferize` in terms of BufferizableOpInterface-based bufferization. The old `std.select` bufferization pattern is no longer needed and deleted.

Differential Revision: https://reviews.llvm.org/D118559
2022-01-30 22:12:14 +09:00
Florian Hahn 8f12175fed
[VPlan] Use VPlan to check if only the first lane is used.
This removes the remaining dependence on LoopVectorizationCostModel from
buildScalarSteps and is required so it can be moved out of ILV.

It also improves allows us to remove a few unneeded instructions.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D116554
2022-01-30 13:07:29 +00:00
Matthias Springer 19efe141f7 [mlir][bufferize][NFC] Move scf BufferizableOpInterface impl to scf dialect
Differential Revision: https://reviews.llvm.org/D118557
2022-01-30 21:53:33 +09:00
Matthias Springer 7a9765e8a8 Update BUILD.bazel.
This should have been done as part of D118483.
2022-01-30 21:49:49 +09:00
Matthias Springer ab47418df6 [mlir][bufferize] Merge tensor-constant-bufferize into arith-bufferize
The bufferization of arith.constant ops is also switched over to BufferizableOpInterface-based bufferization. The old implementation is deleted. Both implementations utilize GlobalCreator, now renamed to just `getGlobalFor`.

GlobalCreator no longer maintains a set of all created allocations to avoid duplicate allocations of the same constant. Instead, `getGlobalFor` scans the module to see if there is already a global allocation with the same constant value.

For compatibility reasons, it is still possible to create a pass that bufferizes only `arith.constant`. This pass (createConstantBufferizePass) could be deleted once all users were switched over to One-Shot bufferization.

Differential Revision: https://reviews.llvm.org/D118483
2022-01-30 21:37:48 +09:00
Nuno Lopes dd995aceda [InstCombine] remove incorrect gep(x, undef) -> undef optimization
gep(x, undef) carries the provenance of x, so we can't replace it with any
pointer like undef.
This leaves room for improvement for the poison case, but that's currently
not possible as the demanded bits API doesn't distinguish between undef &
poison bits.

Fixes #44790
2022-01-30 11:34:32 +00:00
Nuno Lopes 0dc20e321c [InstSimplify] fold 'xor X, poison' and 'div/rem X, poison' to poison 2022-01-30 10:46:54 +00:00
Nuno Lopes 42a761e57c [NewGVN][NFC] add poison tests 2022-01-30 10:04:00 +00:00