Commit Graph

408830 Commits

Author SHA1 Message Date
Shao-Ce SUN 62b59c59a6 [NFC][clang] Fix comments. 2022-01-05 14:49:03 +08:00
Florian Mayer 4ecfa0a0c5 [sanitizers] Fix integer underflow when parsing ELF.
Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D116639
2022-01-04 21:47:02 -08:00
Mehdi Amini 564bcf9d02 Align adaptor's generator accessors for attribute on the Op class
Each attribute has two accessor: one suffixed with `Attr` which returns the attribute itself
and one without the suffix which unwrap the attribute.
For example for a StringAttr attribute with a field named `kind`, we'll generate:

StringAttr getKindAttr();
StringRef getKind();

Differential Revision: https://reviews.llvm.org/D116466
2022-01-05 05:42:15 +00:00
Xu Mingjie b5149f4e66 [LTO] Fix assertion failed when flushing bitcode incrementally for LTO output.
In https://reviews.llvm.org/D86905, we introduce an optimization, when lld emits LLVM bitcode,
we allow bitcode writer flush data to disk early when buffered data size is above some threshold.

But when `--plugin-opt=emit-llvm` and `-o /dev/null` are used,
lld will trigger assertion `BytesRead >= 0 && static_cast<size_t>(BytesRead) == BytesFromDisk`.
When we write output to /dev/null, BytesRead is zero, but at this program point BytesFromDisk is always non-zero.

Reviewed By: stephan.yichao.zhao, MaskRay

Differential Revision: https://reviews.llvm.org/D112297
2022-01-04 21:40:23 -08:00
Pravin Jagtap 2899e8de67 [AMDGPU] Test commit. NFC.
Differential Revision: https://reviews.llvm.org/D116641
2022-01-04 23:18:13 -05:00
Mircea Trofin a120fdd337 [NFC][MLGO]Add RTTI support for MLModelRunner and simplify runner setup 2022-01-04 19:46:14 -08:00
Chuanqi Xu e627f4ce0d [NFC] [Coroutines] Rename ReuseFrameSlot to OptimizeFrame
We could use the variable as a flag to indicate if the optimization
is on.
2022-01-05 11:40:27 +08:00
Fangrui Song 292395329c [lld-link] Remove unneeded lto::InputFile::create after D116434 2022-01-04 19:38:32 -08:00
Luís Ferreira 10e40a4ea3 [lld] Add support for other demanglers other than Itanium
LLVM core library supports demangling other mangled symbols other than itanium,
such as D and Rust. LLD should use those demanglers in order to output pretty
demangled symbols on error messages.

Reviewed By: MaskRay, #lld-macho

Differential Revision: https://reviews.llvm.org/D116279
2022-01-05 03:25:41 +00:00
Fangrui Song 1eb5b6e850 [InferAttrs] If readonly is already set, set readnone instead of writeonly
D116426 may lead to an assertion failure `Attributes 'readonly and writeonly' are incompatible!` if the builtin function already has `readonly`.
2022-01-04 18:59:35 -08:00
Chuanqi Xu c75cedc237 [Coroutines] Set presplit attribute in Clang and mlir
This fixes bug49264.

Simply, coroutine shouldn't be inlined before CoroSplit. And the marker
for pre-splited coroutine is created in CoroEarly pass, which ran after
AlwaysInliner Pass in O0 pipeline. So that the AlwaysInliner couldn't
detect it shouldn't inline a coroutine. So here is the error.

This patch set the presplit attribute in clang and mlir. So the inliner
would always detect the attribute before splitting.

Reviewed By: rjmccall, ezhulenev

Differential Revision: https://reviews.llvm.org/D115790
2022-01-05 10:25:02 +08:00
Heejin Ahn f2a43f06dd [WebAssembly] Use llvm utility functions in EH/SjLj
This uses `changeToCall` and `changeToInvokeAndSplitBasicBlock` from
`lib/Transforms/Utils`, replacing the custom logic. One difference of
those functions from our previous logic is they delete the original
`CallInst`/`InvokeInst`, which makes them tricky to use while iterating
through instructions/BBs. So this CL gathers the candidate calls first
and run them through `changeToInvokeAndSplitBasicBlock` later.

