Commit Graph

431965 Commits

Author SHA1 Message Date
Tres Popp 984d1bf8c0 Remove empty AffineExpr stride canonicalization in makeCanonicalStridedLayoutExpr
The "optimization" would replace the AffineMap for an empty shape with a 0 to represent its indexing (stride * dimension) logic. Meanwhile other pieces of core logic (such as getStridesAndOffset and makeStridedLinearLayoutMap) require strides for all dimensions to ensure no aliasing can occur which would occur if the shape was not empty. For now, this optimization is removed as different pieces of core types disagree on this, so the optimization should be caller supplied or should be consistent throughout the infrastructure.

Differential Revision: https://reviews.llvm.org/D130772
2022-08-01 11:15:32 +02:00
Vladislav Dzhidzhoev facb3ac385 [GlobalISel][DebugInfo] salvageDebugInfo analogue for gMIR
Salvage debug info of instruction that is about to be deleted as dead in
Combiner pass. Currently supported instructions are COPY and G_TRUNC.

It allows to salvage debug info of some dead arguments of functions, by putting
DWARF expression corresponding to the instruction being deleted into related
DBG_VALUE instruction.

Here is an example of missing variables location https://godbolt.org/z/K48osb9dK.
We see that arguments x, y of function foo are not available in debugger, and
corresponding DBG_VALUE instructions have undefined register operand instead of
variables locaton after Aarch64PreLegalizerCombiner pass. The reason is that
registers where variables are located are removed as dead (with instruction
G_TRUNC). We can use salvageDebugInfo analogue for gMIR to preserve debug
locations of dead variables.

Statistics of llvm object files built with vs without this commit on -O2
optimization level (CMAKE_BUILD_TYPE=RelWithDebInfo, -fglobal-isel) on Aarch64 (macOS):

Number of variables with 100% of parent scope covered by DW_AT_location has been increased by 7,9%.
Number of variables with 0% coverage of parent scope has been decreased by 1,2%.
Number of variables processed by location statistics has been increased by 2,9%.
Average PC ranges coverage has been increased by 1,8 percentage points.

Coverage can be improved by supporting more instructions, or by calling
salvageDebugInfo for instructions that are deleted during Combiner rules exection.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D129909
2022-08-01 11:14:53 +02:00
Alex Bradbury 9bf2d8cbbe [NFC] Use AllocaInst's getAddressSpace helper 2022-08-01 10:11:16 +01:00
Guillaume Chatelet 3f3bbd7370 [libc][NFC] Use STL case for functional
Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.

Differential Revision: https://reviews.llvm.org/D130760
2022-08-01 09:10:59 +00:00
Mehdi Amini ec5def5e20 Fix MLIR Python binding for arith.constant after argument has been changed to an interface
e179532284 removed the Type field from attributes and
arith::ConstantOp argument is now a TypedAttrInterface which isn't
supported by the python generator.
This patch temporarily restore the functionality for arith.constant but
won't generalize: we need to work on the generator instead.

Differential Revision: https://reviews.llvm.org/D130878
2022-08-01 09:06:55 +00:00
Florian Hahn 6e1ba62d0d
[LV] Add additional tests with multiple chained recurrences.
Adds more extra tests for D119661.

Also update the test to use opaque pointers.
2022-08-01 10:01:19 +01:00
Guillaume Chatelet d3d498fbf6 Reland [libc][NFC] Use STL case for array
This is a reland of https://reviews.llvm.org/D130773
2022-08-01 08:47:27 +00:00
Guillaume Chatelet de00bd573e Revert "[libc][NFC] Use STL case for array"
This reverts commit 7add0e5fdc.
2022-08-01 08:44:52 +00:00
Guillaume Chatelet 7add0e5fdc [libc][NFC] Use STL case for array
Migrating all private STL code to the standard STL case but keeping it under the CPP namespace to avoid confusion.

