platform/upstream/llvm.git
3 years ago[NFC] Update arm_function_name.ll after 4de0c400317e5a92d57f2c76545061a9e7de22f8
Roman Lebedev [Wed, 23 Jun 2021 13:41:16 +0000 (16:41 +0300)]
[NFC] Update arm_function_name.ll after 4de0c400317e5a92d57f2c76545061a9e7de22f8

3 years agoHandle interactions between reserved identifier and user-defined suffixes
serge-sans-paille [Tue, 15 Jun 2021 14:58:55 +0000 (16:58 +0200)]
Handle interactions between reserved identifier and user-defined suffixes

According to https://eel.is/c++draft/over.literal

> double operator""_Bq(long double);  // OK: does not use the reserved identifier _­Bq ([lex.name])
> double operator"" _Bq(long double); // ill-formed, no diagnostic required: uses the reserved identifier _­Bq ([lex.name])

Obey that rule by keeping track of the operator literal name status wrt. leading whitespace.

Fix: https://bugs.llvm.org/show_bug.cgi?id=50644

Differential Revision: https://reviews.llvm.org/D104299

3 years ago[AMDGPU] Remove unused multiclass MUBUF_Real_gfx10_with_name
Jay Foad [Wed, 23 Jun 2021 13:37:20 +0000 (14:37 +0100)]
[AMDGPU] Remove unused multiclass MUBUF_Real_gfx10_with_name

3 years ago[NFC][ARM] Fix update_llc_test_checks for thumbv7-apple-darwin, autogenerate thumb2...
Roman Lebedev [Wed, 23 Jun 2021 13:19:28 +0000 (16:19 +0300)]
[NFC][ARM] Fix update_llc_test_checks for thumbv7-apple-darwin, autogenerate thumb2-ifcvt1.ll

3 years ago[NFC][AArch64] Autogenerate a few more tests
Roman Lebedev [Wed, 23 Jun 2021 13:09:38 +0000 (16:09 +0300)]
[NFC][AArch64] Autogenerate a few more tests

3 years ago[NFC][ARM] Fix update_llc_test_checks for aarch64-apple-ios/thumbv7s-apple-darwin...
Roman Lebedev [Wed, 23 Jun 2021 12:34:29 +0000 (15:34 +0300)]
[NFC][ARM] Fix update_llc_test_checks for aarch64-apple-ios/thumbv7s-apple-darwin, autogenerate a few tests

3 years ago[NFC][ARM] Fix update_llc_test_checks for thumbv7-apple-ios, autogenerate switch...
Roman Lebedev [Wed, 23 Jun 2021 12:28:37 +0000 (15:28 +0300)]
[NFC][ARM] Fix update_llc_test_checks for thumbv7-apple-ios, autogenerate switch-minsize.ll

3 years ago[NFC][ARM] Fix update_llc_test_checks for armv7-apple-ios, autogenerate ifcvt5.ll...
Roman Lebedev [Wed, 23 Jun 2021 12:22:02 +0000 (15:22 +0300)]
[NFC][ARM] Fix update_llc_test_checks for armv7-apple-ios, autogenerate ifcvt5.ll/ifcvt6.ll

3 years ago[ARMParallelDSP] Remove unnecessary wrapper function (NFC)
Nikita Popov [Wed, 23 Jun 2021 13:26:54 +0000 (15:26 +0200)]
[ARMParallelDSP] Remove unnecessary wrapper function (NFC)

AreSequentialAccesses() forwards directly to isConsecutiveAccess()
and has an unnecessary template parameter to boot.

3 years ago[lldb] Remove asserts in CommandReturnObject SetError and AppendError
David Spickett [Wed, 23 Jun 2021 11:28:16 +0000 (11:28 +0000)]
[lldb] Remove asserts in CommandReturnObject SetError and AppendError

I added asserts to these in https://reviews.llvm.org/D104525.
They are available (directly or otherwise) via the API so we
should not assert.

Restore the previous behaviour. If the message
is empty, we return early before printing anything.
For SetError don't assert that the error is a failure.

The remaining assert is in AppendRawError which
is not part of the API.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104778

3 years ago[lldb][NFC] Remove some redundant semicolons on HostInfoMacOSX
Raphael Isemann [Wed, 23 Jun 2021 13:06:12 +0000 (15:06 +0200)]
[lldb][NFC] Remove some redundant semicolons on HostInfoMacOSX

3 years ago[AArch64] Add CodeGen tests for vector reduction intrinsics. NFC
Rosie Sumpter [Tue, 22 Jun 2021 16:31:56 +0000 (17:31 +0100)]
[AArch64] Add CodeGen tests for vector reduction intrinsics. NFC

Tests are added for vector reduce OR, AND and XOR.

Differential Revision: https://reviews.llvm.org/D104771

3 years ago[clang-format] Fix a bug that indents else-comment-if incorrectly
owenca [Wed, 23 Jun 2021 09:40:29 +0000 (02:40 -0700)]
[clang-format] Fix a bug that indents else-comment-if incorrectly

PR50809

Differential Revision: https://reviews.llvm.org/D104774

3 years ago[AIX][PowerPC] Remove error when specifying mabi=vec-default on AIX
Zarko Todorovski [Wed, 23 Jun 2021 11:14:24 +0000 (07:14 -0400)]
[AIX][PowerPC] Remove error when specifying mabi=vec-default on AIX

The default Altivec ABI was implemented but the clang error for specifying
its use still remains.  Users could get around this but not specifying the
type of Altivec ABI but we need to remove the error.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D102094

3 years ago[NFCI-ish][SimplifyCFGPass] Rework and generalize `ret` block tail-merging
Roman Lebedev [Wed, 23 Jun 2021 11:28:51 +0000 (14:28 +0300)]
[NFCI-ish][SimplifyCFGPass] Rework and generalize `ret` block tail-merging

