platform/upstream/llvm.git
3 years ago[MLIR] Make structured op tests permutation invariant
Geoffrey Martin-Noble [Thu, 18 Feb 2021 20:56:42 +0000 (12:56 -0800)]
[MLIR] Make structured op tests permutation invariant

Extracts the relevant dimensions from the map under test to build up the
maps to test against in a permutation-invariant way.

This also includes a fix to the indexing maps used by
isColumnMajorMatmul. The maps as currently written do not describe a
column-major matmul. The linalg named op column_major_matmul has the
correct maps (and notably fails the current test).

If `C = matmul(A, B)` we want an operation that given A in column major
format and B in column major format produces C in column major format.
Given that for a matrix, faux column major is just transpose.
`column_major_matmul(transpose(A), transpose(B)) = transpose(C)`. If
`A` is `NxK` and `B` is `KxM`, then `C` is `NxM`, so `transpose(A)` is
`KxN`, `transpose(B)` is `MxK` and `transpose(C)` is `MxN`, not `NxM`
as these maps currently have.

Reviewed By: nicolasvasilache

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

3 years ago[Coverage] Store compilation dir separately in coverage mapping
Petr Hosek [Wed, 10 Feb 2021 08:25:34 +0000 (00:25 -0800)]
[Coverage] Store compilation dir separately in coverage mapping

We currently always store absolute filenames in coverage mapping.  This
is problematic for several reasons. It poses a problem for distributed
compilation as source location might vary across machines.  We are also
duplicating the path prefix potentially wasting space.

This change modifies how we store filenames in coverage mapping. Rather
than absolute paths, it stores the compilation directory and file paths
as given to the compiler, either relative or absolute. Later when
reading the coverage mapping information, we recombine relative paths
with the working directory. This approach is similar to handling
ofDW_AT_comp_dir in DWARF.

Finally, we also provide a new option, -fprofile-compilation-dir akin
to -fdebug-compilation-dir which can be used to manually override the
compilation directory which is useful in distributed compilation cases.

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

3 years agoGlobalISel: Merge some AMDGPU ABI lowering code to generic code
Matt Arsenault [Sun, 7 Feb 2021 17:12:31 +0000 (12:12 -0500)]
GlobalISel: Merge some AMDGPU ABI lowering code to generic code

AMDGPU currently has a lot of pre-processing code to pre-split
argument types into 32-bit pieces before passing it to the generic
code in handleAssignments. This is a bit sloppy and also requires some
overly fancy iterator work when building the calls. It's better if all
argument marshalling code is handled directly in
handleAssignments. This handles more situations like decomposing large
element vectors into sub-element sized pieces.

This should mostly be NFC, but does change the generated code by
shifting where the initial argument packing instructions are placed. I
think this is nicer looking, since it now emits the packing code
directly after the relevant copies, rather than after the copies for
the remaining arguments.

This doubles down on gfx6/gfx7 using the gfx8+ ABI for 16-bit
types. This is ultimately the better option, but incompatible with the
DAG. Fixing this requires more work, especially for f16.

3 years ago[BasicAA] Always strip single-argument phi nodes
Nikita Popov [Sun, 14 Feb 2021 20:24:36 +0000 (21:24 +0100)]
[BasicAA] Always strip single-argument phi nodes

We can always look through single-argument (LCSSA) phi nodes when
performing alias analysis. getUnderlyingObject() already does this,
but stripPointerCastsAndInvariantGroups() does not. We still look
through these phi nodes with the usual aliasPhi() logic, but
sometimes get sub-optimal results due to the restrictions on value
equivalence when looking through arbitrary phi nodes. I think it's
generally beneficial to keep the underlying object logic and the
pointer cast stripping logic in sync, insofar as it is possible.

With this patch we get marginally better results:

  aa.NumMayAlias | 5010069 | 5009861
  aa.NumMustAlias | 347518 | 347674
  aa.NumNoAlias | 27201336 | 27201528
  ...
  licm.NumPromoted | 1293 | 1296

I've renamed the relevant strip method to stripPointerCastsForAliasAnalysis(),
as we're past the point where we can explicitly spell out everything
that's getting stripped.

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

3 years ago[mlir] Fold trivial subtensor / subtensor_insert ops.
Nicolas Vasilache [Thu, 18 Feb 2021 21:33:03 +0000 (21:33 +0000)]
[mlir] Fold trivial subtensor / subtensor_insert ops.

Static subtensor / subtensor_insert of the same size as the source / destination tensor and root @[0..0] with strides [1..1] are folded away.

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

3 years ago[libc] Add implementations of the remaining fenv functions.
Siva Chandra Reddy [Tue, 16 Feb 2021 06:36:55 +0000 (22:36 -0800)]
[libc] Add implementations of the remaining fenv functions.

Namely, implementations of fegetexceptfflag, fesetexceptflag,
fegetenv, fesetenv, feholdexcept and feupdateenv have been added.

Reviewed By: lntue

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

3 years ago[DAG] getTruncatedUSUBSAT - always truncate operands. NFCI.
Simon Pilgrim [Thu, 18 Feb 2021 21:28:39 +0000 (21:28 +0000)]
[DAG] getTruncatedUSUBSAT - always truncate operands. NFCI.

As noticed on D96703, we're always truncating the operands so should use getNode(ISD::TRUNCATE) instead of getZExtOrTrunc.

3 years agoMove a second variable only used in an assert into the assert.
Sterling Augustine [Thu, 18 Feb 2021 21:25:37 +0000 (13:25 -0800)]
Move a second variable only used in an assert into the assert.

This prevents unused variable warnings when building without asserts.

