Commit Graph

416698 Commits

Author SHA1 Message Date
Nikita Popov 16a2d5f885 [SCEVExpander] Use early returns in FindValueInExprValueMap() (NFC) 2022-02-25 10:09:16 +01:00
Nikita Popov 87ebd9a36f [IR] Use CallBase::getParamElementType() (NFC)
As this method now exists on CallBase, use it rather than the
one on AttributeList.
2022-02-25 10:01:58 +01:00
Simon Pilgrim 748bf545dc Revert rG87753cebf5f861eee418d6bce155dfa0b00f9878 "[X86] combineX86ShufflesRecursively - don't both widening inputs before calling combineX86ShuffleChain"
Reverting while we investigate codegen regression reports
2022-02-25 08:59:53 +00:00
Jason Molenda cd2ba23efb PlatformMacOSX should be activated for lldb built to run on an iOS etc device
In the changes Jonas made in https://reviews.llvm.org/D117340 , a
small oversight was that PlatformMacOSX (despite the name) is active
for any native Darwin operating system, where lldb and the target
process are running on the same system. This patch uses compile-time
checks to return the appropriate OSType for the OS lldb is being
compiled to, so the "host" platform will correctly be selected when
lldb & the inferior are both running on that OS. And a small change
to PlatformMacOSX::GetSupportedArchitectures which adds additional
recognized triples when running on macOS but not other native Darwin
systems.

Differential Revision: https://reviews.llvm.org/D120517
rdar://89247060
2022-02-25 00:55:54 -08:00
Nikita Popov 2d0fc3e46f [SCEV] Return ArrayRef from getSCEVValues() (NFC)
Return a read-only view on this set. For the one internal use,
directly access ExprValueMap.
2022-02-25 09:32:22 +01:00
gysit 51fdd802c7 [mlir][OpDSL] Add type function attributes.
Previously, OpDSL operation used hardcoded type conversion operations (cast or cast_unsigned). Supporting signed and unsigned casts thus meant implementing two different operations. Type function attributes allow us to define a single operation that has a cast type function attribute which at operation instantiation time may be set to cast or cast_unsigned. We may for example, defina a matmul operation with a cast argument:

```
@linalg_structured_op
def matmul(A=TensorDef(T1, S.M, S.K), B=TensorDef(T2, S.K, S.N), C=TensorDef(U, S.M, S.N, output=True),
    cast=TypeFnAttrDef(default=TypeFn.cast)):
  C[D.m, D.n] += cast(U, A[D.m, D.k]) * cast(U, B[D.k, D.n])
```

When instantiating the operation the attribute may be set to the desired cast function:

```
linalg.matmul(lhs, rhs, outs=[out], cast=TypeFn.cast_unsigned)
```

The revsion introduces a enum in the Linalg dialect that maps one-by-one to the type functions defined by OpDSL.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D119718
2022-02-25 08:25:23 +00:00
Kristina Bessonova 3fe6f9388f [NVPTX][AsmPrinter] Emit .attribute(.managed) for global variable declarations
Declaration and definition attributes must match,
otherwise it may cause issues on linking.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D120493
2022-02-25 10:21:31 +02:00
Nikita Popov d9715a7266 [SCEV] Don't try to reuse expressions with offset
SCEVs ExprValueMap currently tracks not only which IR Values
correspond to a given SCEV expression, but additionally stores that
it may be expanded in the form X+Offset. In theory, this allows
reusing existing IR Values in more cases.

In practice, this doesn't seem to be particularly useful (the test
changes are rather underwhelming) and adds a good bit of complexity.
Per https://github.com/llvm/llvm-project/issues/53905, we have an
invalidation issue with these offseted expressions.

Differential Revision: https://reviews.llvm.org/D120311
2022-02-25 09:16:48 +01:00
Neumann Hon eb3e09c9bf [SystemZ] [z/OS] Add support for generating huge (1 MiB) stack frames in XPLINK64
This patch extends support for generating huge stack frames on 64-bit XPLINK by implementing the ABI-mandated call to the stack extension routine.

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D120450
2022-02-25 02:37:08 -05:00
Michel Weber b3ebcd7226 [MLIR][Presburger] enable copy assignment operator for Simplex
This patch removes the `const` from `usingBigM` to enable the implicit copy assignment operator for Simplex.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D120542
2022-02-25 07:34:05 +00:00
Sockke 6cbf15e9b5 [clang-tidy] Fix `readability-non-const-parameter` for parameter referenced by an lvalue
The checker missed a check for a case when the parameter is referenced by an lvalue and this could cause build breakages.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D117090
2022-02-25 14:53:11 +08:00
Chenbing Zheng b20e80aa59 [RISCV] DAG Combine vcpop and vfirst with VL=0 to li imm
vcpop and vfirst are still useful when VL=0.
vcpop equivalents to li 0 and vfirst equivalents to li -1,
since no mask elements are active.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120302
2022-02-25 14:44:25 +08:00
Zakk Chen 4e115b7d88 [RISCV] Update computeTargetABI from llc as well as clang
Clang computes the default ABI if -mabi is empty
and encode it in LLVM IR module flag since D105555.
For correctness, llc need to give the same target-abi
(Options.MCOptions.ABIName) with ABI encoded in IR.
The getSubtargetImpl already has a check for them only if
Options.MCOptions.ABIName is not empty.