Also this renames some variables.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D116620
2022-01-04 17:47:20 -08:00
Heejin Ahn f178f61e1d [WebAssembly] Nullify unnecessary setjmp calls
D107530 did a small optimization that, if a function contains `setjmp`
calls but not other calls that can `longjmp`, we don't do SjLj
transformation on those `setjmp` calls, because they don't have
possibilities of returning from `longjmp`.

But we should remove those `setjmp` calls even in that case, because
Emscripten doesn't provide that function, assuming it is lowered away by
SjLj transformation. `setjmp` always returns 0 when called directly, so
this CL replaces them with `i32 0`.

Fixes https://github.com/emscripten-core/emscripten/issues/15679.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D116619
2022-01-04 17:44:32 -08:00
Fangrui Song d007e66cb6 [docs] Re-generate ClangCommandLineReference.rst 2022-01-04 16:52:24 -08:00
Rumeet Dhindsa 37be748859 Revert "[clang][ObjC] Add fix it for missing methods in impl"
This reverts commit dd72ae3dcc.

Notified the author of the internal failure and author suggested to revert it for
now.
2022-01-04 16:43:54 -08:00
wren romano c948922567 [mlir][sparse] Factoring out type-based function-name suffixes
Depends On D115010

This changes a couple of places that used to `return failure();` to now use `llvm_unreachable()` instead. However, `Transforms/Sparsification.cpp` should be doing the necessary type checks to ensure that those cases are in fact unreachable.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D115012
2022-01-04 16:17:55 -08:00
wren romano bc04a47038 [mlir][sparse] adding OverheadType::kIndex
Depends On D115008

This change opens the way for D115012, and removes some corner cases in `CodegenUtils.cpp`. The `SparseTensorAttrDefs.td` already specifies that we allow `0` bitwidth for the two overhead types and that it is interpreted to mean the architecture's native width.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D115010
2022-01-04 16:15:54 -08:00
wren romano 85b8d03e12 [mlir][sparse] Factoring out Transforms/CodegenUtils.{cpp,h}
This moves a bunch of helper functions from `Transforms/SparseTensorConversion.cpp` into `Transforms/CodegenUtils.{cpp,h}` so that they can be reused by `Transforms/Sparsification.cpp`, etc.

See also the dependent D115010 which cleans up some corner cases in this change.

Reviewed By: aartbik, rriddle

Differential Revision: https://reviews.llvm.org/D115008
2022-01-04 16:11:47 -08:00
Henry Linjamäki c99b2c6316 CUDA/HIP: Allow __int128 on the host side
Consider case where `__int128` type is supported by the host target but
not by a device target (e.g. spirv*). Clang emits an error message for
unsupported type even if the device code does not use it. This patch
fixes this issue by emitting the error message when the device code
attempts to use the unsupported type.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D111047
2022-01-04 16:09:26 -08:00
Sumanth Gundapaneni 822448635e [Hexagon] Fix MachineSink not to hoist FP instructions that update USR.
Ideally we should make USR as Def for these floating point instructions.
However, it violates some assembler MCChecker rules. This patch fixes
the issue by marking these FP instructions as non-sinkable.
2022-01-04 15:55:22 -08:00
SANTANU DAS 52f347010a [Hexagon] Make A2_tfrsi not cheap for operands exceeding 16 bits
This patch aids to reduce code size since it removes generation
of back-to-back A2_tfrsi instructions. It is enabled only at -Os/-Oz.
2022-01-04 15:46:26 -08:00
Krzysztof Parzyszek 60944d132f [Hexagon] Convert codegen testcase from .ll to .mir 2022-01-04 15:41:32 -08:00
Jacques Pienaar 9e365fe326 [mlir] Retain metadata for single loc fusedloc
If a fusedloc is created with a single location then no fusedloc
was previously created and single location returned instead. In the case
where there is a metadata associated with the location this results in
discarding the metadata. Instead only canonicalize where there is no
loss of information.

Differential Revision: https://reviews.llvm.org/D115605
2022-01-04 15:37:33 -08:00
Fangrui Song d496abbe2a [lld-link] Replace LazyObjFile with lazy ObjFile/BitcodeFile
Similar to ELF 3a5fb57393.