3 years ago[DAGCombiner] Transform (zext (select c, load1, load2)) -> (select c, zextload1,...
Guozhi Wei [Thu, 18 Feb 2021 21:12:19 +0000 (13:12 -0800)]
[DAGCombiner] Transform (zext (select c, load1, load2)) -> (select c, zextload1, zextload2)

If extload is legal, following transform
    (zext (select c, load1, load2)) -> (select c, zextload1, zextload2)
can save one ext instruction.

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

3 years ago[flang] Extension: forward refs to dummy args under IMPLICIT NONE
peter klausler [Thu, 18 Feb 2021 19:55:31 +0000 (11:55 -0800)]
[flang] Extension: forward refs to dummy args under IMPLICIT NONE

Most Fortran compilers accept the following benign extension,
and it appears in some applications:

  SUBROUTINE FOO(A,N)
    IMPLICIT NONE
    REAL A(N) ! N is used before being typed
    INTEGER N
  END

Allow it in f18 only for default integer scalar dummy arguments.

Differential Revesion: https://reviews.llvm.org/D96982

3 years ago[gn build] kind of merge f020544601
Nico Weber [Thu, 18 Feb 2021 21:12:04 +0000 (16:12 -0500)]
[gn build] kind of merge f020544601

Fixes check-llvm with a clean build dir.

3 years agoImplement -bundle_loader
Vy Nguyen [Wed, 3 Feb 2021 02:23:22 +0000 (21:23 -0500)]
Implement -bundle_loader

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

Usage: -bundle_loader <executable>
This option specifies the executable that will load the build output file being linked.
When building a bundle, users can use the --bundle_loader  to specify an executable
that contains symbols referenced, but not implemented in the bundle.

3 years agoMove variable only used in an assert into the assert.
Sterling Augustine [Thu, 18 Feb 2021 21:00:49 +0000 (13:00 -0800)]
Move variable only used in an assert into the assert.

This prevents unused variable warnings when building without asserts.

3 years ago[DCE] Add tests for non-willreturn function being removed (NFC)
Nikita Popov [Thu, 18 Feb 2021 20:25:14 +0000 (21:25 +0100)]
[DCE] Add tests for non-willreturn function being removed (NFC)

3 years agoRevert "[Coverage] Store compilation dir separately in coverage mapping"
Petr Hosek [Thu, 18 Feb 2021 20:47:40 +0000 (12:47 -0800)]
Revert "[Coverage] Store compilation dir separately in coverage mapping"

This reverts commit 97ec8fa5bb07e3f5bf25ddcb216b545cd3d03b65 since
the test is failing on some bots.

3 years ago[mlir][Vector] Fold tensor_cast + vector.transfer_read
Nicolas Vasilache [Thu, 18 Feb 2021 20:26:14 +0000 (20:26 +0000)]
[mlir][Vector] Fold tensor_cast + vector.transfer_read

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

3 years agoRemove redundent types in pr49185.ll
Ta-Wei Tu [Thu, 18 Feb 2021 20:44:27 +0000 (04:44 +0800)]
Remove redundent types in pr49185.ll

3 years ago[RISCV] Simplify VPseudoAMOEI multiclass. NFC
Craig Topper [Thu, 18 Feb 2021 20:35:23 +0000 (12:35 -0800)]
[RISCV] Simplify VPseudoAMOEI multiclass. NFC

lmul was already iterated in one of the loops. We don't need to recreate
it from a string.

3 years ago[AMDGPU] Correct gfx90c feature list
Stanislav Mekhanoshin [Thu, 18 Feb 2021 20:20:23 +0000 (12:20 -0800)]
[AMDGPU] Correct gfx90c feature list

Looks like we have forced FeatureXNACK and forgot
FeatureMadMacF32Insts.

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

3 years agoRevert "[AArch64] Adding Neon Polynomial vadd Intrinsics"
Pengxuan Zheng [Thu, 18 Feb 2021 20:36:02 +0000 (12:36 -0800)]
Revert "[AArch64] Adding Neon Polynomial vadd Intrinsics"

Revert the patch due to buildbot failures.

This reverts commit d9645059c5deeacf264bea0cf50eab459cf8e5bb.

3 years agoPerform memory accesses in the same addrspace as the corresponding memref.
Andrew Pritchard [Thu, 18 Feb 2021 20:21:11 +0000 (12:21 -0800)]
Perform memory accesses in the same addrspace as the corresponding memref.

It's not necessarily the case on all architectures that all memory is
addressable in addrspace 0, so casting the pointer to addrspace 0 is
liable to cause problems.

Reviewed By: aartbik, ftynse, nicolasvasilache

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

3 years ago[Coverage] Store compilation dir separately in coverage mapping
Petr Hosek [Wed, 10 Feb 2021 08:25:34 +0000 (00:25 -0800)]
[Coverage] Store compilation dir separately in coverage mapping

We currently always store absolute filenames in coverage mapping.  This
is problematic for several reasons. It poses a problem for distributed
compilation as source location might vary across machines.  We are also
duplicating the path prefix potentially wasting space.

This change modifies how we store filenames in coverage mapping. Rather
than absolute paths, it stores the compilation directory and file paths
as given to the compiler, either relative or absolute. Later when
reading the coverage mapping information, we recombine relative paths
with the working directory. This approach is similar to handling
ofDW_AT_comp_dir in DWARF.

Finally, we also provide a new option, -fprofile-compilation-dir akin
to -fdebug-compilation-dir which can be used to manually override the
compilation directory which is useful in distributed compilation cases.

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

3 years ago[clang] bump VERSION_MAJOR
Nico Weber [Thu, 18 Feb 2021 20:23:23 +0000 (15:23 -0500)]
[clang] bump VERSION_MAJOR

Somewhat speculative, see https://reviews.llvm.org/D96816#2572431

3 years ago[MLIR][TOSA] Add lowering from TOSA to Linalg for math-based and elementwise ops
natashaknk [Thu, 18 Feb 2021 20:09:59 +0000 (12:09 -0800)]
[MLIR][TOSA] Add lowering from TOSA to Linalg for math-based and elementwise ops

This patch adds lowering to Linalg for the following TOSA ops: negate, rsqrt, mul, select, clamp and reluN and includes support for signless integer and floating point types

Reviewed By: rsuderman

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

3 years ago[llvm][TextAPI] add equality operator for InterfaceFile
Sam Powell [Thu, 18 Feb 2021 19:27:54 +0000 (11:27 -0800)]
[llvm][TextAPI] add equality operator for InterfaceFile

This patch adds functionality to compare for the equality between `InterfaceFile`s based on attributes specific to linking.

Reviewed By: cishida, steven_wu

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

3 years ago[WebAssembly] Fix assert in lookup of section symbols
Wouter van Oortmerssen [Thu, 11 Feb 2021 01:34:05 +0000 (17:34 -0800)]
[WebAssembly] Fix assert in lookup of section symbols

Fixes assert in: https://bugs.llvm.org/show_bug.cgi?id=49036

getWasmSection creates sections if they don't exist, but doesn't add them to the Symbols table. This may cause problems in subsequent calls to getOrCreateSymbol which checks this table, the calls createSymbol assuming it doesn't exist, which then checks UsedNames and finds out it does exist, causing an assert on trying to rename a non-temp symbol.

I tried also fixing the somewhat unintuitive forced suffixing (adding `0`), but it turns out that WasmObjectWriter currently assumes these section symbols are unique, so that may have to be a separate fix: https://bugs.llvm.org/show_bug.cgi?id=49252

Also worth noting is that getWasmSection calling createSymbol may not be correct to start with, given that createSymbol seems to assume it is creating non-section symbols. But again, for a future fix.

Related: where some of this was introduced: https://github.com/llvm/llvm-project/commit/8d396acac3bc21f688ac707bb42e4698dbdcab7e

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

3 years ago[RISCV] Add Zbb command lines to uadd/usub/sadd/ssub tests.
Craig Topper [Thu, 18 Feb 2021 19:24:04 +0000 (11:24 -0800)]
[RISCV] Add Zbb command lines to uadd/usub/sadd/ssub tests.

The expansions of the saturating intrinsics can make use of
the min(u)/max(u) instructions in Zbb.

3 years ago[Coverage] Emit gap region after conditions when macro is present.
Zequan Wu [Thu, 18 Feb 2021 02:16:40 +0000 (18:16 -0800)]
[Coverage] Emit gap region after conditions when macro is present.

3 years ago[gn build] try to fix libxml2 include path on mac after 0ec448194e29
Nico Weber [Thu, 18 Feb 2021 19:40:14 +0000 (14:40 -0500)]
[gn build] try to fix libxml2 include path on mac after 0ec448194e29

3 years ago[RISCV] Use XLenRI alias for RegInfoByHwMode instances
Jessica Clarke [Sat, 13 Feb 2021 16:26:08 +0000 (16:26 +0000)]
[RISCV] Use XLenRI alias for RegInfoByHwMode instances

This avoids tedious repetition and matches what we do for the
ValueTypeByHwMode uses.

Reviewed By: craig.topper, luismarques

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

3 years ago[AArch64] Adding Neon Polynomial vadd Intrinsics
Pengxuan Zheng [Thu, 18 Feb 2021 19:32:35 +0000 (11:32 -0800)]
[AArch64] Adding Neon Polynomial vadd Intrinsics

This patch adds the following intrinsics:
            vadd_p8
            vadd_p16
            vadd_p64
            vaddq_p8
            vaddq_p16
            vaddq_p64
            vaddq_p128

Reviewed By: t.p.northover, DavidSpickett

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

3 years agofix comment typos to cycle bots
Nico Weber [Thu, 18 Feb 2021 19:24:56 +0000 (14:24 -0500)]
fix comment typos to cycle bots

3 years agoPre-commit test case
Guozhi Wei [Thu, 18 Feb 2021 19:05:29 +0000 (11:05 -0800)]
Pre-commit test case

Pre-commit test case for https://reviews.llvm.org/D95086, so that patch
can show the actual diff.

3 years ago[NPM] Properly reset parent loop after loop passes
Ta-Wei Tu [Thu, 18 Feb 2021 18:50:21 +0000 (02:50 +0800)]
[NPM] Properly reset parent loop after loop passes

This fixes https://bugs.llvm.org/show_bug.cgi?id=49185

When `NDEBUG` is not set, `LPMUpdater` checks if the added loops have the same parent loop as the current one in `addSiblingLoops`.
If multiple loop passes are executed through `LoopPassManager`, `U.ParentL` will be the same across all passes.
However, the parent loop might change after running a loop pass, resulting in assertion failures in subsequent passes.

This patch resets `U.ParentL` after running individual loop passes in `LoopPassManager`.

Reviewed By: asbirlea, ychen

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

3 years agolibcxx: use early returns
Joerg Sonnenberger [Wed, 17 Feb 2021 21:13:01 +0000 (22:13 +0100)]
libcxx: use early returns

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

3 years ago[lldb] Remove unused code in ScriptInterpreterPython
Jonas Devlieghere [Thu, 18 Feb 2021 18:37:30 +0000 (10:37 -0800)]
[lldb] Remove unused code in ScriptInterpreterPython

Remove the unused code I noticed when working on d6e80578fc5e and do
some other minor cleanups in the vicinity.

3 years ago[CFE, SystemZ] New target hook testFPKind() for checks of FP values.
Jonas Paulsson [Fri, 12 Feb 2021 01:57:26 +0000 (02:57 +0100)]
[CFE, SystemZ]  New target hook testFPKind() for checks of FP values.

The recent commit 00a6254 "Stop traping on sNaN in builtin_isnan" changed the
lowering in constrained FP mode of builtin_isnan from an FP comparison to
integer operations to avoid trapping.

SystemZ has a special instruction "Test Data Class" which is the preferred
way to do this check. This patch adds a new target hook "testFPKind()" that
lets SystemZ emit the s390_tdc intrinsic instead.

testFPKind() takes the BuiltinID as an argument and is expected to soon
handle more opcodes than just 'builtin_isnan'.

Review: Thomas Preud'homme, Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D96568

3 years ago[PowerPC][AIX] Add support for vector arg passing on the stack.
Sean Fertile [Thu, 18 Feb 2021 18:31:30 +0000 (13:31 -0500)]
[PowerPC][AIX] Add support for vector arg passing on the stack.

Enable passing more vector arguments then available vector
argument passing registers.

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

3 years ago[WebAssembly] Handle multiple EH_LABELs in EH pad
Heejin Ahn [Thu, 18 Feb 2021 17:21:33 +0000 (09:21 -0800)]
[WebAssembly] Handle multiple EH_LABELs in EH pad

Usually `EH_LABEL`s are placed in
- Before an `invoke` (which becomes calls in the backend)
- After an `invoke`
- At the start of an EH pad

I don't know exactly why, but I noticed there are cases of multiple, not
a single, `EH_LABEL` instructions in the beginning of an EH pad. In that
case `global.set` instruction placed to restore `__stack_pointer` ended
up between two `EH_LABEL` instructions before `CATCH`. It should follow
after the `EH_LABEL`s and `CATCH`. This CL fixes that case.

Reviewed By: dschuff

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

3 years ago[dfsan] Refactor defining TLS variables
Jianzhou Zhao [Thu, 18 Feb 2021 08:14:13 +0000 (08:14 +0000)]
[dfsan] Refactor defining TLS variables

This is a part of https://reviews.llvm.org/D95835.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D96941

3 years ago[dfsan] Refactor runtime functions checking
Jianzhou Zhao [Thu, 18 Feb 2021 08:04:30 +0000 (08:04 +0000)]
[dfsan] Refactor runtime functions checking

This is a part of https://reviews.llvm.org/D95835.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D96940

3 years ago[dfsan] Add origin tls/move/read APIs
Jianzhou Zhao [Fri, 12 Feb 2021 00:29:58 +0000 (00:29 +0000)]
[dfsan] Add origin tls/move/read APIs

This is a part of https://reviews.llvm.org/D95835.

Added
1) TLS storage
2) a weak global used to set by instrumented code
3) move origins

