Haojian Wu [Mon, 20 Jul 2020 13:06:40 +0000 (15:06 +0200)]
[AST][RecoveryExpr] Fix a crash on opencl C++.
Differential Revision: https://reviews.llvm.org/D84145
Haojian Wu [Mon, 20 Jul 2020 13:11:00 +0000 (15:11 +0200)]
Fix clangd build, NFC
Benjamin Kramer [Mon, 20 Jul 2020 13:00:27 +0000 (15:00 +0200)]
[LoopSimplify] Use SmallPtrSet and range for loops more. NFCI.
Haojian Wu [Mon, 20 Jul 2020 12:53:29 +0000 (14:53 +0200)]
[AST][RecoveryExpr] Preserve the AST for invalid conditions.
Adjust an existing diagnostic test, which is an improvement of secondary diagnostic.
Differential Revision: https://reviews.llvm.org/D81163
Pavel Labath [Mon, 20 Jul 2020 10:45:52 +0000 (12:45 +0200)]
[LLDB/test] Simplify result formatter code
Now that the main test results are reported through lit, and we only
have one formatter class, this code is unnecessarily baroque.
Sam McCall [Fri, 17 Jul 2020 10:03:24 +0000 (12:03 +0200)]
[clangd] Exclude preprocessed-to-nothing tokens from selection
This prevents selection of empty preprocessor entities (like #define directives,
or text in disabled sections) creating a selection in the parent element.
Summary: Based on D83508 by Aleksandr Platonov.
Reviewers: ArcsinX, kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84012
Sam McCall [Fri, 17 Jul 2020 09:35:04 +0000 (11:35 +0200)]
[Syntax] expose API for expansions overlapping a spelled token range.
Summary:
This allows efficiently accessing all expansions (without iterating over each
token and searching), and also identifying tokens within a range that are
affected by the preprocessor (which is how clangd will use it).
Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84009
Simon Pilgrim [Mon, 20 Jul 2020 12:36:27 +0000 (13:36 +0100)]
SubtargetFeatureInfo.h - remove unnecessary include and forward declarations. NFCI.
Move necessary include down to SubtargetFeatureInfo.cpp.
Muhammad Omair Javaid [Mon, 20 Jul 2020 12:37:07 +0000 (17:37 +0500)]
Revert "AArch64 SVE register infos and core file support"
This reverts commit
7e017de0ad62dfd3f373354fc47b0e39c0fef657.
Frederik Gossen [Mon, 20 Jul 2020 12:24:02 +0000 (12:24 +0000)]
[MLIR][Shape] Fold `shape.shape_eq`
Fold `shape.shape_eq`.
Differential Revision: https://reviews.llvm.org/D82533
Nicolas Vasilache [Mon, 20 Jul 2020 12:15:31 +0000 (08:15 -0400)]
[mlir][Vector] NFC - Improve VectorInterfaces
This revision improves and makes better use of OpInterfaces for the Vector dialect.
Differential Revision: https://reviews.llvm.org/D84053
Muhammad Omair Javaid [Wed, 8 Jul 2020 01:44:12 +0000 (06:44 +0500)]
AArch64 SVE register infos and core file support
Summary:
This patch adds support for AArch64 SVE register infos description and
core file register access.
AArch64 SVE is a an optional extension of Arm v8.3-a architecture. It
has introduced 32 new vector registers Z, 16 predicate P registers and FFR
predicate register. These registers have fixed names but can dynamically
be configured to different size based on underlying OS configuration.
This patch adds register info struct that describes SVE register infos and
also provides RegisterContextPOSIXCore_arm64 routines to access SVE registers.
This patch also introduces a mechanism to configure SVE register sizes and
offsets at startup before exchanging register information across gdb-remote.
TestLinuxCore.py has been updated to include testing of SVE core files.
Reviewers: labath, clayborg, jankratochvil, jasonmolenda, rengolin
Reviewed By: labath
Subscribers: tschuett, kristof.beyls, danielkiss, lldb-commits
Differential Revision: https://reviews.llvm.org/D77047
Alex Zinenko [Mon, 20 Jul 2020 11:54:30 +0000 (13:54 +0200)]
[mlir] Support translating function linkage between MLIR and LLVM IR
Linkage support is already present in the LLVM dialect, and is being translated
for globals other than functions. Translation support has been missing for
functions because their conversion goes through a different code path than
other globals.
Differential Revision: https://reviews.llvm.org/D84149
Paul Walker [Mon, 20 Jul 2020 10:57:58 +0000 (10:57 +0000)]
[SVE] Add lowering for fixed length vector fdiv, fma, fmul and fsub operations.
Differential Revision: https://reviews.llvm.org/D84034
Joachim Protze [Mon, 20 Jul 2020 11:53:29 +0000 (13:53 +0200)]
[OpenMP][Tests][NFC] Mark compatibility with older versions of clang
Haojian Wu [Mon, 20 Jul 2020 11:11:15 +0000 (13:11 +0200)]
[AST][RecoveryExpr] Preserve the AST for invalid class constructions.
Differential Revision: https://reviews.llvm.org/D81090
Paul Walker [Mon, 20 Jul 2020 10:43:45 +0000 (10:43 +0000)]
[Driver] Add support for -msve-vector-bits=scalable.
No real action is taken for a value of scalable but it provides a
route to disable an earlier specification and is effectively its
default value when omitted.
Patch also removes an "unused variable" warning.
Differential Revision: https://reviews.llvm.org/D84021
George Mitenkov [Mon, 20 Jul 2020 10:40:18 +0000 (13:40 +0300)]
[MLIR][SPIRVToLLVM] Documentation for SPIR-V to LLVM conversion
This patch adds documentation for SPIR-V to LLVM conversion. It describes
the approaches taken and what is currently supported by this conversion
framework.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D83322
James Henderson [Mon, 20 Jul 2020 10:21:54 +0000 (11:21 +0100)]
[test][llvm-readobj] Fix build bot failure after
df952cb9
The test wasn't updated due to being an unusual target not included in
my test run.
Florian Hahn [Mon, 20 Jul 2020 09:50:15 +0000 (10:50 +0100)]
[Matrix] Add minimal lowering pass that only requires TTI.
This patch adds a new variant of the matrix lowering pass that only does
a minimal lowering and only depends on TTI. The main purpose of this pass
is to have a pass with minimal dependencies to run as part of the backend
pipeline.
At the moment, the only difference to the regular lowering pass is that it
does not support remarks. But in subsequent patches add support for tiling
to the lowering pass which will require more analysis, which we do not want
to run in the backend, as the lowering should happen in the middle-end in
practice and running it in the backend is mostly for convenience when
running llc.
Reviewers: anemet, Gerolf, efriedma, hfinkel
Reviewed By: anemet
Differential Revision: https://reviews.llvm.org/D76867
Hans Wennborg [Mon, 20 Jul 2020 10:04:42 +0000 (12:04 +0200)]
[clang-cl] Allow a colon after the /Fe option (PR46720)
Muhammad Omair Javaid [Mon, 20 Jul 2020 09:36:41 +0000 (14:36 +0500)]
Remove Linux sysroot dependencies of SVE PT macros
Summary:
SVE elf note data requires SVE PT macros for reading writing data. Same macros are used by Linux ptrace SVE register access.
This patch makes necessary changes to lldb/source/Plugins/Process/Linux/LinuxPTraceDefines_arm64sve.h in order to make them sysroot independent.
Reviewers: labath, rengolin
Reviewed By: labath
Subscribers: tschuett, lldb-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D83541
Muhammad Omair Javaid [Mon, 20 Jul 2020 09:36:40 +0000 (14:36 +0500)]
Remove use of multiple reg index enums by RegisterContextPOSIX_arm64
Summary:
This patch removes dependence of RegisterContextPOSIX_arm64 on register number enums defined in lldb-arm64-register-enums.h.
RegisterContextPOSIX_arm64 makes use of helper functions to access register numbers defined in RegisterInfos_arm64.h via RegisterInfosPOSIX_arm64.
Reviewers: labath
Reviewed By: labath
Subscribers: emaste, kristof.beyls, arphaman, danielkiss, lldb-commits
Differential Revision: https://reviews.llvm.org/D83753
Balázs Kéri [Mon, 20 Jul 2020 07:07:48 +0000 (09:07 +0200)]
[Analyzer][StreamChecker] Report every leak, clean up state.
Summary:
Report resource leaks with non-fatal error.
Report every resource leak.
Stream state is cleaned up at `checkDeadSymbols`.
Reviewers: Szelethus, baloghadamsoftware, NoQ
Reviewed By: Szelethus
Subscribers: rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82845
Elvina Yakubova [Mon, 20 Jul 2020 07:47:11 +0000 (08:47 +0100)]
[llvm-readobj] Print error when executed with no input files
This patch changes llvm-readelf (and llvm-readobj for consistency)
behavior to print an error when executed with no input files.
Reading from stdin can be achieved via a '-' for the input
object.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46400
Differential Revision: https://reviews.llvm.org/D83704
Reviewed by: jhenderson, MaskRay, sbc, jyknight
Elvina Yakubova [Mon, 20 Jul 2020 07:39:14 +0000 (08:39 +0100)]
[llvm-readobj] Update tests because of changes in llvm-readobj behavior
This patch updates tests using llvm-readobj and llvm-readelf, because
soon reading from stdin will be achievable only via a '-' as described
here: https://bugs.llvm.org/show_bug.cgi?id=46400. Patch with changes to
llvm-readobj behavior is here: https://reviews.llvm.org/D83704
Differential Revision: https://reviews.llvm.org/D83912
Reviewed by: jhenderson, MaskRay, grimar
Tim Northover [Fri, 17 Jul 2020 10:25:59 +0000 (11:25 +0100)]
AArch64: emit @llvm.debugtrap as `brk #0xf000` on all platforms
It's useful for a debugger to be able to distinguish an @llvm.debugtrap
from a (noreturn) @llvm.trap, so this extends the existing Windows
behaviour to other platforms.
Georgii Rymar [Mon, 20 Jul 2020 09:16:02 +0000 (12:16 +0300)]
[LLD][ELF] - Update the lld/test/ELF/mips-merge-abiflags.s after llvm-readelf change.
The warning message was updated
(https://reviews.llvm.org/rG256aea816da45bd3bc52317cbc89e704095a8991)
Petar Avramovic [Mon, 20 Jul 2020 09:04:30 +0000 (11:04 +0200)]
AMDGPU/GlobalISel: Legalize s16->s64 G_FPTOSI/G_FPTOUI
Add narrowScalarFor action.
Add narrow scalar for typeIndex == 0 for G_FPTOSI/G_FPTOUI.
Legalize using narrowScalarFor as s16->s32 G_FPTOSI/G_FPTOUI
followed by s32->s64 G_SEXT/G_ZEXT.
Differential Revision: https://reviews.llvm.org/D84010
Georgii Rymar [Wed, 15 Jul 2020 11:56:55 +0000 (14:56 +0300)]
[llvm-readobj] - Refactor how the code dumps relocations.
There is a strange "feature" of the code: it handles all relocations as `Elf_Rela`.
For handling `Elf_Rel` it converts them to `Elf_Rela` and passes `bool IsRela` to
specify the real type everywhere.
A related issue is that the
`decode_relrs` helper in lib/Object has to return `Expected<std::vector<Elf_Rela>>`
because of that, though it could return a vector of `Elf_Rel`.
I think we should just start using templates for relocation types, it makes the code
cleaner and shorter. This patch does it.
Differential revision: https://reviews.llvm.org/D83871
Raphael Isemann [Mon, 20 Jul 2020 08:47:21 +0000 (10:47 +0200)]
[lldb] Remove orphaned modules in a loop
Summary:
When modules reference each other (which happens for example with the different
modules LLDB loads when debugging -gmodules-compiled binaries), just iterating
over the module list once isn't good enough to find all orphans. Any removed
modules in the module list will also clear up the shared pointers they hold to
other modules, so after any module was removed from the list, LLDB should
iterate again and check if any additional modules can no be safely deleted.
This is currently causing that many gmodules tests are not cleaning up all
allocated modules which causes cleanup asserts to fail (right now these asserts
just mark the test as unsupported, but after D83865 the tests will start
failing).
Reviewers: aprantl, clayborg, JDevlieghere
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D84015
Georgii Rymar [Fri, 17 Jul 2020 12:45:01 +0000 (15:45 +0300)]
[llvm-readelf/readobj] - Refine the error reporting in printMipsABIFlags() methods.
It fixes/improves the following:
1) Some code was duplicated.
2) A "The .MIPS.abiflags section has a wrong size" error was not reported as a warning,
but was printed to stdout for the LLVM style. Also, it was reported as an error for the GNU style.
This patch changes the behavior to be consistent and to report warnings.
3) `unwrapOrError()` was used before, now a warning is reported instead.
Differential revision: https://reviews.llvm.org/D84033
Dmitri Gribenko [Mon, 20 Jul 2020 08:22:59 +0000 (10:22 +0200)]
Enable the test for hasArraySize() AST matcher in all language modes
Summary:
In C++11 and later Clang generates an implicit conversion from int to
size_t in the AST.
Reviewers: ymandel, hokein
Reviewed By: hokein
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83966
Raphael Isemann [Mon, 20 Jul 2020 07:59:40 +0000 (09:59 +0200)]
[lldb][NFC] Remove unused FormattersContainer::Get overload
This is unused and also calls a non-existent 'Get' overload.
Roman Lebedev [Mon, 20 Jul 2020 06:56:38 +0000 (09:56 +0300)]
[NFCI][SimplifyCFG] Guard common code hoisting with a (default-on) flag
Common code sinking is already guarded with a (with default-off!) flag,
so add a flag for hoisting, too.
D84108 will hopefully make hoisting off-by-default too.
Roman Lebedev [Mon, 20 Jul 2020 06:50:20 +0000 (09:50 +0300)]
[NFC][SimplifyCFG] Add standalone test for common code hoisting xform option
Also, move one test into it's correct place
sstefan1 [Sun, 19 Jul 2020 19:55:43 +0000 (21:55 +0200)]
[Attributor][NFC] applying update_test_checks with --check-attributes
Summary:
All tests are updated, except wrapper.ll since it is not working nicely
with newly created functions.
Reviewers: jdoerfert, uenoku, baziotis, homerdin
Subscribers: arphaman, jfb, kuter, bbn, okura, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84130
Xing GUO [Mon, 20 Jul 2020 05:56:04 +0000 (13:56 +0800)]
[DWARFYAML] Add dependency 'BinaryFormat'. NFC.
This patch is trying to fix build failure.
Failed tests:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/12574
Lang Hames [Mon, 20 Jul 2020 05:33:27 +0000 (22:33 -0700)]
[ORC] Refactor TrampolinePool to reduce virtual function calls.
Virtual function calls are now only made when the pool needs to be
grown to accommodate o new request.
Raphael Isemann [Mon, 20 Jul 2020 05:10:41 +0000 (07:10 +0200)]
[lldb][NFC] Make some RegularExpression constructor calls less verbose
Xing GUO [Mon, 20 Jul 2020 03:12:32 +0000 (11:12 +0800)]
[DWARFYAML] Remove 'default' tag. NFC.
This patch is trying to make build bots happy.
Failed bots:
http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/10705
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/33595
Lang Hames [Mon, 20 Jul 2020 02:33:49 +0000 (19:33 -0700)]
[JITLink][MachO] Tidy up debugging output for relocation parsing.
Identify relocations by (section name, offset) pairs, rather than plain
vmaddrs. This makes it easier to cross-reference debugging output for
relocations with output from standard object inspection tools (otool,
readelf, objdump, etc.).
Xing GUO [Mon, 20 Jul 2020 02:42:27 +0000 (10:42 +0800)]
[DWARFYAML] Implement the .debug_rnglists section.
This patch implements the .debug_rnglists section. We are able to
produce the .debug_rnglists section by the following syntax.
```
debug_rnglists:
- Format: DWARF32 ## Optional
Length: 0x1234 ## Optional
Version: 5 ## Optional
AddressSize: 0x08 ## Optional
SegmentSelectorSize: 0x00 ## Optional
OffsetEntryCount: 2 ## Optional
Offsets: [1, 2] ## Optional
Lists:
- Entries:
- Operator: DW_RLE_base_address
Values: [ 0x1234 ]
```
The generated .debug_rnglists is verified by llvm-dwarfdump, except for
the operator DW_RLE_startx_endx, since llvm-dwarfdump doesn't support
it.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D83624
Juneyoung Lee [Mon, 20 Jul 2020 00:21:28 +0000 (09:21 +0900)]
[ValueTracking] Let isGuaranteedNotToBeUndefOrPoison use canCreateUndefOrPoison
This patch adds support more operations.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D83926
sstefan1 [Sun, 19 Jul 2020 18:45:24 +0000 (20:45 +0200)]
[Utils][Fix] remove unnecessary ; at the end
sstefan1 [Sat, 11 Jul 2020 19:53:50 +0000 (21:53 +0200)]
[Utils] Check function attributes in update_test_checks
Summary:
This introduces new flag to the update_test_checks and
update_cc_test_checks that allows for function attributes
to be checked in a check-line. If the flag is not set,
the behavior should remain the same.
Reviewers: jdoerfert
Subscribers: arichardson, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83629
Lang Hames [Sun, 19 Jul 2020 03:43:13 +0000 (20:43 -0700)]
[JITLink][MachO] Fix handling of non-extern UNSIGNED pair of SUBTRACTOR relocs.
When processing a MachO SUBTRACTOR/UNSIGNED pair, if the UNSIGNED target
is non-extern then check the r_symbolnum field of the relocation to find
the targeted section and use the section's address to find 'ToSymbol'.
Previously 'ToSymbol' was found by loading the initial value stored at
the fixup location and treating this as an address to search for. This
is incorrect, however: the initial value includes the addend and will
point to the wrong block if the addend is less than zero or greater than
the block size.
rdar://
65756694
Juneyoung Lee [Sun, 19 Jul 2020 17:21:52 +0000 (02:21 +0900)]
Fix ValueTrackingTest.cpp to use pair instead of tuple
Jameson Nash [Wed, 15 Jul 2020 13:17:42 +0000 (09:17 -0400)]
[ConstantFolding] check applicability of AllOnes constant creation first
The getAllOnesValue can only handle things that are bitcast from a
ConstantInt, while here we bitcast through a pointer, so we may see more
complex objects (like Array or Struct).
Differential Revision: https://reviews.llvm.org/D83870
Alex Richardson [Sun, 19 Jul 2020 16:24:57 +0000 (17:24 +0100)]
[llvm-reduce] Fix incorrect indices in argument reduction pass
The function extractArgumentsFromModule() was passing a one-based index to,
but replaceFunctionCalls() was expecting a zero-based argument index. This
resulted in assertion errors when reducing function call arguments with
different types. Additionally, the
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D84099
Logan Smith [Sun, 19 Jul 2020 16:35:29 +0000 (09:35 -0700)]
[llvm][NFC] Add missing 'override'
Juneyoung Lee [Sun, 19 Jul 2020 16:23:58 +0000 (01:23 +0900)]
[ValueTracking] Add canCreateUndefOrPoison & let canCreatePoison use Operator
This patch
- adds `canCreateUndefOrPoison`
- refactors `canCreatePoison` so it can deal with constantexprs
`canCreateUndefOrPoison` will be used at D83926.
Reviewed By: nikic, jdoerfert
Differential Revision: https://reviews.llvm.org/D84007
Bruno Ricci [Sun, 19 Jul 2020 16:08:17 +0000 (17:08 +0100)]
[clang] Fix the warning for a non-void consteval function without a return value to actually say "consteval".
This warning was modified in
796ed03b8412 to use the term "consteval"
for consteval functions. However the warning has never worked as
intended since the diagnostic's arguments are used in the wrong order.
This was unfortunately missed by
796ed03b8412 since no test did exercise
this specific warning.
Additionally send the NamedDecl* into the diagnostic instead of just the
IdentifierInfo* to correctly work with special names and template
arguments.
Bruno Ricci [Sun, 19 Jul 2020 15:53:59 +0000 (16:53 +0100)]
[clang] Disable a few formatting options for test/
Hopefully this will make the bot a little less noisy. Rationale for each:
AlignTrailingComments: We don't want to force-align the various expected-error
and friends.
CommentPragmas: Tell clang-format to leave the "// CHECK:" and the
"// expected-" alone.
AlwaysBreakTemplateDeclarations: Templates in tests often have no break between
the template-head and the declaration.
Differential Revision: https://reviews.llvm.org/D83901
Wenlei He [Sun, 19 Jul 2020 15:49:04 +0000 (08:49 -0700)]
Revert "[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks"
This reverts commit
2d6ecfa168c2d36ac88efc854f19b05d1c540ded.
Wenlei He [Fri, 17 Jul 2020 23:35:56 +0000 (16:35 -0700)]
[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks
Summary:
This change added a new inline advisor that takes optimization remarks from previous inlining as input, and provides the decision as advice so current inlining can replay inline decisions of a different compilation. Dwarf inline stack with line and discriminator is used as anchor for call sites including call context. The change can be useful for Inliner tuning as it provides a channel to allow external input for tweaking inline decisions. Existing alternatives like alwaysinline attribute is per-function, not per-callsite. Per-callsite inline intrinsic can be another solution (not yet existing), but it's intrusive to implement and also does not differentiate call context.
A switch -sample-profile-inline-replay=<inline_remarks_file> is added to hook up the new inline advisor with SampleProfileLoader's inline decision for replay. Since SampleProfileLoader does top-down inlining, inline decision can be specialized for each call context, hence we should be able to replay inlining accurately. However with a bottom-up inliner like CGSCC inlining, the replay can be limited due to lack of specialization for different call context. Apart from that limitation, the new inline advisor can still be used by regular CGSCC inliner later if needed for tuning purpose.
Subscribers: mgorny, aprantl, hiraditya, llvm-commits
Tags: #llvm
Resubmit for https://reviews.llvm.org/D84086
Aaron Ballman [Sun, 19 Jul 2020 15:19:48 +0000 (11:19 -0400)]
Silence a "logical operation on address of string constant" via CMake instead.
Aaron Ballman [Sun, 19 Jul 2020 15:12:39 +0000 (11:12 -0400)]
Aaron Ballman [Sun, 19 Jul 2020 14:50:51 +0000 (10:50 -0400)]
Silencing some 'logical operation on address of string constant diagnostics; NFC
Sanjay Patel [Sun, 19 Jul 2020 14:03:55 +0000 (10:03 -0400)]
[x86] split FMA with fast-math-flags to avoid libcall
fma reassoc A, B, C --> fadd (fmul A, B), C (when target has no FMA hardware)
C/C++ code may use explicit fma() calls (which become LLVM fma
intrinsics in IR) but then gets compiled with -ffast-math or similar.
For targets that do not have FMA hardware, we don't want to go out to
the math library for a precise but slow FMA result.
I tried this as a generic DAGCombine, but it caused infinite looping
on more than 1 other target, so there's likely some over-reaching fma
formation happening.
There's also a potential intersection of strict FP with fast-math here.
Deferring to current behavior for that case (assuming that strict-ness
overrides fast-ness).
Differential Revision: https://reviews.llvm.org/D83981
Roman Lebedev [Sun, 19 Jul 2020 13:37:03 +0000 (16:37 +0300)]
Reland "[InstCombine] Lower infinite combine loop detection thresholds"
This reverts commit
4500db8c59621a31c622862a2946457fdee481ce,
which was reverted because lower thresholds exposed a new issue (PR46680).
Now that it was resolved by
d12ec0f752e7f2c7f7252539da2d124264ec33f7,
we can reinstate lower limits and wait for a new bugreport before
reverting this again...
Nikita Popov [Thu, 9 Jul 2020 20:52:50 +0000 (22:52 +0200)]
[PredicateInfo] Add a method to interpret predicate as cmp constraint
Both users of predicteinfo (NewGVN and SCCP) are interested in
getting a cmp constraint on the predicated value. They currently
implement separate logic for this. This patch adds a common method
for this in PredicateBase.
This enables a missing bit of PredicateInfo handling in SCCP: Now
the predicate on the condition itself is also used. For switches
it means we know that the switched-on value is the same as the case
value. For assumes/branches we know that the condition is true or
false.
Differential Revision: https://reviews.llvm.org/D83640
Roman Lebedev [Sun, 19 Jul 2020 13:09:46 +0000 (16:09 +0300)]
[NFCI][GVN] Make IsValueFullyAvailableInBlock() readable - use enum class instead of magic numbers
This does not change any logic, it only wraps the magic 0/1/2/3 constants
into an enum class.
Sanjay Patel [Sun, 19 Jul 2020 13:24:03 +0000 (09:24 -0400)]
[InstSimplify] fold fcmp with infinity constant using isKnownNeverInfinity
This is a step towards trying to remove unnecessary FP compares
with infinity when compiling with -ffinite-math-only or similar.
I'm intentionally not checking FMF on the fcmp itself because
I'm assuming that will go away eventually.
The analysis part of this was added with rGcd481136 for use with
isKnownNeverNaN. Similarly, that could be an enhancement here to
get predicates like 'one' and 'ueq'.
Differential Revision: https://reviews.llvm.org/D84035
Nikita Popov [Sat, 18 Jul 2020 20:22:41 +0000 (22:22 +0200)]
[InstCombine] Fix store merge worklist management (PR46680)
Fixes https://bugs.llvm.org/show_bug.cgi?id=46680.
Just like insertions through IRBuilder, InsertNewInstBefore()
should be using the deferred worklist mechanism, so that processing
of newly added instructions is prioritized.
There's one side-effect of the worklist order change which could be
classified as a regression. An add op gets pushed through a select
that at the time is not a umax. We could add a reverse transform
that tries to push adds in the reverse direction to restore a min/max,
but that seems like a sure way of getting infinite loops... Seems
like something that should best wait on min/max intrinsics.
Differential Revision: https://reviews.llvm.org/D84109
David Green [Thu, 16 Jul 2020 09:36:23 +0000 (10:36 +0100)]
[ARM] Don't mark vctp as having sideeffects
As far as I can tell, it should not be necessary for VCTP to be
unpredictable in tail predicated loops. Either it has a a valid loop
counter as a operand which will naturally keep it in the right loop, or
it doesn't and it won't be converted to a tail predicated loop. Not
marking it as having side effects allows it to be scheduled more cleanly
for cases where it is not expected to become a tail predicate loop.
Differential Revision: https://reviews.llvm.org/D83907
Fangrui Song [Sun, 19 Jul 2020 07:26:01 +0000 (00:26 -0700)]
[llvm-cov gcov] Don't require NUL terminator when reading files
.gcno, .gcda and source files can be modified while we are reading them. If the
concurrent modification of a file being read nullifies the NUL terminator
assumption, llvm-cov can trip over an assertion failure in MemoryBuffer::init.
This is not so rare - the source files can be in an editor and .gcda can be
written by an running process (if the process forks, when .gcda gets written is
probably more unpredictable).
There is no accompanying test because an assertion failure requires data
races with some involved setting.
Kang Zhang [Sun, 19 Jul 2020 07:01:45 +0000 (07:01 +0000)]
[PowerPC] Remove the redundant implicit operands in ppc-early-ret pass
Summary:
In the `ppc-early-ret` pass, we have use `BuildMI` and `copyImplicitOps` when the branch instructions can do the early return. But the two functions will add implicit operands twice, this is not correct.
This patch is to remove the redundant implicit operands in `ppc-early-ret pass`.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D76042
Yuanfang Chen [Sun, 19 Jul 2020 05:23:07 +0000 (22:23 -0700)]
[NewPM] Allow passes to never be skipped
A pass declares itself unskippable by defining a method `static bool isRequired()`.
Also, this patch makes pass managers and adaptor passes required (unskippable).
PassInstrumentation before-pass-callbacks could be used to skip passes by returning false.
However, some passes should not be skipped at all. Especially so for special-purpose passes such as pass managers and adaptor passes since if they are skipped for any reason, the passes contained by them would also be skipped ignoring contained passes's return value of `isRequired()`.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D82344
Yuanfang Chen [Sun, 19 Jul 2020 05:26:37 +0000 (22:26 -0700)]
[NewPM] make parsePassPipeline parse adaptor-wrapped user passes
Currently, when parsing text pipeline, different kinds of passes always
introduce nested pass managers. This makes it impossible to test the
adaptor-wrapped user passes from the text pipeline interface which is needed
by D82344 test cases. This also seems useful in general. See comments above
`parsePassPipeline`.
The syntax would be like mixing passes of different types, but it is
not the same as inferring the correct pass type and then adding the
matching nested pass managers. Strictly speaking, the resulted pipelines
are different.
Reviewed By: asbirlea, aeubanks
Differential Revision: https://reviews.llvm.org/D82698
Fangrui Song [Sun, 19 Jul 2020 04:01:41 +0000 (21:01 -0700)]
[Driver] --print-search-dirs: print -B options and COMPILER_PATH
Fangrui Song [Sun, 19 Jul 2020 03:26:01 +0000 (20:26 -0700)]
[Driver] -B: don't search for target triple prefixes
To match GCC (either crossing or not), which doesn't prepend target triple prefixes to `exec_prefixes`.
As an example, powerpc64le-linux-gnu-gcc does not search "powerpc64le-linux-gnu-${name}" in a -B path.
Mehdi Amini [Sat, 18 Jul 2020 22:21:29 +0000 (22:21 +0000)]
Fix invalid link in the MLIR Standard Dialect www page (2nd attempt)
Fangrui Song [Sat, 18 Jul 2020 22:07:46 +0000 (15:07 -0700)]
[gcov] Add __gcov_dump/__gcov_reset and delete __gcov_flush
GCC r187297 (2012-05) introduced `__gcov_dump` and `__gcov_reset`.
`__gcov_flush = __gcov_dump + __gcov_reset`
The resolution to https://gcc.gnu.org/PR93623 ("No need to dump gcdas when forking" target GCC 11.0) removed the unuseful and undocumented __gcov_flush.
Close PR38064.
Reviewed By: calixte, serge-sans-paille
Differential Revision: https://reviews.llvm.org/D83149
Fangrui Song [Sun, 12 Jul 2020 00:17:21 +0000 (17:17 -0700)]
[gcov][test] Simplify instrprof-dlopen-dlclose-gcov.test
Nikita Popov [Sat, 18 Jul 2020 21:36:42 +0000 (23:36 +0200)]
[InstCombine] Add test for PR46680 (NFC)
Bruno Ricci [Sat, 18 Jul 2020 19:44:06 +0000 (20:44 +0100)]
[clang][NFC] Tests showing the problems with some uses of NamedDecl::getDeclName in diagnostics, SemaOverload.cpp+SemaStmt.cpp part
Bruno Ricci [Sat, 18 Jul 2020 19:39:16 +0000 (20:39 +0100)]
[clang][NFC] Tests showing the problems with some uses of NamedDecl::getDeclName in diagnostics, SemaExpr.cpp part
Bruno Ricci [Sat, 18 Jul 2020 19:35:16 +0000 (20:35 +0100)]
[clang] Provide a more specific diagnostic for a misplaced lambda capture-default.
Currently a capture-default which is not the first element in the lambda-capture
is diagnosed with a generic expected variable name or 'this' in lambda capture
list, which is true but not very helpful.
If we don't have already parsed a capture-default then a lone "&" or "=" is
likely to be a misplaced capture-default, so diagnose it as such.
Differential Revision: https://reviews.llvm.org/D83681
Reviewed By: aaron.ballman
peter klausler [Fri, 17 Jul 2020 18:17:39 +0000 (11:17 -0700)]
[flang] Improve output from a STOP statement
Add a missing newline to IEEE FP flag formatting, and
don't neglect to emit STOP when there's no code number.
Reviewed By: tskeith
Differential Revision: https://reviews.llvm.org/D84060
Fangrui Song [Sat, 18 Jul 2020 18:10:18 +0000 (11:10 -0700)]
[gcov][test] Call wait() to make gcov-fork.c reliable
If the parent exit before the child, the line counts might be 1.
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26: 1: 21: if (fork() == -1) return 1; // CHECK-NEXT: 1: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27: 1: 22: func2(); // CHECK-NEXT: 2: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28: 1: 23: return 0; // CHECK-NEXT: 2: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
peter klausler [Fri, 17 Jul 2020 18:14:28 +0000 (11:14 -0700)]
[flang] Insert leading blanks in LOGICAL formatted output fields
Summary: For Lw output editing, emit (w-1) blanks before the T or the F.
Reviewed By: sscalpone, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D84059
Artem Dergachev [Sat, 18 Jul 2020 02:42:20 +0000 (19:42 -0700)]
[analyzer] scan-build: Fix silencing multiple core checkers.
It was only silencing one checker because -analyzer-config flags
can only carry one value at a time.
Joseph Huber [Sat, 18 Jul 2020 16:00:08 +0000 (12:00 -0400)]
[OpenMP] Add Additional Function Attribute Information to OMPKinds.def
Summary:
This patch adds more function attribute information to the runtime function definitions in OMPKinds.def. The goal is to provide sufficient information about OpenMP runtime functions to perform more optimizations on OpenMP code.
Reviewers: jdoerfert
Subscribers: aaron.ballman cfe-commits yaxunl guansong sstefan1 llvm-commits
Tags: #OpenMP #clang #LLVM
Differential Revision: https://reviews.llvm.org/D81031
Roman Lebedev [Sat, 18 Jul 2020 16:41:21 +0000 (19:41 +0300)]
[NFC][CVP] processSDiv(): pacify gcc compilers
Mehdi Amini [Sat, 18 Jul 2020 16:22:31 +0000 (16:22 +0000)]
Fix dead link on MLIR website
Mehdi Amini [Sat, 18 Jul 2020 16:12:41 +0000 (16:12 +0000)]
Fix Markdown format for lists in the Standard Dialect documentation
This affects the rendering on the website.
Fangrui Song [Sat, 18 Jul 2020 16:07:40 +0000 (09:07 -0700)]
[ELF][test] Update test after DW_EH_PE_sdata4/DW_EH_PE_sdata8 change
Anders Waldenborg [Sat, 18 Jul 2020 15:26:06 +0000 (17:26 +0200)]
[clang-format] Make sure rst documentation matches comments
clang/docs/tools/dump_format_style.py is used to read the comments
from clang/include/clang/Format/Format.h and update the contents of
clang/docs/ClangFormatStyleOptions.rst
Recent changes made these out of date. This commit syncs them by
folding the improved wording back to the comments and then
regenerating the rst file.
Differential Revision: https://reviews.llvm.org/D84103
Fangrui Song [Sat, 18 Jul 2020 15:59:05 +0000 (08:59 -0700)]
[DebugInfo] Respect relocations when decoding DW_EH_PE_sdata4 & DW_EH_PE_sdata8 and support R_ARM_REL32
The addresses in llvm-dwarfdump --eh-frame output for object files are closer to readelf -wf output now.
Florian Hahn [Sat, 18 Jul 2020 14:59:51 +0000 (15:59 +0100)]
[PredicateInfo] Fold PredicateWithCondition into PredicateBase (NFC).
Each concrete instance of a predicate has a condition (also noted in the
original PredicateBase comment) and to me it seems like there is no
clear benefit of having both PredicateBase and PredicateWithCondition
and they can be folded together.
Reviewers: nikic, efriedma
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84089
Roman Lebedev [Sat, 18 Jul 2020 10:23:26 +0000 (13:23 +0300)]
[CVP] Soften SDiv into a UDiv as long as we know domains of both of the operands.
Yes, if operands are non-positive this comes at the extra cost
of two extra negations. But a. division is already just
ridiculously costly, two more subtractions can't hurt much :)
and b. we have better/more analyzes/folds for an unsigned division,
we could end up narrowing it's bitwidth, converting it to lshr, etc.
This is essentially a take two on
0fdcca07ad2c0bdc2cdd40ba638109926f4f513b,
which didn't fix the potential regression i was seeing,
because ValueTracking's computeKnownBits() doesn't make use
of dominating conditions in it's analysis.
While i could teach it that, this seems like the more general fix.
This big hammer actually does catch said potential regression.
Over vanilla test-suite + RawSpeed + darktable
(10M IR instrs, 1M IR BB, 1M X86 ASM instrs), this fires/converts 5 more
(+2%) SDiv's, the total instruction count at the end of middle-end pipeline
is only +6, so out of +10 extra negations, ~half are folded away,
and asm instr count is only +1, so practically speaking all extra
negations are folded away and are therefore free.
Sadly, all these new UDiv's remained, none folded away.
But there are two less basic blocks.
https://rise4fun.com/Alive/VS6
Name: v0
Pre: C0 >= 0 && C1 >= 0
%r = sdiv i8 C0, C1
=>
%r = udiv i8 C0, C1
Name: v1
Pre: C0 <= 0 && C1 >= 0
%r = sdiv i8 C0, C1
=>
%t0 = udiv i8 -C0, C1
%r = sub i8 0, %t0
Name: v2
Pre: C0 >= 0 && C1 <= 0
%r = sdiv i8 C0, C1
=>
%t0 = udiv i8 C0, -C1
%r = sub i8 0, %t0
Name: v3
Pre: C0 <= 0 && C1 <= 0
%r = sdiv i8 C0, C1
=>
%r = udiv i8 -C0, -C1
Roman Lebedev [Sat, 18 Jul 2020 10:13:01 +0000 (13:13 +0300)]
[NFC][CVP] Rename predicates - s/positive/non negative/ to better note that zero is ok
Roman Lebedev [Sat, 18 Jul 2020 10:07:13 +0000 (13:07 +0300)]
[NFC][CVP] Refactor isPositive() out of hasPositiveOperands()
Roman Lebedev [Sat, 18 Jul 2020 14:30:42 +0000 (17:30 +0300)]
[NFC][CVP] Add tests for possible sdiv->udiv where operands are not non-negative
Currently that fold requires both operands to be non-negative,
but the only real requirement for the fold is that we must know
the domains of the operands.
Matt Arsenault [Sat, 18 Jul 2020 14:35:40 +0000 (10:35 -0400)]
AMDGPU/GlobalISel: Address some test fixmes that don't fail now
Matt Arsenault [Sat, 18 Jul 2020 14:08:17 +0000 (10:08 -0400)]
AMDGPU/GlobalISel: Fix test copy paste error
David Green [Fri, 17 Jul 2020 07:35:04 +0000 (08:35 +0100)]
[LV] Add additional InLoop redution tests. NFC
Evgeny Leviant [Sat, 18 Jul 2020 11:11:40 +0000 (14:11 +0300)]
[CodeGen][TargetPassConfig] Add TargetTransformInfo pass correctly
Patch adds tti pass directly enforcing its execution with correctly set
TargetTransformInfo.
Differential revision: https://reviews.llvm.org/D84047
Vitaly Buka [Sat, 18 Jul 2020 09:16:17 +0000 (02:16 -0700)]
[sanitizer] Disable test on incompatible platforms