In order to get more robustness we could have a check for
explicit ABI, but now we have two different logic to
compute the default ABI.

The front-end ABI is defautl to the ilp32/ilp32e/lp64, and
ilp32d/lp64d when hardware support for extension D.
The backend ABI is default to the ilp32/ilp32e/lp64.

Reviewed by: asb, jrtc27

Differential Revision: https://reviews.llvm.org/D118333
2022-02-24 21:55:44 -08:00
Anton Afanasyev 904a00d17a [AggressiveInstCombine] Fix `TruncInstCombine` (fix f84d732f)
Erase phi-nodes from `InstInfoMap` before erasing themselves
2022-02-25 08:04:11 +03:00
Anton Afanasyev 0dd8401371 [AggressiveInstCombine] Add `phi` nodes support to `TruncInstCombine`
Expand `TruncInstCombine` to handle loops by adding `phi` nodes
to expression graph.

Reviewed by: RKSimon, lebedev.ri

(recommit of fixed f84d732f, reverted by 8ad6d5e after sanitizer breakage)

Differential Revision: https://reviews.llvm.org/D109817
2022-02-25 07:57:35 +03:00
Shangwu Yao c2f501f395
[CUDA][SPIRV] Assign global address space to CUDA kernel arguments
(resubmit https://reviews.llvm.org/D119207 after fixing the test for
some build settings)