These APIs are similar to MSan's APIs
  https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/msan/msan_poisoning.cpp
We first improved MSan's by https://reviews.llvm.org/D94572 and https://reviews.llvm.org/D94552.
So the correctness has been verified by MSan.
After the DFSan instrument code is ready, we wil be adding more test
cases

4) read

To reduce origin tracking cost, some of the read APIs return only
the origin from the first taint data.

Note that we did not add origin set APIs here because they are related
to code instrumentation, will be added later with IR transformation
code.

Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D96564

3 years ago[lldb] Un-XFAIL TestFormatters on windows
Pavel Labath [Thu, 18 Feb 2021 15:27:47 +0000 (16:27 +0100)]
[lldb] Un-XFAIL TestFormatters on windows

The test passes after D96779.

3 years ago[ObjC] Encode pointers to C++ classes as "^v" if the encoded string
Akira Hatanaka [Thu, 18 Feb 2021 17:38:26 +0000 (09:38 -0800)]
[ObjC] Encode pointers to C++ classes as "^v" if the encoded string
would otherwise include template specialization types

This helps reduce the size of the encoded C++ type strings in the binary.

This is enabled by default only on Darwin, but can be enabled/disabled
via command line options.

rdar://63288571

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

3 years agoFix a buildbot warning triggered by 1dfb06d
Philip Reames [Thu, 18 Feb 2021 17:37:38 +0000 (09:37 -0800)]
Fix a buildbot warning triggered by 1dfb06d