Differential Revision: https://reviews.llvm.org/D130773
2022-08-01 08:43:05 +00:00
Frederic Cambus 892e6e2200 [clang] Update Clang version from 15 to 16 in scan-build.1.
Similar to D110763.
2022-08-01 10:34:55 +02:00
Fangrui Song d0cf7b2015 [ELF] EhInputSection::getParentOffset: fix out-of-bounds access for symbols relative to a non-empty .eh_frame
This has unclear semantics and can be considered invalid. Return an arbitrary value.
2022-08-01 01:10:51 -07:00
Chuanqi Xu 834a878367 [C++2b] [Modules] Handle HaveModules with C++2b
Closing https://github.com/llvm/llvm-project/issues/56803. The root
cause for this bug is that we lack a good method to detect the language
mdoe when parsing the command line. There is a FIXME too. Dut to we lack
a good solution now, keep the workaround.
2022-08-01 16:06:34 +08:00
Serge Pavlov 2bb7c54621 [Clang] Remove unused parameter. NFC
BinaryOperator::getFPFeatures get parameter, which is not used. Similar
methods of other AST nodes do not have any parameter.
2022-08-01 14:53:13 +07:00
Nikita Popov 7314ad7a06 Revert "[SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions"
This reverts commit 7b0f6378e2.

As commented on the review, this patch has a correctness issue
regarding the modelling of memory effects.
2022-08-01 09:20:56 +02:00
David Green ef9df0dc00 [ARM] Simplify ArchGuard predicates in arm_neon.h.
__ARM_ARCH >= 8 is implied by defined(__aarch64__), so we don't need to
guard against both together.
2022-08-01 08:20:23 +01:00
Siva Chandra Reddy 89e5c20ca9 [libc][NFC] Mark a constructor of StringView to be constexpr. 2022-08-01 07:13:20 +00:00
WANG Xuerui 313ce7217e [cmake] Support native LoongArch builds
Differential Revision: https://reviews.llvm.org/D130821
2022-08-01 15:10:24 +08:00
WANG Xuerui e48a0df3fc [cmake] Add LoongArch to config.guess
Necessary for native builds on LoongArch. Only Linux is added for now,
matching upstream config.git changes.

Unfortunately, the upstream config.guess is GPLv3+ since 2012, and
LLVM is without autoconf support for a long time, so the script's
licensing exception no longer works and a bump could not be trivially
done.