This patch converts CUDA pointer kernel arguments with default address
space to CrossWorkGroup address space (__global in OpenCL). This is
because Generic or Function (OpenCL's private) is not supported as
storage class for kernel pointer types.

Differential revision: https://reviews.llvm.org/D120366
2022-02-24 20:51:43 -08:00
Raúl Peñacoba ca80c24386 [Driver] Support GCC detection for GCC compiled with --enable-version-specific-runtime-libs
GCC's compiled with --enable-version-specific-runtime-libs change the paths where includes and libs are found.
This patch adds support for these cases

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D118700
2022-02-25 04:41:03 +00:00
Vitaly Buka f978497d67 [sanitizer] Don't collect unused info 2022-02-24 20:20:34 -08:00
Fangrui Song 09602d3b47 [ELF] Parallelize initializeLocalSymbols
ObjFile::parse combines symbol initialization and resolution. Many tasks
unrelated to symbol resolution can be postponed and parallelized. This patch
extracts local symbol initialization and parallelizes it.

Technically the new function initializeLocalSymbols can be merged into
ObjFile::postParse, but functions like getSrcMsg may access the
uninitialized (all nullptr) local part of InputFile::symbols.

Linking chrome: 1.02x as fast with glibc malloc, 1.04x as fast with mimalloc

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D119909
2022-02-24 20:05:59 -08:00
Vasileios Porpodas 4bbc3290a2 [SLP] Fix for the min/max intrinsic cost.
The min/max intrinsic cost is currently too low because in the cost calculation
we subtract the cost of the vector compare as we will not emit it.
For the cost of the vector compare we are currently passing BAD_ICMP_PREDICATE
which returns 3, the worst case cost.
I think we should be passing VecPred instead, since we know the predicates of
the compare instr.

I think this is related to commit b3b993a7ad which introduced the predicate
argument to getCmpSelInstrCost().
https://reviews.llvm.org/rGb3b993a7ad817c3c5801341fa78f34332900eb83

Differential Revision: https://reviews.llvm.org/D120439
2022-02-24 18:08:40 -08:00
Vasileios Porpodas 6136f97c69 [SLP][NFC] Test for a follow-up fix of the the vector min/max instrinsic cost calculation.
The code in this test should not have been vectorized.
It looks worse than the scalar code.

Differential Revision: https://reviews.llvm.org/D120438
2022-02-24 18:08:39 -08:00
lian wang f37d21ed20 [RISCV] Add schedule class for Zbt extension
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D119808
2022-02-25 01:57:20 +00:00
Xiaodong Liu f1806f967d [sanitizer] Enable trace pc guard coverage test on PPC64/s390x/MIPS
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D120472
2022-02-25 09:42:22 +08:00
Carl Ritson 565af157ef [AMDGPU] Extend pre-emit peephole to redundantly masked VCC
Extend pre-emit peephole for S_CBRANCH_VCC[N]Z to eliminate
redundant S_AND operations against EXEC for V_CMP results in VCC.
These occur after after register allocation when VCC has been
selected as the comparison destination.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D120202
2022-02-25 10:18:31 +09:00
Harald van Dijk 79787b903d
[ADT, CSSPGO] Specify set comparer
In _GLIBCXX_DEBUG builds, potentially implicitly enabled by
LLVM_ENABLE_EXPENSIVE_CHECKS, std::set<A, B>::iterator and
std::set<A, C>::iterator are distinct types that are not
interconvertible. This change aligns the iterator types with the set
types.

Reviewed By: hoy

Differential Revision: https://reviews.llvm.org/D119798
2022-02-25 00:58:50 +00:00
Corentin Jabot 48f8a7c4f2 [libc++] Make sure calls to std::move are always qualified
This fixes instances of the newly added `-Wunqualified-std-cast-call`.

(Commit 7853371146 removed unqualified `move` from the tests,
but these unqualified `move`s remained undetected in the actual headers.)

Differential Revision: https://reviews.llvm.org/D120509
2022-02-24 19:58:08 -05:00
Arthur Eubanks 6aa285eb85 [OpaquePtr][AArch64] Use load/store value type instead of pointer type for ldnt1/stnt1 alignment 2022-02-24 16:56:13 -08:00
Daniel Thornburgh 565add5a62 [Debuginfod] Add BUILD_ID syntax to llvm-symbolizer.
This adds a BUILD_ID prefix to the llvm-symbolizer stdin and argument
syntax. The prefix causes the given binary name to be interpreted as a
build ID instead of an object file path. The semantics are analagous to
the behavior of --obj and --build-id.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D119901
2022-02-25 00:39:13 +00:00
Qihan Cai 0d058ed3d6 [RISCV] Change rvv version to 1.0 and remove ratify notice
This patch changes the version of V extension from 0.1 to 1.0 in RISCVInstrInfoVPseudos.td, RISCVInstrInfoVSDPatterns.td,  RISCVInstrInfoVVLPatterns.td, RISCVInstrInfoV.td

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D120525
2022-02-25 11:38:20 +11:00
Fangrui Song 0f8106baaf [Driver][test] Make linux-ld.c work with CLANG_DEFAULT_PIE_ON_LINUX=on 2022-02-25 00:34:05 +00:00
Daniel Thornburgh 02106ec15c [Symbolize] LRU cache binaries in llvm-symbolizer.
This change adds a simple LRU cache to the Symbolize class to put a cap
on llvm-symbolizer memory usage. Previously, the Symbolizer's virtual
memory footprint would grow without bound as additional binaries were
referenced.

I'm putting this out there early for an informal review, since there may be
a dramatically different/better way to go about this. I still need to
figure out a good default constant for the memory cap and benchmark the
implementation against a large symbolization workload. Right now I've
pegged max memory usage at zero for testing purposes, which evicts the whole
cache every time.

Unfortunately, it looks like StringRefs in the returned DI objects can
directly refer to the contents of binaries. Accordingly, the cache
pruning must be explicitly requested by the caller, as the caller must
guarantee that none of the returned objects will be used afterwards.

For llvm-symbolizer this a light burden; symbolization occurs
line-by-line, and the returned objects are discarded after each.

Implementation wise, there are a number of nested caches that depend
on one another. I've implemented a simple Evictor callback system to
allow derived caches to register eviction actions to occur when the
underlying binaries are evicted.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D119784
2022-02-25 00:31:48 +00:00
Ben Shi 91c587b3b1 [clang][NFC] Move all avr CodeGen tests to avr specific directory
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D120468
2022-02-25 00:23:46 +00:00
Fangrui Song 3c4ed02698 [Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON
Default the option introduced in D113372 to ON to match all(?) major Linux
distros. This matches GCC and improves consistency with Android and linux-musl
which always default to PIE.
Note: CLANG_DEFAULT_PIE_ON_LINUX will be removed in the future.

Reviewed By: thesamesam

Differential Revision: https://reviews.llvm.org/D120305
2022-02-25 00:22:12 +00:00
Fangrui Song 611122892e [asan][test] asan_prelink_test.cpp: use -fno-pie -no-pie
prelink (will be removed by glibc 2.37) does not support PIE.
2022-02-24 16:09:18 -08:00
Fangrui Song 0ac6be6ab6 [Driver][test] Remove soon irrelevant pie tests
CLANG_DEFAULT_PIE_ON_LINUX=on will soon become the default. The purpose
of these tests has gone.
2022-02-25 00:04:07 +00:00
Fangrui Song deee339796 [Driver][test] Make hexagon-toolchain-elf.c work with CLANG_DEFAULT_PIE_ON_LINUX=on 2022-02-24 23:53:38 +00:00
Nico Weber 7a009b4587
.mailmap: remove stray space in comment 2022-02-24 18:50:08 -05:00
Fangrui Song da047445f7 [clang][test] Make mips-vector-return.c work with CLANG_DEFAULT_PIE_ON_LINUX=on 2022-02-24 15:25:35 -08:00
Craig Topper 506ac29632 [RISCV] Add 'i64' to some isel so tablegen will remove them for RV32. NFC
Saves a 100 bytes or so from the isel table.
2022-02-24 15:10:05 -08:00
Michael Wyman b682616d1f Clang `unused-but-set-variable` warnings should not apply to `__attribute__((objc_precise_lifetime))` Objective-C pointers
The `objc_precise_lifetime` attribute is applied to Objective-C pointers to ensure the optimizer does not prematurely release an object under Automatic Reference Counting (ARC). It is a common enough pattern to assign values to these variables but not reference them otherwise, and annotating them with `__unused` is not really correct as they are being used to ensure an object's lifetime.

Differential Revision: https://reviews.llvm.org/D120372
2022-02-24 14:26:05 -08:00
Fangrui Song 19e37a7415 [ELF] Update comment. NFC 2022-02-24 14:09:00 -08:00
Fangrui Song 6d94340809 [ELF] Simplify resolveDefined and resolveCommon
This is NFC for valid input (COMMON symbols cannot be weak or versioned).
2022-02-24 14:08:06 -08:00
Rahman Lavaee aeec9671fb Revert "Encode address offsets of basic blocks relative to the end of the previous basic blocks."
This reverts commit 029283c1c0.
The code in `ELFFile::decodeBBAddrMap` was not changed in the submitted patch.

Differential Revision: https://reviews.llvm.org/D120457
2022-02-24 13:31:15 -08:00
Reid Kleckner da11f17e90 [lld/MachO] Fix +asserts build after recent change 2022-02-24 13:12:48 -08:00
Sanjay Patel ecf606cb43 [AArch64][x86] add tests for bitwise logic + shifts; NFC 2022-02-24 16:01:16 -05:00
Craig Topper 6159f05955 [RISCV] Add tests for (neg (abs X)) where the abs has an additional user. 2022-02-24 12:59:57 -08:00
Fangrui Song b6a71d9e12 [ELF][test] Remove invalid weak COMMON tests
GNU as reports `Error: symbol `foo' can not be both weak and common`,
though LLVM integrated assembler does not report an error yet.
2022-02-24 12:54:16 -08:00
Yitzhak Mandelbaum 208c25fcbf [clang][dataflow] Add limits to size of modeled data structures in environment.
Adds two new parameters to control the size of data structures modeled in the environment: # of values and depth of data structure.  The environment already prevents creation of recursive data structures, but that was insufficient in practice. Very large structs still ground the analysis to a halt.  These new parameters allow tuning the size more effectively.

In this patch, the parameters are set as internal constants. We leave to a future patch to make these proper model parameters.

Differential Revision: https://reviews.llvm.org/D120510
2022-02-24 20:51:59 +00:00
Jez Ng 850592ec14 [lld-macho] Implement -why_live (without perf overhead)
This was based off @thakis' draft in {D103517}. I employed templates to ensure
the support for `-why_live` wouldn't slow down the regular non-why-live code
path.

No stat sig perf difference on my 3.2 GHz 16-Core Intel Xeon W:

             base           diff           difference (95% CI)
  sys_time   1.195 ± 0.015  1.199 ± 0.022  [  -0.4% ..   +1.0%]
  user_time  3.716 ± 0.022  3.701 ± 0.025  [  -0.7% ..   -0.1%]
  wall_time  4.606 ± 0.034  4.597 ± 0.046  [  -0.6% ..   +0.2%]
  samples    44             37

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D120377
2022-02-24 15:49:36 -05:00
Aaron Ballman df00a995f9 Fix typo in file name; NFC 2022-02-24 15:41:25 -05:00