This changes the approach taken to tail-merge the blocks
to always create a new block instead of trying to reuse some block,
and generalizes it to support dealing not with just the `ret` in the future.

This effectively lifts the CallBr restriction, although this isn't really intentional.
That is the only non-NFC change here, i'm not sure if it's reasonable/feasible to temporarily retain it.

Other restrictions of the transform remain.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D104598

3 years agoAdd support for #pragma system_header with -fms-extensions
Hans Wennborg [Wed, 23 Jun 2021 08:35:55 +0000 (10:35 +0200)]
Add support for #pragma system_header with -fms-extensions

Clang already supports the pragma prefixed by "GCC" or "clang".

MSVC has more recently added support for the pragma, but without any prefix; see
https://devblogs.microsoft.com/cppblog/broken-warnings-theory/#external-headers

Differential revision: https://reviews.llvm.org/D104770

3 years ago[InstSimplify] Add more poison folding optimizations
Juneyoung Lee [Mon, 21 Jun 2021 18:49:37 +0000 (03:49 +0900)]
[InstSimplify] Add more poison folding optimizations

This adds more poison folding optimizations to InstSimplify.

Since all binary operators propagate poison, these are fine.

Also, the precondition of `select cond, undef, x` -> `x` is relaxed to allow the case when `x` is undef.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D104661

3 years ago[lldb] Remove CommandReturnObject's SetError(StringRef)
David Spickett [Tue, 22 Jun 2021 16:12:56 +0000 (16:12 +0000)]
[lldb] Remove CommandReturnObject's SetError(StringRef)

Replacing existing uses with AppendError.

SetError is also part of the SBI API. This remains
but instead of calling the underlying SetError it
will call AppendError.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104768

3 years ago[Verifier] Fail on overrunning and invalid indices for {insert,extract} vector intrinsics
Joe Ellis [Fri, 18 Jun 2021 14:53:53 +0000 (14:53 +0000)]
[Verifier] Fail on overrunning and invalid indices for {insert,extract} vector intrinsics

With regards to overrunning, the langref (llvm/docs/LangRef.rst)
specifies:

   (llvm.experimental.vector.insert)
   Elements ``idx`` through (``idx`` + num_elements(``subvec``) - 1)
   must be valid ``vec`` indices. If this condition cannot be determined
   statically but is false at runtime, then the result vector is
   undefined.

   (llvm.experimental.vector.extract)
   Elements ``idx`` through (``idx`` + num_elements(result_type) - 1)
   must be valid vector indices. If this condition cannot be determined
   statically but is false at runtime, then the result vector is
   undefined.

For the non-mixed cases (e.g. inserting/extracting a scalable into/from
another scalable, or inserting/extracting a fixed into/from another
fixed), it is possible to statically check whether or not the above
conditions are met. This was previously missing from the verifier, and
if the conditions were found to be false, the result of the
insertion/extraction would be replaced with an undef.

With regards to invalid indices, the langref (llvm/docs/LangRef.rst)
specifies:

    (llvm.experimental.vector.insert)
    ``idx`` represents the starting element number at which ``subvec``
    will be inserted. ``idx`` must be a constant multiple of
    ``subvec``'s known minimum vector length.

    (llvm.experimental.vector.extract)
    The ``idx`` specifies the starting element number within ``vec``
    from which a subvector is extracted. ``idx`` must be a constant
    multiple of the known-minimum vector length of the result type.

Similarly, these conditions were not previously enforced in the
verifier. In some circumstances, invalid indices were permitted
silently, and in other circumstances, an undef was spawned where a
verifier error would have been preferred.

This commit adds verifier checks to enforce the constraints above.

Differential Revision: https://reviews.llvm.org/D104468

3 years ago[TTI] Make assertion compatible with opaque pointers
Nikita Popov [Wed, 23 Jun 2021 10:21:12 +0000 (12:21 +0200)]
[TTI] Make assertion compatible with opaque pointers

Dropping the TODO here because it applies to all uses of this method.

3 years ago[LLParser] Remove special handling for call address space
Nikita Popov [Tue, 22 Jun 2021 21:34:38 +0000 (23:34 +0200)]
[LLParser] Remove special handling for call address space

Spin-off from D104740: I don't think this special handling is needed
anymore. Calls in textual IR are annotated with addrspace(N) (which
defaults to the program address space from data layout) and specifies
the expected pointer address space of the callee. There is no need
to special-case the program address space on top of that, as it
already is the default expected address space, and we shouldn't
allow use of the program address space if the call was explicitly
annotated with some other address space.

The IsCall parameter is retained because it will be used again soon.

Differential Revision: https://reviews.llvm.org/D104752

3 years ago[mlir][LLVMIR] Fold ExtractValueOp coming from InsertValueOp
Nicolas Vasilache [Wed, 23 Jun 2021 09:03:08 +0000 (09:03 +0000)]
[mlir][LLVMIR] Fold ExtractValueOp coming from InsertValueOp

Differential Revision: https://reviews.llvm.org/D104769

3 years ago[AMDGPU] Stop using LegacyLegalizerInfo. NFCI.
Jay Foad [Fri, 4 Jun 2021 09:15:38 +0000 (10:15 +0100)]
[AMDGPU] Stop using LegacyLegalizerInfo. NFCI.

Differential Revision: https://reviews.llvm.org/D103684

3 years ago[IR] Simplify createReplacementInstr
Jay Foad [Fri, 11 Jun 2021 15:36:30 +0000 (16:36 +0100)]
[IR] Simplify createReplacementInstr

NFCI, although the test change shows that ConstantExpr::getAsInstruction
is better than the old implementation of createReplacementInstr because
it propagates things like the sdiv "exact" flag.

Differential Revision: https://reviews.llvm.org/D104124