3 years ago[RISCV] Pre-commit test file changes from D96661. NFC
Craig Topper [Thu, 18 Feb 2021 17:24:52 +0000 (09:24 -0800)]
[RISCV] Pre-commit test file changes from D96661. NFC

This includes i32 SHFLI tests for RV64 which we currently don't optimize.
And tests for associativity of OR.

3 years ago[flang][driver] Add missing dependency (nfc)
Andrzej Warzynski [Thu, 18 Feb 2021 17:02:23 +0000 (17:02 +0000)]
[flang][driver] Add missing dependency (nfc)

These dependencies were introduced via the `ParseTreeDumper` API in:
  * https://reviews.llvm.org/D96716
They manifested themselves in buildbot builders that set
`BUILD_SHARED_LIBS` to `On`.

3 years ago[RISCV] Add support for fixed vector MULHU/MULHS.
Craig Topper [Thu, 18 Feb 2021 17:09:33 +0000 (09:09 -0800)]
[RISCV] Add support for fixed vector MULHU/MULHS.

This uses to division by constant optimization to use MULHU/MULHS.

Reviewed By: frasercrmck, arcbbb

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

3 years ago[verify-regalloc] Verify after allocation and before postOptimization
Philip Reames [Thu, 18 Feb 2021 17:08:56 +0000 (09:08 -0800)]
[verify-regalloc] Verify after allocation and before postOptimization

I've now hit several cases where a mistake in the regalloc main loop caused corrupt live intervals that didn't get caught until either the next verify or during post-optimization.  The later case is rather confusing and tends to lead one down false trails, so let's catch corruption before that.

3 years ago[clang][SVE] Use __inline__ instead of inline in arm_sve.h
Joe Ellis [Thu, 18 Feb 2021 17:08:12 +0000 (17:08 +0000)]
[clang][SVE] Use __inline__ instead of inline in arm_sve.h

The inline keyword is not defined in the C89 standard, so source files
that include arm_sve.h will fail compilation if -std=c89 is specified.
For consistency with arm_neon.h, we should use __inline__ instead.

Reviewed By: paulwalker-arm

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

3 years ago[RISCV] Add support for fixed vector sign/zero extend from mask types.
Craig Topper [Thu, 18 Feb 2021 17:01:51 +0000 (09:01 -0800)]
[RISCV] Add support for fixed vector sign/zero extend from mask types.

Due to vXi64 on RV32, I've directly emitted this using _VL ISD
opcodes. If it wasn't for that we could just use fixed vector
BUILD_VECTOR and VSELECT and let those each be legalized.

Reviewed By: frasercrmck

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

3 years ago[RISCV] Support isel of scalable vector bitcasts
Craig Topper [Thu, 18 Feb 2021 16:54:03 +0000 (08:54 -0800)]
[RISCV] Support isel of scalable vector bitcasts

These should be NOPs so we can just replace with the input. This
matches what SVE does with isel patterns for all permutations.
Custom isel saves us from having to list all permurations for
all LMULs.

Reviewed By: frasercrmck

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

3 years ago[splitkit] Add a minor wrapper function for readability [NFC]
Philip Reames [Thu, 18 Feb 2021 16:59:38 +0000 (08:59 -0800)]
[splitkit] Add a minor wrapper function for readability [NFC]

3 years agolibcxx: fix a documentation typo
Nico Weber [Thu, 18 Feb 2021 16:58:48 +0000 (11:58 -0500)]
libcxx: fix a documentation typo

See `grep 'option.LIBCXX_INCLUDE_TESTS' libcxx/CMakeLists.txt`.

3 years ago[gn build] fix mistake in 0ec448194e29
Nico Weber [Thu, 18 Feb 2021 16:57:38 +0000 (11:57 -0500)]
[gn build] fix mistake in 0ec448194e29

3 years agoAMDGPU: Fix checks in llvm.amdgcn.workitem.id.ll
Konstantin Zhuravlyov [Thu, 18 Feb 2021 16:55:25 +0000 (11:55 -0500)]
AMDGPU: Fix checks in llvm.amdgcn.workitem.id.ll

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

3 years ago[AArch64][SVE] Add patterns to generate FMLA/FMLS/FNMLA/FNMLS/FMAD
Bradley Smith [Mon, 8 Feb 2021 16:52:19 +0000 (16:52 +0000)]
[AArch64][SVE] Add patterns to generate FMLA/FMLS/FNMLA/FNMLS/FMAD

Adjust generateFMAsInMachineCombiner to return false if SVE is present
in order to combine fmul+fadd into fma. Also add new pseudo instructions
so as to select the most appropriate of FMLA/FMAD depending on register
allocation.

Depends on D96599

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

3 years ago[TableGen][SelectionDAG] Improve efficiency of encoding negative immediates for isel...
Craig Topper [Thu, 18 Feb 2021 16:45:08 +0000 (08:45 -0800)]
[TableGen][SelectionDAG] Improve efficiency of encoding negative immediates for isel's CheckInteger opcode.

CheckInteger uses an int64_t encoded using a variable width encoding
that is optimized for encoding a number with a lot of leading zeros.
Negative numbers have no leading zeros so use the largest encoding
requiring 9 bytes.

I believe its most like we want to check for positive and negative
numbers near 0. -1 is quite common due to its use in the 'not'
idiom.

To optimize for this, we can borrow an idea from the bitcode format
and move the sign bit to bit 0 with the magnitude stored in the
upper bits. This will drastically increase the number of leading
zeros for small magnitudes. Then we can run this value through
VBR encoding.

This gives a small reduction in the table size on all in tree
targets except VE where size increased by about 300 bytes due
to intrinsic ids now requiring 3 bytes instead of 2. Since the
intrinsic enum space is shared by all targets this an unfortunate
consquence of where VE is currently located in the range.

Reviewed By: RKSimon

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

3 years ago[AArch64] Allow folding FMUL/FADD into FMA for FP16 types
Bradley Smith [Fri, 12 Feb 2021 12:51:10 +0000 (12:51 +0000)]
[AArch64] Allow folding FMUL/FADD into FMA for FP16 types