This is the same as the [upstream commit adding LoongArch](https://git.savannah.gnu.org/gitweb/?p=config.git;a=commitdiff;h=c8ddc8472f8efcadafc1ef53ca1d863415fddd5f),
but rewritten to match the 2011 style that our script is holding on
to.

Differential Revision: https://reviews.llvm.org/D130820
2022-08-01 15:05:34 +08:00
Momchil Velikov 7b0f6378e2 [SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions
SimplifyCFG does some common code hoisting, which is limited to hoisting a
sequence of identical instruction in identical order and stops at the first
non-identical instruction.

This patch allows hoisting instruction pairs over same-length sequences of
non-matching instructions. The linear asymptotic complexity of the algorithm
stays the same, there's an extra parameter `simplifycfg-hoist-common-skip-limit`
serving to limit compilation time and/or the size of the hoisted live ranges.

The patch improves SPECv6/525.x264_r by about 10%.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D129370
2022-08-01 07:55:14 +01:00
Siva Chandra Reddy f1d274b5c6 [libc][NFC] Make the buffer size of the integer to string converter public.
This allows users of the IntegerToString class to size their buffers
appropriately at compile time.
2022-08-01 06:54:17 +00:00
Fangrui Song dc900eeaf2 [test] Fix threadlocal_address.cpp after D129833
Older Darwin does not support thread_local:

error: thread-local storage is not supported for the current target
  thread_local int j = 0;
2022-07-31 23:49:33 -07:00
jacquesguan 16cb6ce554 [mlir][Math] Add constant folder for ExpM1Op.
This patch adds constant folder for ExpM1Op which only supports single and double precision floating-point.

Differential Revision: https://reviews.llvm.org/D130567
2022-08-01 14:40:50 +08:00
Fangrui Song b2559f2f5c [ELF] .eh_frame: remove config->wordsize padding
Linux Standard Base Core Specification says that CIE/FDE is padded to an
addressing unit size boundary, but in practice GNU assembler/LLVM integrated
assembler pad FDE/CIE to 4 and the last FDE to 8 on 64-bit systems.

In addition, GNU ld doesn't pad to 8, so let's drop excess padding, too.
If the assembler provides aligned pieces, the output will be aligned.

Noticed .eh_frame size reduction for 3 executables: 0.3% (chrome), 4.7% (clang),
7.6% (an internal program).
2022-07-31 23:35:44 -07:00
Nikita Popov 4ec22ba9c8 [GlobalsAA] Remove unnecessary AAResultBase fallback (NFC)
This is unnecessary, as AA result chaining is implemented at a
higher level now.
2022-08-01 08:34:58 +02:00
Nikita Popov a21c245307 [ARMParallelDSP] Remove unnecessary ModRef intersection (NFC)
Intersecting with ModRef is a no-op, as these are the only two
possible values.
2022-08-01 08:34:58 +02:00
Chuanqi Xu 39dd8dcf20 [NFC] Fix test failure in windows 2022-08-01 14:14:02 +08:00
Siva Chandra Reddy d52e8708ae [libc][NFC] Mark a few methods of StringView to constexpr. 2022-08-01 06:06:49 +00:00
Nikita Popov 5b1d10bda6 [AA] Drop setModAndRef() function (NFC)
Without the "must" state, this function is pointless, because we
can just directly create a ModRef instead.
2022-08-01 07:55:39 +02:00
Nikita Popov 34683c3e35 [MSSA] Fix expensive checks build 2022-08-01 07:28:52 +02:00
Nikita Popov 62ec8e94b8 [Examples] Fix SimplifyCFG example
After fffabd5348, the v2 and v3
versions produce poison instead of undef. Also adjust the v1
version, as well as the test expectations, to make the example
pass again.
2022-08-01 07:22:35 +02:00
Nikita Popov f96ea53e89 [AA] Do not track Must in ModRefInfo
getModRefInfo() queries currently track whether the result is a
MustAlias on a best-effort basis. The only user of this functionality
is the optimized memory access type in MemorySSA -- which in turn
has no users. Given that this functionality has not found a user
since it was introduced five years ago (in D38862), I think we
should drop it again.

The context is that I'm working to separate FunctionModRefBehavior
to track mod/ref for different location kinds (like argmem or
inaccessiblemem) separately, and the fact that ModRefInfo also has
an unrelated Must flag makes this quite awkward, especially as this
means that NoModRef is not a zero value. If we want to retain the
functionality, I would probably split getModRefInfo() results into
a part that just contains the ModRef information, and a separate
part containing a (best-effort) AliasResult.

Differential Revision: https://reviews.llvm.org/D130713
2022-08-01 07:14:31 +02:00
Chuanqi Xu 967f95fb07 [NFC] Fill up the title underline in rst file
Fill up the title underline in rst file to avoid the CI error.
2022-08-01 11:07:19 +08:00
Chuanqi Xu bacdf80f42 Use @llvm.threadlocal.address intrinsic to access TLS variable
This is successor for D125291. This revision would try to use
@llvm.threadlocal.address in clang to access TLS variable. The reason
why the OpenMP tests contains a lot of change is that they uses
utils/update_cc_test_checks.py to update their tests.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D129833
2022-08-01 11:05:00 +08:00
Fangrui Song 81ed005c4c [ELF] Remove EhFrameSection::addSection. NFC 2022-07-31 19:55:05 -07:00
Chuanqi Xu 9701053517 Introduce @llvm.threadlocal.address intrinsic to access TLS variable
This belongs to a series of patches which try to solve the thread
identification problem in coroutines. See
https://discourse.llvm.org/t/address-thread-identification-problems-with-coroutine/62015
for a full background.

The problem consists of two concrete problems: TLS variable and readnone
functions. This patch tries to convert the TLS problem to readnone
problem by converting the access of TLS variable to an intrinsic which
is marked as readnone.

The readnone problem would be addressed in following patches.

Reviewed By: nikic, jyknight, nhaehnle, ychen

Differential Revision: https://reviews.llvm.org/D125291
2022-08-01 10:51:30 +08:00
Fangrui Song b3452f8f13 [ELF] redirectSymbols: skip versioned symbol combine if config->versionDefinitions.size() == 2 2022-07-31 17:47:09 -07:00
Jez Ng 6c9f681252 [lld-macho] Support EH frame pointer encodings that use sdata4
Previously we only supporting using the system pointer size (aka the
`absptr` encoding) because `llvm-mc`'s CFI directives always generate EH
frames with that encoding. But libffi uses 4-byte-encoded, hand-rolled
EH frames, so this patch adds support for it.

Fixes #56576.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D130804
2022-07-31 20:16:33 -04:00
Sunho Kim 773d51ce3b [clang-repl] XFAIL windows properly in simple-exception test case.
We don't have proper exception support in LLJIT on windows yet. We have to xfail windows machine, but the previous check missed out some targets.
2022-08-01 09:06:35 +09:00
Jeff Niu e179532284 [mlir] Remove types from attributes
This patch removes the `type` field from `Attribute` along with the
`Attribute::getType` accessor.

Going forward, this means that attributes in MLIR will no longer have
types as a first-class concept. This patch lays the groundwork to
incrementally remove or refactor code that relies on generic attributes
being typed. The immediate impact will be on attributes that rely on
`Attribute` containing a type, such as `IntegerAttr`,
`DenseElementsAttr`, and `ml_program::ExternAttr`, which will now need
to define a type parameter on their storage classes. This will save
memory as all other attribute kinds will no longer contain a type.

Moreover, it will not be possible to generically query the type of an
attribute directly. This patch provides an attribute interface
`TypedAttr` that implements only one method, `getType`, which can be
used to generically query the types of attributes that implement the
interface. This interface can be used to retain the concept of a "typed
attribute". The ODS-generated accessor for a `type` parameter
automatically implements this method.

Next steps will be to refactor the assembly formats of certain operations
that rely on `parseAttribute(type)` and `printAttributeWithoutType` to
remove special handling of type elision until `type` can be removed from
the dialect parsing hook entirely; and incrementally remove uses of
`TypedAttr`.

Reviewed By: lattner, rriddle, jpienaar

Differential Revision: https://reviews.llvm.org/D130092
2022-07-31 20:01:31 -04:00
Fangrui Song af1328ef45 [ELF] Simplify EhInputSection::split. NFC
* Inline getReloc
* Fold the UINT32_MAX length check into the section size check.
  This transformation is valid because we don't support .eh_frame input sections
  larger than 32-bit (unrealistic even for large code models).
2022-07-31 16:59:57 -07:00
Fangrui Song 3e9adff456 [ELF] Split EhInputSection::pieces into cies and fdes
This simplifies code, removes a read32 (for id==0 check), and makes it feasible
to combine some operations in EhInputSection::split and EhFrameSection::addRecords.

Mostly NFC, but fixes "Relocation not in any piece" assertion failure in an
erroneous case when a relocation offset precedes all CIE/FDE pices.
2022-07-31 16:16:10 -07:00
Kazu Hirata bf6021709a Use drop_begin (NFC) 2022-07-31 15:17:09 -07:00
Kazu Hirata 71336d03f1 Use llvm::any_of (NFC) 2022-07-31 15:17:08 -07:00
Kazu Hirata d11103f9a0 [Hexagon] Remove unused declaration adjustForCalleeSavedRegsSpillCall (NFC)
The function definition was removed on Apr 23, 2015 in commit
876a19d855, but the declaration has
remained since.
2022-07-31 15:17:06 -07:00
Kazu Hirata ce3b687b88 [BOLT] Remove redundaunt string initialization (NFC)
Identified with readability-redundant-string-init.
2022-07-31 15:17:05 -07:00
Kazu Hirata f24ddf6d41 [BOLT] Remove redundant const from return types (NFC)
Identified with readability-const-return-type.
2022-07-31 15:17:03 -07:00
Kazu Hirata 1bf531a5d0 [BOLT] Use boolean literals (NFC)
Identified with modernize-use-bool-literals.
2022-07-31 15:17:02 -07:00
Kazu Hirata ed29930519 [Sema] Remove an unused forward declaration (NFC) 2022-07-31 15:17:00 -07:00
Kazu Hirata 71638b8be7 [ExecutionEngine] Ensure newlines at the end of files (NFC) 2022-07-31 15:16:58 -07:00
NAKAMURA Takumi a0943a2e19 [Bazel] Add JITLink/COFFOptions.td (llvmorg-16-init-398-g88181375a3db) 2022-08-01 07:07:13 +09:00