* previously when a LazyObjFile was extracted, a new ObjFile/BitcodeFile was created; now the file is reused, just with `lazy` cleared
* avoid the confusing transfer of `symbols` from LazyObjFile to the new file
* simpler code, smaller executable (5200+ bytes smaller on x86-64)
* make eager parsing feasible (for parallel section/symbol table initialization)

Reviewed By: aganea, rnk

Differential Revision: https://reviews.llvm.org/D116434
2022-01-04 15:11:44 -08:00
Nikolas Klauser 1e1e97a326 [libc++][test] Allow multiple tries in some thread tests 2022-01-04 23:47:43 +01:00
LLVM GN Syncbot f61b658d7d [gn build] Port 6d722801d1 2022-01-04 22:44:20 +00:00
Nikolas Klauser 6d722801d1 [libc++][ranges] Add indirectly_comparable concept
Add `indirectly_comparable` concept

Reviewed By: Quuxplusone, Mordante, #libc

Spies: mgorny, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116268
2022-01-04 23:40:57 +01:00
Brendon Cahoon 090f8ec8a8 [Hexagon] Fix some issues with packetizing slot0-only instructions 2022-01-04 14:35:37 -08:00
V Donaldson dd7d5bc5bd [flang] Modify an IO format error message
F18 constraint C1308 is:

  For the G edit descriptor, e shall not be specified if w is zero.

For an edit descriptor such as 'G0.2E4', change the error message from:

  error: Unexpected 'e' in 'G0' edit descriptor

To:

  error: A 'G0' edit descriptor must not have an 'e' value
2022-01-04 14:27:34 -08:00
Arthur O'Dwyer 855d7bedb7 [libc++] [P0887] Add newest feature-test macros; mark `type_identity` as implemented.
`__cpp_lib_type_identity` was implemented way back in cf49ccd0 (Clang 8),
probably before the feature-test macro had been settled on.

`__cpp_lib_string_resize_and_overwrite` will be added by D113013 so I didn't add it here.

Fixes #46605.

Differential Revision: https://reviews.llvm.org/D116433
2022-01-04 17:23:37 -05:00
Arthur O'Dwyer 8507383631 [libc++] [ranges] ADL-proof the [range.access] CPOs.
For example, `std::ranges::range<Holder<Incomplete>*>` should be
well-formed false, not a hard error at compile time.