isFMAFasterThanFMulAndFAdd should return true for FP16 types when
HasFullFP16 is present, since we have the instructions to handle it for
both SVE and NEON. (SVE patterns and tests will follow).

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

3 years ago[regalloc] Add a couple of dump routines for ease of debugging [NFC]
Philip Reames [Thu, 18 Feb 2021 16:50:00 +0000 (08:50 -0800)]
[regalloc] Add a couple of dump routines for ease of debugging [NFC]

3 years ago[instcombine] Exploit UB implied by nofree attributes
Philip Reames [Thu, 18 Feb 2021 16:33:12 +0000 (08:33 -0800)]
[instcombine] Exploit UB implied by nofree attributes

This patch simply implements the documented UB of the current nofree attributes as specified. It doesn't try to be fancy about inference (yet), it just implements the cases already specified and inferred.

Note: When this lands, it may expose miscompiles. If so, please revert and provide a test case. It's likely the bug is in the existing inference code and without a relatively complete test case, it will be hard to debug.

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

3 years ago[clang] functions with the 'const' or 'pure' attribute must always return.
Jeroen Dobbelaere [Thu, 18 Feb 2021 16:29:46 +0000 (17:29 +0100)]
[clang] functions with the 'const' or 'pure' attribute must always return.

As described in
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute
* https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute

An `__attribute__((pure))` function must always return, as well as an `__attribute__((const))` function.

Reviewed By: jdoerfert

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

3 years ago[clangd] Populate detail field in document symbols
lightmelodies [Thu, 18 Feb 2021 15:34:06 +0000 (16:34 +0100)]
[clangd] Populate detail field in document symbols

This commit fix https://github.com/clangd/clangd/issues/520 and https://github.com/clangd/clangd/issues/601.
{F15544293}

Reviewed By: sammccall

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

3 years agosysroot.py: add support for darwin
Nico Weber [Thu, 18 Feb 2021 14:30:47 +0000 (09:30 -0500)]
sysroot.py: add support for darwin

This is a tiny bit messy because compiler-rt needs different sysroots for
macOS, iOS, etc. We want sysroot.py to create something that is a hermetic
representation of all build deps, so it needs to create a directory that
contains all needed SDKs, and these subdirectories are then passed to
cmake which passes each of these _subdirectories_ as different -isysroot
flags while building the runtime libraries.

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

3 years agoPass the cmdline aapcs bitfield options to cc1
Ties Stuij [Tue, 16 Feb 2021 13:56:15 +0000 (13:56 +0000)]
Pass the cmdline aapcs bitfield options to cc1

The following commits added commandline arguments to control following the Arm
Procedure Call Standard for certain volatile bitfield operations:
- https://reviews.llvm.org/D67399
- https://reviews.llvm.org/D72932

This commit fixes the oversight that these args weren't passed from the driver
to cc1 if appropriate.

Where *appropriate* means:
- `-faapcs-bitfield-width`: is the default, so won't be passed
- `-fno-aapcs-bitfield-width`: should be passed
- `-faapcs-bitfield-load`: should be passed

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

3 years ago[Verifier] add tests for vector reductions; NFC
Sanjay Patel [Thu, 18 Feb 2021 15:34:13 +0000 (10:34 -0500)]
[Verifier] add tests for vector reductions; NFC

Checking existing functionality before D96904.

3 years ago[RISCV] Fix typo. Use ValueType instead of LLVMType.
Hsiangkai Wang [Thu, 18 Feb 2021 14:45:32 +0000 (22:45 +0800)]
[RISCV] Fix typo. Use ValueType instead of LLVMType.

3 years ago[ASTMatchers] Fix hasParent while ignoring unwritten nodes
Stephen Kelly [Thu, 4 Feb 2021 20:49:58 +0000 (20:49 +0000)]
[ASTMatchers] Fix hasParent while ignoring unwritten nodes

For example, before this patch we can use has() to get from a
cxxRewrittenBinaryOperator to its operand, but hasParent doesn't get
back to the cxxRewrittenBinaryOperator.  This patch fixes that.

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

3 years ago[SystemZ][ZOS] Guard using declaration for ::fchmodat
Zbigniew Sarbinowski [Thu, 18 Feb 2021 14:49:46 +0000 (14:49 +0000)]
[SystemZ][ZOS] Guard using declaration for ::fchmodat

The use of fchmodat() is beeing guarded but its using declaration is not. Let's use the same guard in both places to avoid compiler errors on platforms where `fchmodat` does not exist.

Reviewed By: #libc, ldionne

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

3 years ago[ARM] Expand the range of allowed post-incs in load/store optimizer
David Green [Thu, 18 Feb 2021 14:59:02 +0000 (14:59 +0000)]
[ARM] Expand the range of allowed post-incs in load/store optimizer

Currently the load/store optimizer will only fold in increments of the
same size as the load/store. This patch expands that to any legal
immediate for the post-inc instruction.

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

3 years ago[lldb] Fix shared library directory computation on windows
Pavel Labath [Mon, 15 Feb 2021 20:51:32 +0000 (21:51 +0100)]
[lldb] Fix shared library directory computation on windows

Our code for locating the shared library directory works via dladdr (or
the windows equivalent) to locate the path of an address known to reside
in liblldb. This works great for C++ programs, but there's a catch.

When (lib)lldb is used from python (like in our test suite), this dladdr
call will return a path to the _lldb.so (or such) file in the python
directory. To compensate for this, we have code which attempts to
resolve this symlink, to ensure we get the canonical location. However,
here's the second catch.

On windows, this file is not a symlink (but a copy), so this logic
fails. Since most of our other paths are derived from the liblldb
location, all of these paths will be wrong, when running the test suite.
One effect of this was the failure to find lldb-server in D96202.

To fix this issue, I add some windows-specific code to locate the
liblldb directory. Since it cannot rely on symlinks, it works by
manually walking the directory tree -- essentially doing the opposite of
what we do when computing the python directory.

To avoid python leaking back into the host code, I implement this with
the help of a callback which can be passed to HostInfo::Initialize in
order to assist with the directory location. The callback lives inside
the python plugin.

I also strenghten the existing path test to ensure the returned path is
the right one.

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

3 years ago[AMDGPU] Tidy up a FIXME fixed by D34973
Jay Foad [Thu, 18 Feb 2021 14:16:28 +0000 (14:16 +0000)]
[AMDGPU] Tidy up a FIXME fixed by D34973

3 years agoRevert "[TableGen] Improve algorithms for processing template arguments"
Paul C. Anagnostopoulos [Thu, 18 Feb 2021 14:25:30 +0000 (09:25 -0500)]
Revert "[TableGen] Improve algorithms for processing template arguments"