3 years ago[mlir][linalg] Change the FillOp library call signature.
Tobias Gysi [Wed, 23 Jun 2021 09:06:04 +0000 (09:06 +0000)]
[mlir][linalg] Change the FillOp library call signature.

Adapt the FillOp library call signature to the updated operand order introduced in https://reviews.llvm.org/D10412. The patch reverts the special treatment of FillOp in LinalgToStandard.

Differential Revision: https://reviews.llvm.org/D104360

3 years ago[llvm] Update tests that got missed in adee485adf84ae8a.
Florian Hahn [Wed, 23 Jun 2021 09:29:58 +0000 (10:29 +0100)]
[llvm] Update tests that got missed in adee485adf84ae8a.

3 years ago[SCEV] Support signed predicates in applyLoopGuards.
Florian Hahn [Wed, 23 Jun 2021 08:42:45 +0000 (09:42 +0100)]
[SCEV] Support signed predicates in applyLoopGuards.

This adds handling for signed predicates, similar to how unsigned
predicates are already handled.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D104732

3 years ago[SCEV] Add tests with single-cond range check generated by InstComb.
Florian Hahn [Tue, 22 Jun 2021 19:29:04 +0000 (20:29 +0100)]
[SCEV] Add tests with single-cond range check generated by InstComb.

3 years ago[AMDGPU] Simplify collectReachableCallees. NFCI.
Jay Foad [Tue, 22 Jun 2021 12:20:18 +0000 (13:20 +0100)]
[AMDGPU] Simplify collectReachableCallees. NFCI.

Don't use SCC iterators when we're only interested in reachability.
Use df_begin/df_end inline to find reachable nodes.

Differential Revision: https://reviews.llvm.org/D104704

3 years ago[mlir][linalg] Adapt the FillOp builder signature.
Tobias Gysi [Wed, 23 Jun 2021 07:51:53 +0000 (07:51 +0000)]
[mlir][linalg] Adapt the FillOp builder signature.

Change the build operand order from output, value to value, output. The patch makes the argument order consistent with the pretty printed order updated by https://reviews.llvm.org/D104356.

Differential Revision: https://reviews.llvm.org/D104359

3 years ago[AMDGPU] Propagate LDS align into to instructions
Stanislav Mekhanoshin [Tue, 15 Jun 2021 00:01:54 +0000 (17:01 -0700)]
[AMDGPU] Propagate LDS align into to instructions

Differential Revision: https://reviews.llvm.org/D104316

3 years ago[LLD] [MinGW] Silence the printouts in one test. NFC.
Martin Storsjö [Fri, 18 Jun 2021 12:20:13 +0000 (15:20 +0300)]
[LLD] [MinGW] Silence the printouts in one test. NFC.

This particular linker invocation is only run to check that we accept
options, but we don't inspect the generated command line. As all other
commands in the file have their output piped to FileCheck, the lit test
doesn't print any other output; therefore silence this one for consistency
as well.

3 years ago[llvm-objcopy][MachO] Fix namespace style issues
Fangrui Song [Wed, 23 Jun 2021 07:31:52 +0000 (00:31 -0700)]
[llvm-objcopy][MachO] Fix namespace style issues

3 years ago[LLD] [MinGW] Print the lld-link command to stderr
Martin Storsjö [Fri, 18 Jun 2021 11:33:28 +0000 (14:33 +0300)]
[LLD] [MinGW] Print the lld-link command to stderr

This is consistent with how clang prints its internal commands with
-### and -v.

When linking with -verbose, we get log messages from the actual
linking written to stderr. By printing the command to the same stream,
we make sure they appear in a sensible chronological order.

Differential Revision: https://reviews.llvm.org/D104527

3 years ago[mlir][linalg] Change the pretty printed FillOp operand order.
Tobias Gysi [Wed, 23 Jun 2021 06:28:58 +0000 (06:28 +0000)]
[mlir][linalg] Change the pretty printed FillOp operand order.

The patch changes the pretty printed FillOp operand order from output, value to value, output. The change is a follow up to https://reviews.llvm.org/D104121 that passes the fill value using a scalar input instead of the former capture semantics.

Differential Revision: https://reviews.llvm.org/D104356

3 years ago[MLIR] Generalize detecting mods during slice computing
Vinayaka Bandishti [Wed, 23 Jun 2021 06:55:09 +0000 (12:25 +0530)]
[MLIR] Generalize detecting mods during slice computing

During slice computation of affine loop fusion, detect one id as the mod
of another id w.r.t a constant in a more generic way. Restrictions on
co-efficients of the ids is removed. Also, information from the
previously calculated ids is used for simplification of affine
expressions, e.g.,

If `id1` = `id2`,
  `id_n - divisor * id_q - id_r + id1 - id2 = 0`, is simplified to:
  `id_n - divisor * id_q - id_r = 0`.

If `c` is a non-zero integer,
  `c*id_n - c*divisor * id_q - c*id_r = 0`, is simplified to:
  `id_n - divisor * id_q - id_r = 0`.

Reviewed By: bondhugula, ayzhuang

Differential Revision: https://reviews.llvm.org/D104614

3 years ago[NFC][PDL] Fix documentation typo, redundant test
Vinayaka Bandishti [Wed, 23 Jun 2021 06:53:14 +0000 (12:23 +0530)]
[NFC][PDL] Fix documentation typo, redundant test

Correct a documentation typo, and delete a duplicate test in
`pdl-to-pdl-interp-rewriter.mlir`.

Reviewed By: pr4tgpt, bondhugula, rriddle

Differential Revision: https://reviews.llvm.org/D104688

3 years agoRevert "[AArch64LoadStoreOptimizer] Recommit: Generate more STPs by renaming register...
Martin Storsjö [Wed, 23 Jun 2021 06:54:16 +0000 (09:54 +0300)]
Revert "[AArch64LoadStoreOptimizer] Recommit: Generate more STPs by renaming registers earlier"