Differential Revision: https://reviews.llvm.org/D116239
2022-01-04 17:15:42 -05:00
Arthur O'Dwyer 1716c36d84 [libc++] [test] More test coverage for ranges::{data,size}.
Reviewed as part of D116239.
2022-01-04 17:15:26 -05:00
Harsha Jagasia 2b1c6df5a6 [Hexagon] Performance regression with b2b
For code below:
        {
                r7 = addasl(r3,r0,#2)
                r8 = addasl(r3,r2,#2)
                r5 = memw(r3+r0<<#2)
                r6 = memw(r3+r2<<#2)
        }
        {
                p1 = cmp.gtu(r6,r5)
                if (p1.new) memw(r8+#0) = r5
                if (p1.new) memw(r7+#0) = r6
        }
        {
                r0 = mux(p1,r2,r4)

        }

In packetizer, a new packet is created for the cmp instruction since
there arent enough resources in previous packet. Also it is determined
that the cmp stalls by 2 cycles since it depends on the prior load of r5.
In current packetizer implementation, the predicated store is evaluated
for whether it can go in the same packet as compare, and since the compare
stalls, the stall of the predicated store does not matter and it can go in
the same packet as the cmp. However the predicated store will stall for
more cycles because of its dependence on the addasl instruction and to
avoid that stall we can put it in a new packet.

Improve the packetizer to check if an instruction being added to packet
will stall longer than instruction already in packet and if so create a
new packet.
2022-01-04 14:09:47 -08:00
Zequan Wu d5b6e30ed3 [LLDB][Clang] add AccessSpecDecl for methods and fields in RecordType
This allows access type be printed when running `lldb-test -dump-ast` and
`lldb-test -dump-clang-ast`.

Differential Revision: https://reviews.llvm.org/D115062
2022-01-04 13:50:24 -08:00
SANTANU DAS cff1a2ed51 [Hexagon] HVX .new store uses different resources
When checking resources in the post RA scheduler, see if a .new
vector store should be used instead of a regular vector store.

It may not be possible to schedule a regular vector store, but
it may be possible to schedule a .new version. If the correct one
isn't used, then the post RA scheduler may not generate the best
schedule.
2022-01-04 13:35:34 -08:00
Arthur O'Dwyer 502e5df0e0 [libc++] Implement `ranges::{cbegin,cend}` per the spec.
The big change here is that they now work as intended for rvalues,
e.g. `ranges::cbegin(std::string_view("hello"))`.
Also, add tests verifying their return types.

Differential Revision: https://reviews.llvm.org/D116199
2022-01-04 16:18:41 -05:00
Ikhlas Ajbar d6a68d08f3 [Hexagon] Refactor updateLatency() function
Co-authored-by: Sumanth Gundapaneni <sgundapa@quicinc.com>
2022-01-04 13:16:54 -08:00
Arthur O'Dwyer e80ef6bd27 [libc++] Fix whitespace in __partial_sort. NFC. 2022-01-04 16:15:02 -05:00
Arthur O'Dwyer f6fb7bf636 [libc++] Add an early return for __partial_sort of an empty range.
If `__first == __middle`, then `partial_sort` is a no-op; don't
bother to iterate all the way from `__middle` to `__end`.

Fixes #49431.

Differential Revision: https://reviews.llvm.org/D116296
2022-01-04 16:14:05 -05:00
Yuanfang Chen e902ffe6d7 [Sema] Fix the assertion in Sema::ActOnDependentMemberExpr
617007240c introduced the use of ActOnDependentMemberExpr with
variable template specialization. The assertion inside
ActOnDependentMemberExpr should be adjusted accordingly.

Fixes https://bugs.llvm.org/show_bug.cgi?id=47211

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D113146
2022-01-04 13:08:12 -08:00
David Goldman dd72ae3dcc [clang][ObjC] Add fix it for missing methods in impl
We suggest inserting the method with an empty body at the end
of the implementation decl.

Differential Revision: https://reviews.llvm.org/D116417
2022-01-04 15:57:58 -05:00
Benjamin Kramer 32c9208750 [flang][openacc] Remove unused variable. NFC. 2022-01-04 21:47:28 +01:00
Craig Topper a04b532505 [LegalizeIntegerTypes][RISCV] Teach PromoteSetCCOperands to check sign bits of unsigned compares.
Unsigned compares work with either zero extended or sign extended
inputs just like equality comparisons. I didn't allow this when
I refactored the code in D116421 due to lack of tests. But I've
since found a simple C test case that demonstrates when this can be
useful.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D116617
2022-01-04 12:38:47 -08:00
Sumanth Gundapaneni 9b63fff3db [Hexagon] Update latencies on REG_SEQUENCE/COPY based on successors.
If there are multiple uses of the def of COPY/REG_SEQUENCE, set the
latency only if the latencies on all the uses are equal, otherwise set
it to default.
2022-01-04 12:30:30 -08:00
Jack Andersen 5b1337184b [DebugInfo] Avoid triggering global location assert for 2-byte pointer sizes.
D111404 moved a 4/8 byte check assert into a block taken by 2-byte platforms.
Since these platforms do not take the branches where the pointer size is used,
sink the assert accordingly.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D116480
2022-01-04 15:16:36 -05:00
Benjamin Kramer 41760a6b40 [mlir] Make Value's constructor constexpr. NFCI.
This allows clang to flag unused Values in more cases, so remove them.
2022-01-04 21:04:13 +01:00
Philip Reames 11a46b1749 precommit tests for a planned followon to D116200 2022-01-04 12:02:25 -08:00
Paul Robinson fa17c0e27a [PS4] Verify the default DWARF version is 4.
Follow-up to b8e03be. Even if Clang's generic default DWARF version
bumps up, PS4 will stay on v4.
2022-01-04 11:57:10 -08:00
Philip Reames 1be54bc764 precommit additional tests for D116200 2022-01-04 11:50:44 -08:00
Brendon Cahoon db5b791595 [Hexagon] Fix an instruction move in HexagonVectorCombine
The HexagonVectorCombine pass was moving an instruction
incorrectly, which caused a use in a GEP that was not yet
defined.

HexagonVectorCombine removes a load from a group due to its
dependences, but in realignGroup, the load is processed anyways.
In realignGroup, when determining the maximum alignment, only
those instructions still in the group should be considered.
2022-01-04 11:41:42 -08:00