This reverts commit e589207d5aaee6cbf1d7c7de8867a17727d14aca.

3 years ago[PowerPC] Exploit the vinsw, vinsd, and vins[wd][lr]x instructions on P10
Baptiste Saleil [Wed, 17 Feb 2021 23:02:30 +0000 (23:02 +0000)]
[PowerPC] Exploit the vinsw, vinsd, and vins[wd][lr]x instructions on P10

This patch generates the vinsw, vinsd, vinsblx, vinshlx, vinswlx, vinsdlx,
vinsbrx, vinshrx, vinswrx and vinsdrx instructions for vector insertion on P10.

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

3 years ago[RISCV] Fix bugs in pseudo instructions for masked segment load.
Hsiangkai Wang [Thu, 18 Feb 2021 06:52:19 +0000 (14:52 +0800)]
[RISCV] Fix bugs in pseudo instructions for masked segment load.

For masked segment load, the destination register should not overlap
with mask register. It could not be V0.

In the original implementation, there is no segment load/store register
class without V0. In this patch, I added these register classes and
modify `GetVRegNoV0` to get the correct one.

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

3 years ago[NFC][RISCV] Use concise way to describe load/store instructions.
Hsiangkai Wang [Thu, 18 Feb 2021 01:33:25 +0000 (09:33 +0800)]
[NFC][RISCV] Use concise way to describe load/store instructions.

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

3 years ago[TableGen] Improve algorithms for processing template arguments
Paul C. Anagnostopoulos [Wed, 20 Jan 2021 18:14:43 +0000 (13:14 -0500)]
[TableGen] Improve algorithms for processing template arguments

Rework template argument checking so that all arguments are type-checked
and cast if necessary.

Add a test.

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

3 years agoadd -use-color option to clang-tidy-diff.py
Jonas Otto [Thu, 18 Feb 2021 14:12:48 +0000 (09:12 -0500)]
add -use-color option to clang-tidy-diff.py

Clang-tidy seems to output color only when printing directly to
terminal, but an option to force color-output has been added in
https://reviews.llvm.org/D7947

3 years ago[ARM] Ensure types provided to getIntrinsicCost are valid
David Green [Thu, 18 Feb 2021 14:00:23 +0000 (14:00 +0000)]
[ARM] Ensure types provided to getIntrinsicCost are valid

It appears that pointer types were causing issues for the min/max cost
code in getIntrinsicInstrCost. This makes sure that when matching
icmp/select to a min/max, we only do that for normal int or float types.

3 years ago[mlir] Add `linalg.tiled_loop` op.
Alexander Belyaev [Thu, 18 Feb 2021 08:41:40 +0000 (09:41 +0100)]
[mlir] Add `linalg.tiled_loop` op.

`subtensor_insert` was used instead of `linalg.subtensor_yield` to make this PR
smaller. Verification will be added in a follow-up PR.

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

3 years ago[PowerPC] Add option for ROP Protection
Stefan Pintilie [Thu, 18 Feb 2021 12:12:53 +0000 (12:12 +0000)]
[PowerPC] Add option for ROP Protection

Added -mrop-protection for Power PC to turn on codegen that provides some
protection from ROP attacks.

The option is off by default and can be turned on for Power 8, Power 9 and
Power 10.

This patch is for the option only. The feature will be implemented by a later
patch.

Reviewed By: amyk

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

3 years ago[clangd] Drop template argument lists from completions followed by <
Kirill Bobyrev [Thu, 18 Feb 2021 12:06:01 +0000 (13:06 +0100)]
[clangd] Drop template argument lists from completions followed by <

Now, given `template <typename T> foo() {}` when user types `fo^<int>()` the
completion snippet will not contain `<int>()`.

Also, when the next token is opening parenthesis (`(`) and completion snippet
contains template argument list, it is still emitted.

This patch complements D81380.

Related issue: https://github.com/clangd/clangd/issues/387

Reviewed By: kadircet

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

3 years agoRevert "[MLIR] Create memref dialect and move several dialect-specific ops from std."
Alexander Belyaev [Thu, 18 Feb 2021 11:49:52 +0000 (12:49 +0100)]
Revert "[MLIR] Create memref dialect and move several dialect-specific ops from std."

This commit introduced a cyclic dependency:
Memref dialect depends on Standard because it used ConstantIndexOp.
Std depends on the MemRef dialect in its EDSC/Intrinsics.h

Working on a fix.

This reverts commit 8aa6c3765b924d86f623d452777eb76b83bf2787.

3 years ago[ARM] Add larger than legal ICmp costs
David Green [Thu, 18 Feb 2021 11:42:17 +0000 (11:42 +0000)]
[ARM] Add larger than legal ICmp costs

A v8i32 compare will produce a v8i1 predicate, but during codegen the
v8i32 will be split into two v4i32, potentially requiring two v4i1
predicates to be merged into a single v8i1. Because this merging of two
v4i1's into a v8i1 is very expensive, we need to make the cost of the
compare equally high.

This patch adds the cost of that to ARMTTIImpl::getCmpSelInstrCost.
Because we don't know whether the user of the predicate can be split,
and the cost model is mostly pre-instruction, we may be pessimistic but
that should only be for larger and legal types. This also adds min/max
detection to the costmodel where it can be detected, to keep those in
line with the cost of simple min/max instructions. Otherwise for the
most part, costs that were already expensive have become more expensive.

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

3 years ago[FuncAttrs] Add tests for willreturn callsite inference.
Florian Hahn [Thu, 18 Feb 2021 11:13:05 +0000 (11:13 +0000)]
[FuncAttrs] Add tests for willreturn callsite inference.