This reverts commit ea011ec5ed53599305de62ca5fcfd31f4b3448c3.

This still causes some miscompiles, I'll follow up in the phabricator
review with a sample of that issue (which is part of the sample of
the previous issue).

3 years ago[TableGen] Fix printing second PC-relative operand
Igor Kudrin [Wed, 23 Jun 2021 06:26:56 +0000 (13:26 +0700)]
[TableGen] Fix printing second PC-relative operand

If an instruction has several operands and a PC-relative one is not the
first of them, the generator may produce the code that does not pass the
'Address' parameter to the printout method. For example, for an Arm
instruction 'LE LR, $imm', it reuses the same code as for other
instructions where the second operand is not PC-relative:

void ARMInstPrinter::printInstruction(...) {
...
  case 11:
    // BF16VDOTI_VDOTD, BF16VDOTI_VDOTQ, BF16VDOTS_VDOTD, ...
    printOperand(MI, 1, STI, O);
    O << ", ";
    printOperand(MI, 2, STI, O);
    break;
...

The patch fixes that by considering 'PCRel' when comparing
'AsmWriterOperand' values.

Differential Revision: https://reviews.llvm.org/D104698

3 years ago[M68k] Fix incorrect #include-ed file in M68kSubtarget
Min-Yih Hsu [Wed, 23 Jun 2021 05:58:15 +0000 (22:58 -0700)]
[M68k] Fix incorrect #include-ed file in M68kSubtarget

In https://reviews.llvm.org/rG2193347e72fa , a cpp file is accidentally
included instead of its header file counterpart. This patch fixes this
error.

3 years ago[M68k] Add testcases for shift and rotate instructions
Jim Lin [Wed, 23 Jun 2021 05:26:56 +0000 (13:26 +0800)]
[M68k] Add testcases for shift and rotate instructions

Add codegen testcases for lsl, lsr, asr, rol and ror instructions.

Reviewed By: myhsu

Differential Revision: https://reviews.llvm.org/D104685

3 years ago[M68k] Refactor codegen patterns for logic operations and add tests for it
Jim Lin [Wed, 23 Jun 2021 05:25:23 +0000 (13:25 +0800)]
[M68k] Refactor codegen patterns for logic operations and add tests for it

Refactor pat for and, or and xor operation and add missing tests for it

Reviewed By: myhsu

Differential Revision: https://reviews.llvm.org/D104626

3 years ago[LoopDeletion] Exploit undef Phi inputs when symbolically executing 1st iteration
Max Kazantsev [Wed, 23 Jun 2021 04:51:36 +0000 (11:51 +0700)]
[LoopDeletion] Exploit undef Phi inputs when symbolically executing 1st iteration

Follow-up on Roman's idea expressed in D103959.
- If a Phi has undefined inputs from live blocks:
   - and no other inputs, assume it is undef itself;
   - and exactly one non-undef input, we can assume that all undefs are equal to this input.

Differential Revision: https://reviews.llvm.org/D104618
Reviewed By: lebedev.ri, nikic

3 years agoRevert "[CodeGen] Don't create fake FunctionDecls when generating block/byref"
Zequan Wu [Wed, 23 Jun 2021 04:46:21 +0000 (21:46 -0700)]
Revert "[CodeGen] Don't create fake FunctionDecls when generating block/byref"

That commit causes crash with error "!dbg attachment points at wrong subprogram for function" on iOS platforms.

This reverts commit f4c06bcb67a1eba13a7f164961586dddaf8ebd5f.

3 years ago[Test] Clear out br i1 undef from tests to avoid UB
Max Kazantsev [Wed, 23 Jun 2021 04:33:03 +0000 (11:33 +0700)]
[Test] Clear out br i1 undef from tests to avoid UB

We don't want to test possible unexpected impact of such
branches. Replacing them with regular conditions. Idea by
Nikita Popov.

3 years ago[LSR] Filter out zero factors. PR50765
Max Kazantsev [Wed, 23 Jun 2021 03:43:06 +0000 (10:43 +0700)]
[LSR] Filter out zero factors. PR50765

Zero factor leads to division by zero and failure of corresponding
assert as shown in PR50765. We should filter out such factors.

Differential Revision: https://reviews.llvm.org/D104702
Reviewed By: huihuiz, reames

3 years agoFix typo in Toy Tutorial Ch-4
Jack Xia [Wed, 23 Jun 2021 03:17:00 +0000 (11:17 +0800)]
Fix typo in Toy Tutorial Ch-4

multiple_transpose -> multiply_transpose

3 years ago[mlir] Fix GCC5 build after D104516
River Riddle [Wed, 23 Jun 2021 03:16:10 +0000 (03:16 +0000)]
[mlir] Fix GCC5 build after D104516

GCC5 isn't able to implicitly capture `this` properly in an `auto` lambda.

3 years ago[mlir][OpDefGen] Don't emit attribute name getters when there are no attributes
River Riddle [Wed, 23 Jun 2021 03:03:27 +0000 (03:03 +0000)]
[mlir][OpDefGen] Don't emit attribute name getters when there are no attributes

This avoids generating otherwise unnecessary methods.

3 years ago[OpenMP] Introduce an CMake find module for OpenMP Target support
Joseph Huber [Tue, 22 Jun 2021 03:35:45 +0000 (23:35 -0400)]
[OpenMP] Introduce an CMake find module for OpenMP Target support

This introduces a CMake find module for detecting target offloading support in
a compiler. The goal is to make it easier to incorporate target offloading into
a cmake project.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D104710

3 years ago[mlir] Fix slicing-utils.mlir test after D104516
River Riddle [Wed, 23 Jun 2021 02:52:05 +0000 (02:52 +0000)]
[mlir] Fix slicing-utils.mlir test after D104516

Remove the duplicate unnecessary CHECK labels at the bottom of the file.

3 years ago[gn build] don't build ubsan_minimal on mac
Nico Weber [Wed, 23 Jun 2021 02:21:18 +0000 (22:21 -0400)]
[gn build] don't build ubsan_minimal on mac

It doesn't build there, see http://45.33.8.238/macm1/12180/step_4.txt

3 years ago[mlir] Add a ThreadPool to MLIRContext and refactor MLIR threading usage
River Riddle [Wed, 23 Jun 2021 01:16:55 +0000 (01:16 +0000)]
[mlir] Add a ThreadPool to MLIRContext and refactor MLIR threading usage

This revision refactors the usage of multithreaded utilities in MLIR to use a common
thread pool within the MLIR context, in addition to a new utility that makes writing
multi-threaded code in MLIR less error prone. Using a unified thread pool brings about
several advantages:

* Better thread usage and more control
We currently use the static llvm threading utilities, which do not allow multiple
levels of asynchronous scheduling (even if there are open threads). This is due to
how the current TaskGroup structure works, which only allows one truly multithreaded
instance at a time. By having our own ThreadPool we gain more control and flexibility
over our job/thread scheduling, and in a followup can enable threading more parts of
the compiler.

* The static nature of TaskGroup causes issues in certain configurations
Due to the static nature of TaskGroup, there have been quite a few problems related to
destruction that have caused several downstream projects to disable threading. See
D104207 for discussion on some related fallout. By having a ThreadPool scoped to
the context, we don't have to worry about destruction and can ensure that any
additional MLIR thread usage ends when the context is destroyed.

Differential Revision: https://reviews.llvm.org/D104516

3 years ago[mlir][NFC] Cleanup the MLIRTestReducer pass
River Riddle [Wed, 23 Jun 2021 01:16:43 +0000 (01:16 +0000)]
[mlir][NFC] Cleanup the MLIRTestReducer pass

3 years ago[libcxx][NFC] prepares `<type_traits>` for moving out forward and swap
Christopher Di Bella [Tue, 22 Jun 2021 19:21:46 +0000 (19:21 +0000)]
[libcxx][NFC] prepares `<type_traits>` for moving out forward and swap

* `<type_traits>` depends on `std::forward`, so we replaced it with
  `static_cast<T&&>`.
* `swap`'s return type is confusing, so it's been rearranged to improve
   readabilitiy.

3 years ago[Remarks] Make memsize remarks report as an analysis, not a missed opportunity.
Jon Roelofs [Thu, 10 Jun 2021 23:48:45 +0000 (16:48 -0700)]
[Remarks] Make memsize remarks report as an analysis, not a missed opportunity.

Differential revision: https://reviews.llvm.org/D104078

3 years ago[llvm][Inliner] Make PriorityInlineOrder lazily updated
Liqiang Tao [Wed, 23 Jun 2021 00:59:31 +0000 (08:59 +0800)]
[llvm][Inliner] Make PriorityInlineOrder lazily updated

This patch makes PriorityInlineOrder lazily updated.
The PriorityInlineOrder would lazily update the desirability of a call site if it's decreasing.

Reviewed By: kazu

Differential Revision: https://reviews.llvm.org/D104654

3 years ago[mlir][NFC] Move several small methods from .cpp to .h to allow more aggressive inlining
River Riddle [Wed, 23 Jun 2021 00:46:29 +0000 (00:46 +0000)]
[mlir][NFC] Move several small methods from .cpp to .h to allow more aggressive inlining

Differential Revision: https://reviews.llvm.org/D104756

3 years agogn build: Only build the TSan runtime on 64-bit platforms.
Peter Collingbourne [Tue, 22 Jun 2021 21:43:58 +0000 (14:43 -0700)]
gn build: Only build the TSan runtime on 64-bit platforms.

TSan only supports 64-bit platforms.

Differential Revision: https://reviews.llvm.org/D104755

3 years agogn build: Add support for building ubsan_minimal.
Peter Collingbourne [Wed, 24 Jun 2020 02:31:23 +0000 (19:31 -0700)]
gn build: Add support for building ubsan_minimal.

Differential Revision: https://reviews.llvm.org/D104754

3 years ago[scudo] Handle predefined M_MEMTAG_TUNING_* constants (NFC).
Evgenii Stepanov [Tue, 22 Jun 2021 23:40:17 +0000 (16:40 -0700)]
[scudo] Handle predefined M_MEMTAG_TUNING_* constants (NFC).

Bionic <malloc.h> may provide the definitions of M_MEMTAG_TUNING_* constants.
Do not redefine them in that case.

Differential Revision: https://reviews.llvm.org/D104758

3 years ago[SemaCXX] Handle lack of TypeSourceInfo on special member functions in templated...
Bruno Cardoso Lopes [Tue, 22 Jun 2021 22:14:26 +0000 (15:14 -0700)]
[SemaCXX] Handle lack of TypeSourceInfo on special member functions in templated lambdas

During template instantiation involving templated lambdas, clang
could hit an assertion in `TemplateDeclInstantiator::SubstFunctionType`
since the functions are not associated with any `TypeSourceInfo`:

`assert(OldTInfo && "substituting function without type source info");`

This path is triggered when using templated lambdas like the one added as
a test to this patch. To fix this:

- Create `TypeSourceInfo`s for special members and make sure the template
instantiator can get through all patterns.
- Introduce a `SpecialMemberTypeInfoRebuilder` tree transform to rewrite
such member function arguments. Without this, we get errors like:

`error: only special member functions and comparison operators may be defaulted`

since `getDefaultedFunctionKind` can't properly recognize these functions
as special members as part of `SetDeclDefaulted`.

Fixes PR45828 and PR44848

Differential Revision: https://reviews.llvm.org/D88327

3 years ago[CSSPGO][llvm-profgen] Handle return to external transition.
Hongtao Yu [Fri, 18 Jun 2021 16:30:38 +0000 (09:30 -0700)]
[CSSPGO][llvm-profgen] Handle return to external transition.

In a callback case, a return from internal code, say A, to external runtime can happen. The external runtime can then call back to another internal routine, say B. Making an artificial branch that looks like a return from A to B can confuse the unwinder to treat the instruction before B as the call instruction.

Reviewed By: wenlei, wmi

Differential Revision: https://reviews.llvm.org/D104546

3 years agoRevert "Revert "[cmake] [compiler-rt] Call llvm_setup_rpath() when adding shared...
Petr Hosek [Tue, 22 Jun 2021 23:11:29 +0000 (16:11 -0700)]
Revert "Revert "[cmake] [compiler-rt] Call llvm_setup_rpath() when adding shared libraries.""

This reverts commit 21c008d5a5b1e0c2ec3c1659cff961f4b0ccea2c since
it broke the build on macOS and Windows with the following error:

  The install of the clang_rt.<na,e> target requires changing an
  RPATH from the build tree, but this is not supported with the Ninja
  generator unless on an ELF-based platform.  The
  CMAKE_BUILD_WITH_INSTALL_RPATH variable may be set to avoid this relinking
  step.

3 years agoprecommit test for D104665
Philip Reames [Tue, 22 Jun 2021 22:48:38 +0000 (15:48 -0700)]
precommit test for D104665

3 years ago[ELF] Optimize ScriptLexer::getLineNumber by caching the previous line number and...
Colin Cross [Tue, 22 Jun 2021 22:35:23 +0000 (15:35 -0700)]
[ELF] Optimize ScriptLexer::getLineNumber by caching the previous line number and offset

getLineNumber() was counting the number of line feeds from the start of
the buffer to the current token. For large linker scripts this became a
performance bottleneck. For one 4MB linker script over 4 minutes was
spent in getLineNumber's StringRef::count.

Store the line number from the last token, and only count the additional
line feeds since the last token.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D104137

3 years ago[Attributor] Fix AAExecutionDomain returning true on invalid states
Joseph Huber [Tue, 22 Jun 2021 20:58:13 +0000 (16:58 -0400)]
[Attributor] Fix AAExecutionDomain returning true on invalid states

This patch fixes a problem with the AAExecutionDomain attributor not
checking if it is in a valid state. This can cause it to incorrectly
return that a block is executed in a single threaded context after the
attributor failed for any reason.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D103186

3 years ago[clang] unbreak Index/preamble-reparse-changed-module.m with LLVM_APPEND_VC_REV=NO...
Nico Weber [Tue, 22 Jun 2021 21:55:44 +0000 (17:55 -0400)]
[clang] unbreak Index/preamble-reparse-changed-module.m with LLVM_APPEND_VC_REV=NO after 7942ebdf01b3

See revision b8b7a9dcdcbc for prior art.

3 years agogn build: Rebase clang-tblgen include path against root_build_dir instead of root_out...
Peter Collingbourne [Tue, 22 Jun 2021 21:19:18 +0000 (14:19 -0700)]
gn build: Rebase clang-tblgen include path against root_build_dir instead of root_out_dir.

Fixes clang cross-compilation.

Also remove some redundant include path arguments.

3 years ago[mlir][sparse] integration test for "simply dynamic" sparse output tensors
Aart Bik [Sat, 19 Jun 2021 01:12:44 +0000 (18:12 -0700)]
[mlir][sparse] integration test for "simply dynamic" sparse output tensors

Reviewed By: gussmith23

Differential Revision: https://reviews.llvm.org/D104583

3 years ago[compiler-rt] Make use of undefined symbols configurable
Petr Hosek [Tue, 22 Jun 2021 18:03:37 +0000 (11:03 -0700)]
[compiler-rt] Make use of undefined symbols configurable

We want to disable the use of undefined symbols on Fuchsia, but there
are cases where it might be desirable so may it configurable.

Differential Revision: https://reviews.llvm.org/D104728

3 years ago[mlir] Fix build on gcc-5 after D104167
River Riddle [Tue, 22 Jun 2021 21:15:17 +0000 (21:15 +0000)]
[mlir] Fix build on gcc-5 after D104167

3 years ago[PowerPC][NFC] Clean up builtin sema checks
Lei Huang [Mon, 21 Jun 2021 19:00:43 +0000 (14:00 -0500)]
[PowerPC][NFC] Clean up builtin sema checks

Cleanup sema checking for 64bit builtins or builtins that require
         specific feature support.

Reviewed By: NeHuang

Differential Revision: https://reviews.llvm.org/D104664

3 years ago[flang] [NFC] Repair build with GCC 7.3
peter klausler [Tue, 22 Jun 2021 18:29:14 +0000 (11:29 -0700)]
[flang] [NFC] Repair build with GCC 7.3

Work around two problems with GCC 7.3.
One is its inability to implement "constexpr operator=(...) = default;"
in a class with a std::optional<> component; another is a legitimate-
looking warning about an unused variable.

Differential Revision: https://reviews.llvm.org/D104731

3 years ago[OpenMP] Change remaining globalization from an analysis remark to missed
Joseph Huber [Tue, 22 Jun 2021 18:57:52 +0000 (14:57 -0400)]
[OpenMP] Change remaining globalization from an analysis remark to missed

After landing the globalization optimizations, the precense of globalization on
the device that was not put in shared or stack memory is a failed optimization
with performance consequences so it should indicate a missed remark.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D104735

3 years ago[clangd] Dont index ObjCCategoryDecls for completion
Kadir Cetinkaya [Fri, 18 Jun 2021 15:25:00 +0000 (17:25 +0200)]
[clangd] Dont index ObjCCategoryDecls for completion

They are already provided by Sema, deserializing from preamble if need
be. Moreover category names are meaningless outside interface/implementation
context, hence they were only causing noise.

Differential Revision: https://reviews.llvm.org/D104540

3 years ago[mlir][sparse] add support for "simply dynamic" sparse tensor expressions
Aart Bik [Fri, 18 Jun 2021 23:24:55 +0000 (16:24 -0700)]
[mlir][sparse] add support for "simply dynamic" sparse tensor expressions

Slowly we are moving toward full support of sparse tensor *outputs*. First
step was support for all-dense annotated "sparse" tensors. This step adds
support for truly sparse tensors, but only for operations in which the values
of a tensor change, but not the nonzero structure (this was refered to as
"simply dynamic" in the [Bik96] thesis).

Some background text was posted on discourse:
https://llvm.discourse.group/t/sparse-tensors-in-mlir/3389/25

Reviewed By: gussmith23

Differential Revision: https://reviews.llvm.org/D104577

3 years ago[clang] Add cc1 option for dumping layout for all complete types
David Tenty [Mon, 21 Jun 2021 19:37:10 +0000 (15:37 -0400)]
[clang] Add cc1 option for dumping layout for all complete types

This change adds an option which, in addition to dumping the record
layout as is done by -fdump-record-layouts, causes us to compute the
layout for all complete record types (rather than the as-needed basis
which is usually done by clang), so that we will dump them as well.
This is useful if we are looking for layout differences across large
code bases without needing to instantiate every type we are interested in.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D104484

3 years ago[OpenMP] Add thread limit environment variable support to plugins
Joseph Huber [Tue, 8 Jun 2021 19:12:24 +0000 (15:12 -0400)]
[OpenMP] Add thread limit environment variable support to plugins

The OpenMP 5.1 standard defines the environment variable
`OMP_TEAMS_THREAD_LIMIT` to limit the number of threads that will be run in a
single block. This patch adds support for this into the AMDGPU and CUDA
plugins.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D103923

3 years ago[libc++] NFC: Remove unused c++98 Lit feature
Louis Dionne [Tue, 22 Jun 2021 20:24:22 +0000 (16:24 -0400)]
[libc++] NFC: Remove unused c++98 Lit feature

3 years ago[mlir] Remove the Identifier ThreadLocalCache from MLIRContext
River Riddle [Tue, 22 Jun 2021 19:13:57 +0000 (19:13 +0000)]
[mlir] Remove the Identifier ThreadLocalCache from MLIRContext

This used to be important for reducing lock contention when accessing identifiers, but
the cost of the cache can be quite large if parsing in a multi-threaded context. After
D104167, the win of keeping a cache is not worth the cost.

Differential Revision: https://reviews.llvm.org/D104737

3 years ago[mlir][OpGen] Cache Identifiers for known attribute names in AbstractOperation.
River Riddle [Tue, 22 Jun 2021 19:13:35 +0000 (19:13 +0000)]
[mlir][OpGen] Cache Identifiers for known attribute names in AbstractOperation.

Operations currently rely on the string name of attributes during attribute lookup/removal/replacement, in build methods, and more. This unfortunately means that some of the most used APIs in MLIR require string comparisons, additional hashing(+mutex locking) to construct Identifiers, and more. This revision remedies this by caching identifiers for all of the attributes of the operation in its corresponding AbstractOperation. Just updating the autogenerated usages brings up to a 15% reduction in compile time, greatly reducing the cost of interacting with the attributes of an operation. This number can grow even higher as we use these methods in handwritten C++ code.

Methods for accessing these cached identifiers are exposed via `<attr-name>AttrName` methods on the derived operation class. Moving forward, users should generally use these methods over raw strings when an attribute name is necessary.

Differential Revision: https://reviews.llvm.org/D104167

3 years agoAdd regression test for maybeMangle issue
Reid Kleckner [Tue, 22 Jun 2021 19:53:48 +0000 (12:53 -0700)]
Add regression test for maybeMangle issue

This was crbug.com/1222724, which caused D104529 to be reverted. The
new test fails when D104529 is reapplied locally.

3 years agoIntroduce a Bazel build configuration
Geoffrey Martin-Noble [Tue, 18 May 2021 22:42:25 +0000 (15:42 -0700)]
Introduce a Bazel build configuration

This patch introduces configuration for a Bazel BUILD in a side
directory in the monorepo.

This is following the approval of
https://github.com/llvm/llvm-www/blob/main/proposals/LP0002-BazelBuildConfiguration.md

As detailed in the README, the Bazel BUILD is not supported
by the community in general, and is maintained only by interested
parties. It follows the requirements of the LLVM peripheral tier:
https://llvm.org/docs/SupportPolicy.html#peripheral-tier.

This is largely copied from https://github.com/google/llvm-bazel,
with a few filepath tweaks and the addition of the README.

Reviewed By: echristo, keith, dblaikie, kuhar

Differential Revision: https://reviews.llvm.org/D90352

3 years ago[clang-format] Add new LambdaBodyIndentation option
Vitali Lovich [Tue, 22 Jun 2021 18:39:27 +0000 (20:39 +0200)]
[clang-format] Add new LambdaBodyIndentation option

Currently the lambda body indents relative to where the lambda signature is located. This instead lets the user
choose to align the lambda body relative to the parent scope that contains the lambda declaration. Thus:

someFunction([] {
  lambdaBody();
});

will always have the same indentation of the body even when the lambda signature goes on a new line:

someFunction(
    [] {
  lambdaBody();
});

whereas before lambdaBody would be indented 6 spaces.

Differential Revision: https://reviews.llvm.org/D102706

3 years agoRevert "[cmake] [compiler-rt] Call llvm_setup_rpath() when adding shared libraries."
Petr Hosek [Tue, 22 Jun 2021 18:55:23 +0000 (11:55 -0700)]
Revert "[cmake] [compiler-rt] Call llvm_setup_rpath() when adding shared libraries."

This reverts commit 78fd93e0396a19cb89d4b874c7cc42255888df56 as
a follow up to D91099.

3 years ago[gn build] manually port c747b7d1d9a2 more (config.osx_sysroot)
Nico Weber [Tue, 22 Jun 2021 19:31:33 +0000 (15:31 -0400)]
[gn build] manually port c747b7d1d9a2 more (config.osx_sysroot)

3 years agoMake lit configs relocatable again after c747b7d1d9a
Nico Weber [Tue, 22 Jun 2021 19:20:05 +0000 (15:20 -0400)]
Make lit configs relocatable again after c747b7d1d9a

See https://reviews.llvm.org/D77184 for background.

3 years ago[llvm-diff] Explicitly check ConstantArrays
Bill Wendling [Tue, 22 Jun 2021 00:41:47 +0000 (17:41 -0700)]
[llvm-diff] Explicitly check ConstantArrays

Global initializers may be ConstantArrays. They need to be checked
explicitly, because different-yet-still-equivalent type names may be
used for each, and/or a GEP instruction may appear in one.

3 years ago[llvm-diff] Add support for diffing the callbr instruction
Bill Wendling [Sun, 20 Jun 2021 21:45:12 +0000 (14:45 -0700)]
[llvm-diff] Add support for diffing the callbr instruction

The only wrinkle is that we can't process the "blockaddress" arguments
of the callbr until the blocks have been equated. So we force them to be
"unified" before checking.

This was left out when the callbr instruction was added.

Differential Revision: https://reviews.llvm.org/D104606

3 years agoRevert "[compiler-rt] Make use of undefined symbols configurable"
Nikita Popov [Tue, 22 Jun 2021 19:17:40 +0000 (21:17 +0200)]
Revert "[compiler-rt] Make use of undefined symbols configurable"

This reverts commit ed7086ad46f99f639b85ea6c8bda7c1a71be7c53.
This reverts commit b9792638b0bfb308e0c7c125ac78f4ebf910c11b.

This breaks cmake with message:

    CMake Error at llvm-project/compiler-rt/CMakeLists.txt:449:
      Parse error.  Expected "(", got newline with text "

3 years ago[OpaquePtr] Support changing load type in InstCombine
Nikita Popov [Tue, 22 Jun 2021 15:20:44 +0000 (17:20 +0200)]
[OpaquePtr] Support changing load type in InstCombine

When the load type is changed to ptr, we need the load pointer type
to also be ptr, because it's not allowed to create a pointer to an
opaque pointer. This is achieved by adjusting the getPointerTo() API
to return an opaque pointer for an opaque pointer base type.

Differential Revision: https://reviews.llvm.org/D104718

3 years agoRevert "ThinLTO: Fix inline assembly references to static functions with CFI"
Sami Tolvanen [Tue, 22 Jun 2021 19:09:44 +0000 (12:09 -0700)]
Revert "ThinLTO: Fix inline assembly references to static functions with CFI"

This reverts commit 4474958d3a97dede2caa0920f7c4a4dc7aac57d3.

Breaks check-llvm on Mac.

3 years ago[OpenMP] Remove OpenMP CUDA Target Parallel compiler flag
Joseph Huber [Fri, 21 May 2021 18:43:44 +0000 (14:43 -0400)]
[OpenMP] Remove OpenMP CUDA Target Parallel compiler flag

Summary:
The changes introduced in D97680 turns this command line option into a no-op so
it can be removed entirely.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D102940

3 years ago[libcxx][doc] corrects LWG links in the One Ranges section
Christopher Di Bella [Tue, 22 Jun 2021 18:58:30 +0000 (18:58 +0000)]
[libcxx][doc] corrects LWG links in the One Ranges section

3 years ago[CMake] Fix the option declaration
Petr Hosek [Tue, 22 Jun 2021 18:58:26 +0000 (11:58 -0700)]
[CMake] Fix the option declaration

This addresses build issue introduced in
b9792638b0bfb308e0c7c125ac78f4ebf910c11b.

3 years ago[libcxx][docs] updates the ranges status paper
Christopher Di Bella [Fri, 28 May 2021 00:46:49 +0000 (00:46 +0000)]
[libcxx][docs] updates the ranges status paper

* indicates whether work has been started or completed
* consolidates content that was split for dependency reasons (iff
  everything has been merged)
* makes things a lot more fine-grained
* turns sub-CSVs into lists
* puts links into description section and removes patch column
* adds links to c++draft on occasion

These changes heavily prioritise the the reader of the generated HTML
file, not the source.

Differential Revision: https://reviews.llvm.org/D103295

3 years ago[compiler-rt] Make use of undefined symbols configurable
Petr Hosek [Tue, 22 Jun 2021 18:03:37 +0000 (11:03 -0700)]
[compiler-rt] Make use of undefined symbols configurable

We want to disable the use of undefined symbols on Fuchsia, but there
are cases where it might be desirable so may it configurable.

Differential Revision: https://reviews.llvm.org/D104728

3 years ago[compiler-rt][CMake] Drop flags that are set by default for Fuchsia
Petr Hosek [Mon, 21 Jun 2021 02:10:50 +0000 (19:10 -0700)]
[compiler-rt][CMake] Drop flags that are set by default for Fuchsia

-Wl,-z,now is set by the Fuchsia driver, -Wl,-z,relro is the default
in LLD.

3 years ago[CodeGen] Don't create fake FunctionDecls when generating block/byref
Akira Hatanaka [Tue, 22 Jun 2021 18:42:26 +0000 (11:42 -0700)]
[CodeGen] Don't create fake FunctionDecls when generating block/byref
copy/dispose helper functions

We found out that these fake functions would cause clang to crash if the
changes proposed in https://reviews.llvm.org/D98799 were made.

Differential Revision: https://reviews.llvm.org/D104082