3 years ago[X86][SSE] Add uniform vector shift test coverage for (sra (trunc (sr[al] x, c1)...
Simon Pilgrim [Wed, 17 Feb 2021 18:17:50 +0000 (18:17 +0000)]
[X86][SSE] Add uniform vector shift test coverage for (sra (trunc (sr[al] x, c1)), c2) folds

3 years ago[flang][driver] Add debug dump options
Faris Rehman [Wed, 17 Feb 2021 15:55:56 +0000 (15:55 +0000)]
[flang][driver] Add debug dump options

Add the following options:
* -fdebug-dump-symbols
* -fdebug-dump-parse-tree
* -fdebug-dump-provenance

Summary of changes:
- Add 3 new frontend actions: DebugDumpSymbolsAction, DebugDumpParseTreeAction and DebugDumpProvenanceAction
- Add a unique pointer to the Semantics instance created in PrescanAndSemaAction
- Move fatal semantic error reporting to its own method, FrontendActions#reportFatalSemanticErrors
- Port most tests using `-fdebug-dump-symbols` and `-fdebug-dump-parse-tree` to the new driver if built, otherwise default to f18

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

3 years ago[OpenCL] Move printf declaration to opencl-c-base.h
Sven van Haastregt [Thu, 18 Feb 2021 11:27:19 +0000 (11:27 +0000)]
[OpenCL] Move printf declaration to opencl-c-base.h

Supporting `printf` with `-fdeclare-opencl-builtins` would require
special handling (for e.g. varargs and format attributes) for just
this one function.  Instead, move the `printf` declaration to the
shared base header.

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

3 years ago[ARM] MVE ICmp costing tests. NFC
David Green [Thu, 18 Feb 2021 10:50:34 +0000 (10:50 +0000)]
[ARM] MVE ICmp costing tests. NFC

3 years ago[RISCV] Rewrite assert to not give unused variable warnings in Release builds
Benjamin Kramer [Thu, 18 Feb 2021 10:42:36 +0000 (11:42 +0100)]
[RISCV] Rewrite assert to not give unused variable warnings in Release builds

NFCI

3 years ago[MLIR] Create memref dialect and move several dialect-specific ops from std.
Julian Gross [Wed, 10 Feb 2021 12:53:11 +0000 (13:53 +0100)]
[MLIR] Create memref dialect and move several dialect-specific ops from std.

Create the memref dialect and move several dialect-specific ops without
dependencies to other ops from std dialect to this dialect.

Moved ops:
AllocOp -> MemRef_AllocOp
AllocaOp -> MemRef_AllocaOp
DeallocOp -> MemRef_DeallocOp
MemRefCastOp -> MemRef_CastOp
GetGlobalMemRefOp -> MemRef_GetGlobalOp
GlobalMemRefOp -> MemRef_GlobalOp
PrefetchOp -> MemRef_PrefetchOp
ReshapeOp -> MemRef_ReshapeOp
StoreOp -> MemRef_StoreOp
TransposeOp -> MemRef_TransposeOp
ViewOp -> MemRef_ViewOp

The roadmap to split the memref dialect from std is discussed here:
https://llvm.discourse.group/t/rfc-split-the-memref-dialect-from-std/2667

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

3 years ago[RISCV] Begin to support more subvector inserts/extracts
Fraser Cormack [Wed, 17 Feb 2021 15:57:59 +0000 (15:57 +0000)]
[RISCV] Begin to support more subvector inserts/extracts

This patch adds support for INSERT_SUBVECTOR and EXTRACT_SUBVECTOR
(nominally where both operands are scalable vector types) where the
vector, subvector, and index align sufficiently to allow decomposition
to subregister manipulation:

* For extracts, the extracted subvector must correctly align with the
lower elements of a vector register.
* For inserts, the inserted subvector must be at least one full vector
register, and correctly align as above.

This approach should work for fixed-length vector insertion/extraction
too, but that will come later.

Reviewed By: craig.topper, khchen, arcbbb

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

3 years ago[SVE][CodeGen] Expand SVE MULH[SU] and [SU]MUL_LOHI nodes
Fraser Cormack [Wed, 17 Feb 2021 09:25:58 +0000 (09:25 +0000)]
[SVE][CodeGen] Expand SVE MULH[SU] and [SU]MUL_LOHI nodes

This patch fixes a codegen crash introduced in fde24661718c, where the
DAGCombiner started generating optimized MULH[SU] or [SU]MUL_LOHI nodes
unless the target opted out. The AArch64 backend cannot currently select
any of these nodes, so ensure that they are not generated in the first
place.

This issue was raised by @huihuiz in D94501.

Reviewed By: paulwalker-arm

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

3 years agoRevert "[Debugify] Make the debugify aware of the original (-g) Debug Info"
Djordje Todorovic [Thu, 18 Feb 2021 10:03:18 +0000 (02:03 -0800)]
Revert "[Debugify] Make the debugify aware of the original (-g) Debug Info"

This reverts rG8ee7c7e02953.
One test is failing, I'll reland this as soon as possible.

3 years ago[cmake] Move check for libproc to config-ix.cmake
Alex Hoppen [Thu, 18 Feb 2021 09:50:54 +0000 (10:50 +0100)]
[cmake] Move check for libproc to config-ix.cmake

As suggested by Nico in https://reviews.llvm.org/D96049, move check for libproc
from CMakeLists to config-ix.cmake

Reviewed By: thakis

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

Note: Also removes the CMAKE_REQUIRED_LIBRARIES which doesn't appear to
be necessary.

3 years ago[Debugify] Make the debugify aware of the original (-g) Debug Info
Djordje Todorovic [Wed, 30 Sep 2020 13:06:55 +0000 (06:06 -0700)]
[Debugify] Make the debugify aware of the original (-g) Debug Info

As discussed on the RFC [0], I am sharing the set of patches that
enables checking of original Debug Info metadata preservation in
optimizations. The proof-of-concept/proposal can be found at [1].

The implementation from the [1] was full of duplicated code,
so this set of patches tries to merge this approach into the existing
debugify utility.

For example, the utility pass in the original-debuginfo-check
mode could be invoked as follows:

  $ opt -verify-debuginfo-preserve -pass-to-test sample.ll

Since this is very initial stage of the implementation,
there is a space for improvements such as:
  - Add support for the new pass manager
  - Add support for metadata other than DILocations and DISubprograms

[0] https://groups.google.com/forum/#!msg/llvm-dev/QOyF-38YPlE/G213uiuwCAAJ
[1] https://github.com/djolertrk/llvm-di-checker

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

3 years ago[XCOFF][NFC] make StorageMappingClass/SymbolType member optional
Chen Zheng [Thu, 18 Feb 2021 09:41:05 +0000 (04:41 -0500)]
[XCOFF][NFC] make StorageMappingClass/SymbolType member optional

This patch makes StorageMappingClass/SymbolType member optional in
class MCSectionXCOFF.

Non-csect sections like debug sections have no such properties.

Reviewed By: hubert.reinterpretcast

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

3 years ago[Syntax] No crash on OpaqueValueExpr.
Haojian Wu [Thu, 18 Feb 2021 09:09:02 +0000 (10:09 +0100)]
[Syntax] No crash on OpaqueValueExpr.

OpaqueValueExpr doesn't correspond to the concrete syntax, it has
invalid source location, ignore them.

Reviewed By: kbobyrev

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

3 years ago[CSSPGO][llvm-profgen] Fix gcc Wcast-qual warning (NFC)
Yang Fan [Thu, 18 Feb 2021 08:31:40 +0000 (16:31 +0800)]
[CSSPGO][llvm-profgen] Fix gcc Wcast-qual warning (NFC)

GCC warning:
```
[3397/3703] Building CXX object tools/llvm-profgen/CMakeFiles/llvm-profgen.dir/llvm-profgen.cpp.o
In file included from /llvm-project/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /llvm-project/llvm/include/llvm/ADT/StringRef.h:12,
                 from /llvm-project/llvm/include/llvm/ADT/Twine.h:13,
                 from /llvm-project/llvm/tools/llvm-profgen/ErrorHandling.h:12,
                 from /llvm-project/llvm/tools/llvm-profgen/llvm-profgen.cpp:13:
/llvm-project/llvm/include/llvm/ADT/Optional.h: In instantiation of ‘void llvm::optional_detail::OptionalStorage<T, <anonymous> >::emplace(Args&& ...) [with Args = {const std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, llvm::sampleprof::LineLocation>}; T = const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>; bool <anonymous> = false]’:
/llvm-project/llvm/include/llvm/ADT/Optional.h:79:7:   required from ‘constexpr llvm::optional_detail::OptionalStorage<T, <anonymous> >::OptionalStorage(llvm::optional_detail::OptionalStorage<T, <anonymous> >&&) [with T = const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>; bool <anonymous> = false]’
/llvm-project/llvm/include/llvm/ADT/Optional.h:253:13:   required from here
/llvm-project/llvm/include/llvm/ADT/Optional.h:113:12: warning: cast from type ‘const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>*’ to type ‘void*’ casts away qualifiers [-Wcast-qual]
  113 |     ::new ((void *)std::addressof(value)) T(std::forward<Args>(args)...);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[3398/3703] Building CXX object tools/llvm-profgen/CMakeFiles/llvm-profgen.dir/PerfReader.cpp.o
In file included from /llvm-project/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /llvm-project/llvm/include/llvm/ADT/StringRef.h:12,
                 from /llvm-project/llvm/include/llvm/ADT/Twine.h:13,
                 from /llvm-project/llvm/tools/llvm-profgen/ErrorHandling.h:12,
                 from /llvm-project/llvm/tools/llvm-profgen/PerfReader.h:11,
                 from /llvm-project/llvm/tools/llvm-profgen/PerfReader.cpp:8:
/llvm-project/llvm/include/llvm/ADT/Optional.h: In instantiation of ‘void llvm::optional_detail::OptionalStorage<T, <anonymous> >::emplace(Args&& ...) [with Args = {const std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, llvm::sampleprof::LineLocation>}; T = const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>; bool <anonymous> = false]’:
/llvm-project/llvm/include/llvm/ADT/Optional.h:79:7:   required from ‘constexpr llvm::optional_detail::OptionalStorage<T, <anonymous> >::OptionalStorage(llvm::optional_detail::OptionalStorage<T, <anonymous> >&&) [with T = const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>; bool <anonymous> = false]’
/llvm-project/llvm/include/llvm/ADT/Optional.h:253:13:   required from here
/llvm-project/llvm/include/llvm/ADT/Optional.h:113:12: warning: cast from type ‘const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>*’ to type ‘void*’ casts away qualifiers [-Wcast-qual]
  113 |     ::new ((void *)std::addressof(value)) T(std::forward<Args>(args)...);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[3399/3703] Building CXX object tools/llvm-profgen/CMakeFiles/llvm-profgen.dir/ProfiledBinary.cpp.o
In file included from /llvm-project/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /llvm-project/llvm/include/llvm/ADT/ArrayRef.h:15,
                 from /llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h:18,
                 from /llvm-project/llvm/include/llvm/ADT/DenseMap.h:16,
                 from /llvm-project/llvm/include/llvm/ADT/DenseSet.h:16,
                 from /llvm-project/llvm/include/llvm/ProfileData/SampleProf.h:17,
                 from /llvm-project/llvm/tools/llvm-profgen/CallContext.h:12,
                 from /llvm-project/llvm/tools/llvm-profgen/ProfiledBinary.h:12,
                 from /llvm-project/llvm/tools/llvm-profgen/ProfiledBinary.cpp:9:
/llvm-project/llvm/include/llvm/ADT/Optional.h: In instantiation of ‘void llvm::optional_detail::OptionalStorage<T, <anonymous> >::emplace(Args&& ...) [with Args = {const std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, llvm::sampleprof::LineLocation>}; T = const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>; bool <anonymous> = false]’:
/llvm-project/llvm/include/llvm/ADT/Optional.h:79:7:   required from ‘constexpr llvm::optional_detail::OptionalStorage<T, <anonymous> >::OptionalStorage(llvm::optional_detail::OptionalStorage<T, <anonymous> >&&) [with T = const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>; bool <anonymous> = false]’
/llvm-project/llvm/include/llvm/ADT/Optional.h:253:13:   required from here
/llvm-project/llvm/include/llvm/ADT/Optional.h:113:12: warning: cast from type ‘const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>*’ to type ‘void*’ casts away qualifiers [-Wcast-qual]
  113 |     ::new ((void *)std::addressof(value)) T(std::forward<Args>(args)...);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[3404/3703] Building CXX object tools/llvm-profgen/CMakeFiles/llvm-profgen.dir/ProfileGenerator.cpp.o
In file included from /llvm-project/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /llvm-project/llvm/include/llvm/ADT/StringRef.h:12,
                 from /llvm-project/llvm/include/llvm/ADT/Twine.h:13,
                 from /llvm-project/llvm/tools/llvm-profgen/ErrorHandling.h:12,
                 from /llvm-project/llvm/tools/llvm-profgen/ProfileGenerator.h:11,
                 from /llvm-project/llvm/tools/llvm-profgen/ProfileGenerator.cpp:9:
/llvm-project/llvm/include/llvm/ADT/Optional.h: In instantiation of ‘void llvm::optional_detail::OptionalStorage<T, <anonymous> >::emplace(Args&& ...) [with Args = {const std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, llvm::sampleprof::LineLocation>}; T = const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>; bool <anonymous> = false]’:
/llvm-project/llvm/include/llvm/ADT/Optional.h:79:7:   required from ‘constexpr llvm::optional_detail::OptionalStorage<T, <anonymous> >::OptionalStorage(llvm::optional_detail::OptionalStorage<T, <anonymous> >&&) [with T = const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>; bool <anonymous> = false]’
/llvm-project/llvm/include/llvm/ADT/Optional.h:253:13:   required from here
/llvm-project/llvm/include/llvm/ADT/Optional.h:113:12: warning: cast from type ‘const std::pair<std::__cxx11::basic_string<char>, llvm::sampleprof::LineLocation>*’ to type ‘void*’ casts away qualifiers [-Wcast-qual]
  113 |     ::new ((void *)std::addressof(value)) T(std::forward<Args>(args)...);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

3 years ago[mlir] generate enum translation functions with unused attribute
Alex Zinenko [Wed, 17 Feb 2021 18:36:49 +0000 (19:36 +0100)]
[mlir] generate enum translation functions with unused attribute

The functions translating enums to LLVM IR are generated in a single
file included in many places, not all of which use all translations.
Generate functions with "unused" attribute to silence compiler warnings.

Reviewed By: mehdi_amini

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