Adrian Prantl [Tue, 21 Jul 2020 20:53:43 +0000 (13:53 -0700)]
Thread ExecutionContextScope through GetByteSize where possible (NFC-ish)
This patch has no effect for C and C++. In more dynamic languages,
such as Objective-C and Swift GetByteSize() needs to call into the
language runtime, so it's important to pass one in where possible. My
primary motivation for this is some work I'm doing on the Swift
branch, however, it looks like we are also seeing warnings in
Objective-C that this may resolve. Everything in the SymbolFile
hierarchy still passes in nullptrs, because we don't have an execution
context in SymbolFile, since SymbolFile transcends processes.
Differential Revision: https://reviews.llvm.org/D84267
Arthur Eubanks [Wed, 22 Jul 2020 15:40:55 +0000 (08:40 -0700)]
[NFC][NewPM] Add clarification on analysis manager proxies
Explain why you can only get a cached analysis result, not compute one
on the fly.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D84259
Simon Pilgrim [Wed, 22 Jul 2020 14:18:32 +0000 (15:18 +0100)]
ProfileSummaryInfo.h - remove unnecessary ProfileSummary forward declaration. NFCI.
This is defined in ProfileSummary.h which we have to explicitly include already.
Anton Afanasyev [Thu, 16 Jul 2020 14:57:33 +0000 (17:57 +0300)]
[SLP][Test] Precommit tests for D83779. NFC.
Joel E. Denny [Wed, 22 Jul 2020 15:22:08 +0000 (11:22 -0400)]
Revert "[OpenMP] Implement TR8 `present` map type modifier in runtime (2/2)"
This reverts commit
45b8f7ec35ef653bafdf48034857222517c17781.
It attempts to use debug macros `DPxMOD` and `DPxPTR` in release
builds. Will fix and reapply later.
Hans Wennborg [Wed, 22 Jul 2020 15:01:57 +0000 (17:01 +0200)]
Revert
abd45154b "[Coverage] Add comment to skipped regions"
This casued assertions during Chromium builds. See comment on the code review
> Bug filled here: https://bugs.llvm.org/show_bug.cgi?id=45757.
> Add comment to skipped regions so we don't track execution count for lines containing only comments.
>
> Differential Revision: https://reviews.llvm.org/D84208
This reverts commit
abd45154bdb6b76c5b480455eacc8c75b08242aa and the
follow-up
87d725473380652bbe845fd2fbd9c0507a55172f.
Sebastian Neubauer [Wed, 22 Jul 2020 15:00:43 +0000 (17:00 +0200)]
Fix target specific InstCombine
A clang arm test was failing if clang is compiled without arm support.
Regression was introduced in
2a6c871596ce8bdd23501a96fd22f0f16d3cfcad
SharmaRithik [Wed, 22 Jul 2020 14:42:57 +0000 (20:12 +0530)]
[CodeMoverUtils] Add more data dependency related test case
Summary: This patch adds more test case focusing on data dependency.
Authored By: RithikSharma
Reviewer: Whitney, bmahjour, etiotto
Reviewed By: Whitney
Subscribers: llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D83543
Benson Li [Wed, 22 Jul 2020 14:22:59 +0000 (16:22 +0200)]
[lldb] add printing of stdout compile errors to lldbsuite
Summary: Add printing of the output of stdout during compile errors, in
addition to stderr output.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D83425
Georgii Rymar [Tue, 21 Jul 2020 10:13:01 +0000 (13:13 +0300)]
[llvm-readobj] - Don't get the name of the symbol table in ELFDumper<ELFT>::printSymbolsHelper.
It was requested in D84173 thread to not do it, because otherwise we extract and
check the name of the symbol table in LLVM style, but do not use it and
might report a warning which perhaps might be confusing.
Differential revision: https://reviews.llvm.org/D84231
Florian Hahn [Wed, 22 Jul 2020 13:53:22 +0000 (14:53 +0100)]
[SCEVExpander] Fix indentation/formatting (NFC).
The declarations inside the llvm namespace where indented too much. Fix
it by re-running clang-format on the whole file.
Dmitry Preobrazhensky [Wed, 22 Jul 2020 14:16:59 +0000 (17:16 +0300)]
[AMDGPU][MC] Corrected decoding of 16-bit literals
16-bit literals are encoded as 32-bit values. If high 16-bits of the value is 0xFFFF, the decoded instruction cannot be reassembled.
For example, the following code
0xff,0x04,0x04,0x52,0xcd,0xab,0xff,0xff
was decoded as
v_mul_lo_u16_e32 v2, 0xffffabcd, v2
However this literal is actually a 64-bit constant 0x00000000ffffabcd which violates requirements described in the documentation - the truncation is not safe.
This change corrects decoding to make reassembly possible.
Reviewers: arsenm, rampitec
Differential Revision: https://reviews.llvm.org/D84098
David Carlier [Wed, 22 Jul 2020 14:15:45 +0000 (15:15 +0100)]
[compiler-rt] fix build on Illumos
- there are additional fields for glob_t struct, thus size check is failing.
- to access old mman.h api based on caddr_t, _XOPEN_SOURCE needs to be not defined
thus we provide the prototype.
- prxmap_t constified.
Reviewers: ro, eugenis
Reviewed-By: ro
Differential Revision: https://reviews.llvm.org/D84046
Joel E. Denny [Wed, 22 Jul 2020 14:14:30 +0000 (10:14 -0400)]
[OpenMP] Implement TR8 `present` map type modifier in runtime (2/2)
This implements OpenMP runtime support for the OpenMP TR8 `present`
map type modifier. The previous patch in this series implements Clang
front end support. See that patch summary for behaviors that are not
yet supported.
Reviewed By: grokos, jdoerfert
Differential Revision: https://reviews.llvm.org/D83062
Joel E. Denny [Wed, 22 Jul 2020 14:14:00 +0000 (10:14 -0400)]
[OpenMP] Implement TR8 `present` map type modifier in Clang (1/2)
This patch implements Clang front end support for the OpenMP TR8
`present` map type modifier. The next patch in this series implements
OpenMP runtime support.
This patch does not attempt to implement TR8 sec. 2.22.7.1 "map
Clause", p. 319, L14-16:
> If a map clause with a present map-type-modifier is present in a map
> clause, then the effect of the clause is ordered before all other
> map clauses that do not have the present modifier.
Compare to L10-11, which Clang does not appear to implement yet:
> For a given construct, the effect of a map clause with the to, from,
> or tofrom map-type is ordered before the effect of a map clause with
> the alloc, release, or delete map-type.
This patch also does not implement the `present` implicit-behavior for
`defaultmap` or the `present` motion-modifier for `target update`.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D83061
Stefan Pintilie [Tue, 21 Jul 2020 19:29:54 +0000 (14:29 -0500)]
[PowerPC] Add linker opt for PC Relative GOT indirect accesses
A linker optimization is available on PowerPC for GOT indirect PCRelative loads.
The idea is that we can mark a usual GOT indirect load:
pld 3, vec@got@pcrel(0), 1
lwa 3, 4(3)
With a relocation to say that if we don't need to go through the GOT we can let
the linker further optimize this and replace a load with a nop.
pld 3, vec@got@pcrel(0), 1
.Lpcrel1:
.reloc .Lpcrel1-8,R_PPC64_PCREL_OPT,.-(.Lpcrel1-8)
lwa 3, 4(3)
This patch adds the logic that allows the compiler to add the R_PPC64_PCREL_OPT.
Reviewers: nemanjai, lei, hfinkel, sfertile, efriedma, tstellar, grosbach
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D79864
jasonliu [Fri, 17 Jul 2020 18:40:02 +0000 (18:40 +0000)]
[XCOFF] Enable symbol alias for AIX
Summary:
AIX assembly's .set directive is not usable for aliasing purpose.
We need to use extra-label-at-defintion strategy to generate symbol
aliasing on AIX.
Reviewed By: DiggerLin, Xiangling_L
Differential Revision: https://reviews.llvm.org/D83252
Sebastian Neubauer [Wed, 3 Jun 2020 13:56:40 +0000 (15:56 +0200)]
[InstCombine] Move target-specific inst combining
For a long time, the InstCombine pass handled target specific
intrinsics. Having target specific code in general passes was noted as
an area for improvement for a long time.
D81728 moves most target specific code out of the InstCombine pass.
Applying the target specific combinations in an extra pass would
probably result in inferior optimizations compared to the current
fixed-point iteration, therefore the InstCombine pass resorts to newly
introduced functions in the TargetTransformInfo when it encounters
unknown intrinsics.
The patch should not have any effect on generated code (under the
assumption that code never uses intrinsics from a foreign target).
This introduces three new functions:
TargetTransformInfo::instCombineIntrinsic
TargetTransformInfo::simplifyDemandedUseBitsIntrinsic
TargetTransformInfo::simplifyDemandedVectorEltsIntrinsic
A few target specific parts are left in the InstCombine folder, where
it makes sense to share code. The largest left-over part in
InstCombineCalls.cpp is the code shared between arm and aarch64.
This allows to move about 3000 lines out from InstCombine to the targets.
Differential Revision: https://reviews.llvm.org/D81728
Simon Pilgrim [Wed, 22 Jul 2020 13:12:36 +0000 (14:12 +0100)]
DebugSubsectionVisitor.h - remove unnecessary includes/forward declarations. NFC.
We don't need the StringsAndChecksumsRef forward declaration as we have to include StringsAndChecksums.h.
We don't need DebugSubsectionRecord.h and we forward declare all referenced classes.
We don't need to include cstdint as we don't use any stdint types.
Simon Pilgrim [Wed, 22 Jul 2020 12:21:45 +0000 (13:21 +0100)]
SelectionDAGBuilder.cpp - remove duplicate includes that already exist in SelectionDAGBuilder.h. NFC.
Simon Pilgrim [Mon, 20 Jul 2020 15:14:22 +0000 (16:14 +0100)]
MappedBlockStream.h - remove unnecessary MSFLayout forward declaration. NFCI.
This is defined in MSFCommon.h which we have to explicitly include already.
Alexey Bataev [Wed, 22 Jul 2020 13:03:30 +0000 (09:03 -0400)]
[SLP]Add an extra test for vectorization of non-pow-2 trees, NFC.
Roman Lebedev [Wed, 22 Jul 2020 13:09:51 +0000 (16:09 +0300)]
[NFC][Reduce] Add a test showing that we fail to to reduce single/last feature
Roman Lebedev [Wed, 22 Jul 2020 13:07:13 +0000 (16:07 +0300)]
[NFC][Reduce] Rewrite remove-funcs.ll to use FileCheck, make it less fragile
David Green [Wed, 22 Jul 2020 13:08:29 +0000 (14:08 +0100)]
[ARM] Extra MVE select(binop) patterns
This is very similar to
243970d03cace2, but handling a slightly
different form of predicated operations. When starting with a pattern of
the form select(p, BinOp(x, y), x), Instcombine will often transform
this to BinOp(x, select(p, y, 0)), where 0 is the identity value of the
binop (0 for adds/subs, 1 for muls, -1 for ands etc). This adds the
patterns that transforms those back into predicated binary operations.
There is also a very minor adjustment to tablegen null_frag in here, to
allow it to also be recognized as a PatLeaf node, so that it can be used
in MVE_TwoOpPattern to easily exclude the cases where we do not need the
alternate transform.
Differential Revision: https://reviews.llvm.org/D84091
Aleksandr Platonov [Wed, 22 Jul 2020 12:59:36 +0000 (15:59 +0300)]
[clangd] Fixes in lit tests
Summary:
Changes:
- `background-index.test` Add Windows support, don't create redundant `*-e` files on macOS
- `did-change-configuration-params.test` Replace `cat | FileCheck` with `FileCheck --input-file`
- `test-uri-windows.test` This test did not run on Windows displite `REQUIRES: windows-gnu || windows-msvc` (replacement: `UNSUPPORTED: !(windows-gnu || windows-msvc)`).
Reviewers: sammccall, kadircet
Reviewed By: kadircet
Subscribers: thakis, njames93, ormris, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83759
David Green [Wed, 22 Jul 2020 12:24:01 +0000 (13:24 +0100)]
[ARM] Add patterns for select(p, BinOp(x, y), z) -> BinOpT(x, y,p z)
Most MVE instructions can be predicated to fold a select into the
instruction, using the predicate and the selects else as a passthough.
This adds tablegen patterns for most two operand instructions using the
newly added TwoOpPattern from
1030e82598da.
Differential Revision: https://reviews.llvm.org/D83222
OCHyams [Wed, 22 Jul 2020 08:25:14 +0000 (09:25 +0100)]
[DebugInfo] Drop location ranges for variables which exist entirely outside the variable's scope
Summary:
This patch reduces file size in debug builds by dropping variable locations a
debugger user will not see.
After building the debug entity history map we loop through it. For each
variable we look at each entry. If the entry opens a location range which does
not intersect any of the variable's scope's ranges then we mark it for removal.
After visiting the entries for each variable we also mark any clobbering
entries which will no longer be referenced for removal, and then finally erase
the marked entries. This all requires the ability to query the order of
instructions, so before this runs we number them.
Tests:
Added llvm/test/DebugInfo/X86/trim-var-locs.mir
Modified llvm/test/DebugInfo/COFF/register-variables.ll
Branch folding merges the tails of if.then and if.else into if.else. Each
blocks' debug-locations point to different scopes so when they're merged we
can't use either. Because of this the variable 'c' ends up with a location
range which doesn't cover any instructions in its scope; with the patch
applied the location range is dropped and its flag changes to IsOptimizedOut.
Modified llvm/test/DebugInfo/X86/live-debug-variables.ll
Modified llvm/test/DebugInfo/ARM/PR26163.ll
In both tests an out of scope location is now removed. The remaining location
covers the entire scope of the variable allowing us to emit it as a single
location.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D82129
Georgii Rymar [Tue, 21 Jul 2020 13:48:39 +0000 (16:48 +0300)]
[llvm-readelf] - Introduce describe() helper functions.
These functions can be used to generate strings like
"SHT_?? section with index ?" to describe sections in error/warning messages,
what helps to simplify and generalize them.
Also this allows to isolate the following common code pattern:
`&Sec - &cantFail(Obj->sections()).front();`
Differential revision: https://reviews.llvm.org/D84240
Sebastian Neubauer [Tue, 21 Jul 2020 08:28:12 +0000 (10:28 +0200)]
[AMDGPU] Don't combine memory intrs to v3i16
v3i16 and v3f16 currently cannot be legalized and lowered so they should
not be emitted by inst combining.
Moved the check down to still allow extracting 1 or 2 elements via the dmask.
Fixes image intrinsics being combined to return v3x16.
Differential Revision: https://reviews.llvm.org/D84223
Florian Hahn [Wed, 22 Jul 2020 10:33:57 +0000 (11:33 +0100)]
[lAA] Return SmallVectorImpl& instead of SmallVector& (NFC).
Georgii Rymar [Mon, 20 Jul 2020 13:28:17 +0000 (16:28 +0300)]
[llvm-readelf/readobj] - Fix the behavior when a sections is included in two groups at the same time.
The current behavior was introduced by me in D37567 and it is a bit strange. It prints the
"Error: ...." message to the errs() manually and stops dumping the group section which has this error.
This behavior is consistent with GNU though, but it is very inconsistent with what the regular llvm-readelf
code usually does/prints, so I suggest to change the implementation:
1) Instead of printing "Error: ...." to errs() - just report a warning.
2) Try to continue dumping the section.
3) Merge broken-group.test to group.text.
This is what this patch does.
Differential revision: https://reviews.llvm.org/D84170
Chen Zheng [Wed, 22 Jul 2020 10:01:52 +0000 (06:01 -0400)]
[PowerPC] fixupIsDeadOrKill start and end in different block fixing
In fixupIsDeadOrKill, we assume StartMI and EndMI not exist in same
basic block, so we add an assertion in that function. This is wrong
before RA, as before RA the true definition may exist in another
block through copy like instructions.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D83365
Joachim Protze [Wed, 22 Jul 2020 10:14:28 +0000 (12:14 +0200)]
[OpenMP][NFC] pass on env variables to libomptarget tests
Ilya Golovenko [Wed, 22 Jul 2020 10:13:08 +0000 (12:13 +0200)]
[clangd] Fix conversion from Windows UNC paths to file URI format.
Summary:
The fix improves handling of Windows UNC paths to align with Appendix E. Nonstandard Syntax Variations of RFC 8089.
Before this fix it was difficult to use Windows UNC paths in compile_commands.json database as such paths were converted to file URIs using 'file:////auth/share/file.cpp' notation instead of recommended 'file://auth/share/file.cpp'.
As an example, VS.Code cannot understand file URIs with 4 starting slashes, thus such features as go-to-definition, jump-to-file, hover tooltip, etc. stop working. This also applicable to files which reside on Windows network-mapped drives because clangd internally resolves file paths to real paths in some cases and such paths get resolved to UNC paths.
Reviewers: sammccall, kadircet
Reviewed By: sammccall
Subscribers: ormris, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, kbobyrev, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84172
Georgii Rymar [Mon, 20 Jul 2020 14:30:52 +0000 (17:30 +0300)]
[llvm-readobj/readelf] - Don't fail dumping when unable to read the name of the SHT_DYNSYM section.
We have an issue currently: we are trying to read the name of the SHT_DYNSYM section
very early and using `unwrapOrError` call for that.
The name is needed only for the GNU output. Because of the current logic, the tool
fails to dump the whole object when something is wrong with the name of the .dynsym section.
This patch delays reading the name and also allows it to be broken.
Differential revision: https://reviews.llvm.org/D84173
Max Kazantsev [Wed, 22 Jul 2020 10:10:36 +0000 (17:10 +0700)]
[Test] Add more simple tests for PR46786
Vitaly Buka [Wed, 22 Jul 2020 10:01:34 +0000 (03:01 -0700)]
[sanitizer,NFC] InternalAlloc cleanup
Valeriy Savchenko [Tue, 7 Jul 2020 08:36:20 +0000 (11:36 +0300)]
[analyzer][solver] Track symbol disequalities
Summary:
This commmit adds another relation that we can track separately from
range constraints. Symbol disequality can help us understand that
two equivalence classes are not equal to each other. We can generalize
this knowledge to classes because for every a,b,c, and d that
a == b, c == d, and b != c it is true that a != d.
As a result, we can reason about other equalities/disequalities of symbols
that we know nothing else about, i.e. no constraint ranges associated
with them. However, we also benefit from the knowledge of disequal
symbols by following the rule:
if a != b and b == C where C is a constant, a != C
This information can refine associated ranges for different classes
and reduce the number of false positives and paths to explore.
Differential Revision: https://reviews.llvm.org/D83286
Valeriy Savchenko [Wed, 24 Jun 2020 09:50:56 +0000 (12:50 +0300)]
[analyzer][solver] Track symbol equivalence
Summary:
For the most cases, we try to reason about symbol either based on the
information we know about that symbol in particular or about its
composite parts. This is faster and eliminates costly brute force
searches through existing constraints.
However, we do want to support some cases that are widespread enough
and involve reasoning about different existing constraints at once.
These include:
* resoning about 'a - b' based on what we know about 'b - a'
* reasoning about 'a <= b' based on what we know about 'a > b' or 'a < b'
This commit expands on that part by tracking symbols known to be equal
while still avoiding brute force searches. It changes the way we track
constraints for individual symbols. If we know for a fact that 'a == b'
then there is no need in tracking constraints for both 'a' and 'b' especially
if these constraints are different. This additional relationship makes
dead/live logic for constraints harder as we want to maintain as much
information on the equivalence class as possible, but we still won't
carry the information that we don't need anymore.
Differential Revision: https://reviews.llvm.org/D82445
Valeriy Savchenko [Tue, 23 Jun 2020 14:46:03 +0000 (17:46 +0300)]
[analyzer] Introduce small improvements to the solver infra
Summary:
* Add a new function to delete points from range sets.
* Introduce an internal generic interface for range set intersections.
* Remove unnecessary bits from a couple of solver functions.
* Add in-code sections.
Differential Revision: https://reviews.llvm.org/D82381
Pavel Labath [Mon, 20 Jul 2020 14:52:38 +0000 (16:52 +0200)]
[lldb/test] Delete result formatter machinery entirely
After more investigation, I realised this part of the code is totally
unused. It was used for communicating the test results from the
"inferior" dotest process to the main "dosep" process running
everything. Now that everything is being orchestrated through lit, this
is not used for anything.
Sander de Smalen [Wed, 22 Jul 2020 09:04:36 +0000 (10:04 +0100)]
[AArch64][SVE] Correctly allocate scavenging slot in presence of SVE.
This patch addresses two issues:
* Forces the availability of the base-pointer (x19) when the frame has
both scalable vectors and variable-length arrays. Otherwise it will
be expensive to access non-SVE locals.
* In presence of SVE stack objects, it will allocate the emergency
scavenging slot close to the SP, so that they can be accessed from
the SP or BP if available. If accessed from the frame-pointer, it will
otherwise need an extra register to access the scavenging slot because
of mixed scalable/non-scalable addressing modes.
Reviewers: efriedma, ostannard, cameron.mcinally, rengolin, david-arm
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D70174
Med Ismail Bennani [Wed, 22 Jul 2020 09:46:44 +0000 (11:46 +0200)]
[lldb/interpreter] Fix formatting in CommandInterpreter.cpp (NFC)
This patch addresses some formatting issues introduced by commit
5bb742b10dafd595223172ae985687765934ebe9
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Marcel Hlopko [Wed, 22 Jul 2020 08:34:53 +0000 (10:34 +0200)]
Make lit TestRunner.py work in Python 3
Summary: In Python3 SubstituteCaptures are no longer converted to String implicitly behind the scenes. Converting explicitly makes the TestRunner to work in Python3.
Reviewers: gribozavr2, compnerd
Reviewed By: gribozavr2
Subscribers: tbkka, delcypher, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81361
Med Ismail Bennani [Tue, 21 Jul 2020 14:29:16 +0000 (16:29 +0200)]
[lldb/interpreter] Add ability to save lldb session to a file
This patch introduce a new feature that allows the users to save their
debugging session's transcript (commands + outputs) to a file.
It differs from the reproducers since it doesn't require to capture a
session preemptively and replay the reproducer file in lldb.
The user can choose the save its session manually using the session save
command or automatically by setting the interpreter.save-session-on-quit
on their init file.
To do so, the patch adds a Stream object to the CommandInterpreter that
will hold the input command from the IOHandler and the CommandReturnObject
output and error. This way, that stream object accumulates passively all
the interactions throughout the session and will save them to disk on demand.
The user can specify a file path where the session's transcript will be
saved. However, it is optional, and when it is not provided, lldb will
create a temporary file name according to the session date and time.
rdar://
63347792
Differential Revision: https://reviews.llvm.org/D82155
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
David Green [Wed, 22 Jul 2020 09:40:02 +0000 (10:40 +0100)]
[ARM] Predicated binary operation tests. NFC
Pavel Labath [Fri, 10 Jul 2020 12:58:29 +0000 (14:58 +0200)]
[lldb/test] Do a better job at setting (DY)LD_LIBRARY_PATH
Summary:
registerSharedLibrariesWithTarget was setting the library path
environment variable to the process build directory, but the function is
also accepting libraries in other directories (in which case they won't
be found automatically).
This patch makes the function set the path variable correctly for these
libraries too. This enables us to remove the code for setting the path
variable in TestWeakSymbols.py, which was working only accidentally --
it was relying on the fact that
launch_info.SetEnvironmentEntries(..., append=True)
would not overwrite the path variable it has set, but that is going to
change with D83306.
Reviewers: davide, jingham
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D83552
Stefan Pintilie [Tue, 21 Jul 2020 17:54:48 +0000 (12:54 -0500)]
[PowerPC] Extend .reloc directive on PowerPC
When the compiler generates a GOT indirect load it must generate two loads. One
that loads the address of the element from the GOT and a second to load the
actual element based on the address just loaded from the GOT. However, the
linker can optimize these two loads into one load if it knows that it is safe
to do so. The compiler can tell the linker that the optimization is safe
by using the R_PPC64_PCREL_OPT relocation.
This patch extends the .reloc directive to allow the following setup
pld 3, vec@got@pcrel(0), 1
.Lpcrel1=.-8
... More instructions possible here ...
.reloc .Lpcrel1,R_PPC64_PCREL_OPT,.-.Lpcrel1
lwa 3, 4(3)
Reviewers: nemanjai, lei, hfinkel, sfertile, efriedma, tstellar, grosbach, MaskRay
Reviewed By: nemanjai, MaskRay
Differential Revision: https://reviews.llvm.org/D79625
Kadir Cetinkaya [Wed, 22 Jul 2020 08:35:23 +0000 (10:35 +0200)]
[clangd] Fix Origin and MainFileOnly-ness for macros
Summary:
This was resulting in macros coming from preambles vanishing when user
have opened the source header. For example:
```
// test.h:
#define X
```
and
```
// test.cc
#include "test.h
^
```
If user only opens test.cc, we'll get `X` as a completion candidate,
since it is indexed as part of the preamble. But if the user opens
test.h afterwards we would index it as part of the main file and lose
the symbol (as new index shard for test.h will override the existing one
in dynamic index).
Also we were not setting origins for macros correctly, this patch also
fixes it.
Fixes https://github.com/clangd/clangd/issues/461
Reviewers: hokein
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84297
Simon Wallis [Wed, 22 Jul 2020 09:11:57 +0000 (10:11 +0100)]
[Thumb] set code alignment for 16-bit load from constant pool
Summary:
[Thumb] set code alignment for 16-bit load from constant pool
LLVM miscompiles this code when compiling for a target with v8.2-A FP16 and the Thumb ISA at -O0:
extern void bar(__fp16 P5);
int main() {
__fp16 P5 = 1.96875;
bar(P5);
}
The code section containing main has 2 byte alignment.
It needs to have 4 byte alignment,
because the load literal instruction has an offset from the
load address with the low 2 bits zeroed.
I do not include a test case in this check-in.
llc and llvm-mc do not exhibit this bug. They do not set code section alignment
in the same manner as clang.
Reviewers: dnsampaio
Reviewed By: dnsampaio
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84169
Sjoerd Meijer [Tue, 21 Jul 2020 15:33:24 +0000 (16:33 +0100)]
[Matrix] Add LowerMatrixIntrinsics to the NPM
Pass LowerMatrixIntrinsics wasn't running yet running under the new pass
manager, and this adds LowerMatrixIntrinsics to the pipeline (to the
same place as where it is running in the old PM).
Differential Revision: https://reviews.llvm.org/D84180
Max Kazantsev [Wed, 22 Jul 2020 08:32:13 +0000 (15:32 +0700)]
[SCEV] Remove premature assert. PR46786
This assert was added to verify assumption that GEP's SCEV will be of pointer type,
basing on fact that it should be a SCEVAddExpr with (at least) last operand being
pointer. Two notes:
- GEP's SCEV does not have to be a SCEVAddExpr after all simplifications;
- In current state, GEP's SCEV does not have to have at least one pointer operands
(all of them can become int during the transforms).
However, we might want to be at a point where it is true. We are currently removing
this assert and will try to enumerate the cases where "is pointer" notion might be
lost during the transforms. When all of them are fixed, we can return it.
Differential Revision: https://reviews.llvm.org/D84294
Reviewed By: lebedev.ri
Petar Avramovic [Wed, 22 Jul 2020 08:31:41 +0000 (10:31 +0200)]
AMDGPU: Simplify f16 to i64 custom lowering
Range that f16 can represent fits into i32.
Lower as f16->i32->i64 instead of f16->f32->i64
since f32->i64 has long expansion.
Differential Revision: https://reviews.llvm.org/D84166
David Spickett [Thu, 16 Jul 2020 14:29:28 +0000 (15:29 +0100)]
[ARM] Fix Asm/Disasm of TBB/TBH instructions
Summary:
This fixes Bugzilla #46616 in which it was reported
that "tbb [pc, r0]" was marked as SoftFail
(aka unpredictable) incorrectly.
Expected behaviour is:
* ARMv8 is required to use sp as rn or rm
(tbb/tbh only have a Thumb encoding so using Arm mode
is not an option)
* If rm is the pc then the instruction is always
unpredictable
Some of this was implemented already and this fixes the
rest. Added tests cover the new and pre-existing handling.
Reviewers: ostannard
Reviewed By: ostannard
Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D84227
Luboš Luňák [Sat, 11 Jul 2020 12:53:50 +0000 (14:53 +0200)]
add -fpch-codegen/debuginfo mapping to -fmodules-codegen/debuginfo
Using -fmodules-* options for PCHs is a bit confusing, so add -fpch-*
variants. Having extra options also makes it simple to do a configure
check for the feature.
Also document the options in the release notes.
Differential Revision: https://reviews.llvm.org/D83623
Luboš Luňák [Mon, 13 Jul 2020 20:24:44 +0000 (22:24 +0200)]
accept 'clang++ -c a.pch -o a.o' to create PCH's object file
This way should be the same like with a.pcm for modules.
An alternative way is 'clang++ -c empty.cpp -include-pch a.pch -o a.o
-Xclang -building-pch-with-obj', which is what clang-cl's /Yc does
internally.
Differential Revision: https://reviews.llvm.org/D83716
Haojian Wu [Wed, 22 Jul 2020 08:03:51 +0000 (10:03 +0200)]
[AST][RecoveryExpr] Error-dependent expression should not be treat as a nullptr pointer constant.
If an expression is contains-error and its type is unknown (dependent), we
don't treat it as a null pointer constant.
Fix a recovery-ast crash on C.
Differential Revision: https://reviews.llvm.org/D84222
Haojian Wu [Wed, 22 Jul 2020 07:37:51 +0000 (09:37 +0200)]
Fix the clang-tidy build after get/isIntegerConstantExpression
refactoring.
Raphael Isemann [Tue, 21 Jul 2020 16:44:16 +0000 (18:44 +0200)]
Reland [lldb] Unify type name matching in FormattersContainer
This was originally reverted because the Linux bots were red after this landed,
but it seems that was actually caused by a different commit. I double checked
that this works on Linux, so let's reland this on Linux.
Summary:
FormattersContainer stores LLDB's formatters. It's implemented as a templated
map-like data structures that supports any kind of value type and only allows
ConstString and RegularExpression as the key types. The keys are used for
matching type names (e.g., the ConstString key `std::vector` matches the type
with the same name while RegularExpression keys match any type where the
RegularExpression instance matches).
The fact that a single FormattersContainer can only match either by string
comparison or regex matching (depending on the KeyType) causes us to always have
two FormatterContainer instances in all the formatting code. This also leads to
us having every type name matching logic in LLDB twice. For example,
TypeCategory has to implement every method twice (one string matching one, one
regex matching one).
This patch changes FormattersContainer to instead have a single `TypeMatcher`
key that wraps the logic for string-based and regex-based type matching and is
now the only possible KeyType for the FormattersContainer. This means that a
single FormattersContainer can now match types with both regex and string
comparison.
To summarize the changes in this patch:
* Remove all the `*_Impl` methods from `FormattersContainer`
* Instead call the FormatMap functions from `FormattersContainer` with a
`TypeMatcher` type that does the respective matching.
* Replace `ConstString` with `TypeMatcher` in the few places that directly
interact with `FormattersContainer`.
I'm working on some follow up patches that I split up because they deserve their
own review:
* Unify FormatMap and FormattersContainer (they are nearly identical now).
* Delete the duplicated half of all the type matching code that can now use one
interface.
* Propagate TypeMatcher through all the formatter code interfaces instead of
always offering two functions for everything.
There is one ugly design part that I couldn't get rid of yet and that is that we
have to support getting back the string used to construct a `TypeMatcher` later
on. The reason for this is that LLDB only supports referencing existing type
matchers by just typing their respective input string again (without even
supplying if it's a regex or not).
Reviewers: davide, mib
Reviewed By: mib
Subscribers: mgorny, JDevlieghere
Differential Revision: https://reviews.llvm.org/D84151
Haruki Imai [Wed, 22 Jul 2020 07:03:44 +0000 (12:33 +0530)]
[MLIR] Set alignment in AllocOp of normalizeMemref()
AllocOp is updated in normalizeMemref(AllocOp allocOp), but, when the
AllocOp has `alignment` attribute, it was ignored and updated AllocOp
does not have `alignment` attribute. This patch fixes it.
Differential Revision: https://reviews.llvm.org/D83656
Roman Lebedev [Tue, 21 Jul 2020 12:36:31 +0000 (15:36 +0300)]
[NFC][Reduce] Group llvm-reduce options into a group, uncluttering --help
Max Kazantsev [Wed, 22 Jul 2020 06:14:50 +0000 (13:14 +0700)]
[SimplifyCFG] Do not create unneeded PR Phi in block with convergent calls
We do not thread blocks with convergent calls, but this check was missing
when we decide to insert PR Phis into it (which we only do for threading).
Differential Revision: https://reviews.llvm.org/D83936
Reviewed By: nikic
Kai Luo [Wed, 22 Jul 2020 04:16:20 +0000 (04:16 +0000)]
[PowerPC] Fix wrong codegen when stack pointer has to realign performing dynalloc
Current powerpc backend generates wrong code sequence if stack pointer
has to realign if `-fstack-clash-protection` enabled. When probing
dynamic stack allocation, current `PREPARE_PROBED_ALLOCA` takes
`NegSizeReg` as input and returns
`FinalStackPtr`. `FinalStackPtr=StackPtr+ActualNegSize` is calculated
correctly, however code following `PREPARE_PROBED_ALLOCA` still uses
value of `NegSizeReg`, which does not contain `ActualNegSize` if
`MaxAlign > TargetAlign`, to calculate loop trip count and residual
number of bytes.
This patch is part of fix of
https://bugs.llvm.org/show_bug.cgi?id=46759.
Differential Revision: https://reviews.llvm.org/D84152
Kai Luo [Wed, 22 Jul 2020 04:13:18 +0000 (04:13 +0000)]
[PowerPC] Fix wrong codegen when stack pointer has to realign in prologue
Current powerpc backend generates wrong code sequence if stack pointer
has to realign if -fstack-clash-protection enabled. When probing in
prologue, backend should generate a subtraction instruction rather
than a `stux` instruction to realign the stack pointer.
This patch is part of fix of
https://bugs.llvm.org/show_bug.cgi?id=46759.
Differential Revision: https://reviews.llvm.org/D84218
Jonas Devlieghere [Wed, 22 Jul 2020 06:04:20 +0000 (23:04 -0700)]
[lldb] Adjust for getIntegerConstantExpression refactor
Kang Zhang [Wed, 22 Jul 2020 05:51:03 +0000 (05:51 +0000)]
[PowerPC] Fix the implicit operands in PredicateInstruction()
Summary:
In the function `PPCInstrInfo::PredicateInstruction()`, we will replace
non-Predicate Instructions to Predicate Instruction. But we forget add
the new implicit operands the new Predicate Instruction needed. This
patch is to fix this.
Reviewed By: jsji, efriedma
Differential Revision: https://reviews.llvm.org/D82390
Pushpinder Singh [Wed, 22 Jul 2020 05:06:50 +0000 (01:06 -0400)]
[OpenMP] Add missing RUN lines for OpenMP 4.5
Summary: This was missed when default version was upgraded to 5.0 (part of D81098)
Reviewers: saiislam, ABataev, jdoerfert
Reviewed By: saiislam
Subscribers: yaxunl, guansong, sstefan1, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84221
David Blaikie [Wed, 22 Jul 2020 04:51:59 +0000 (21:51 -0700)]
Follow-on fixes for get/isIntegerConstantExpression
Xing GUO [Wed, 22 Jul 2020 04:14:16 +0000 (12:14 +0800)]
[DWARFYAML] Make the length field of compilation units optional. NFC.
This patch makes the length field of compilation units optional (0 by
default).
David Blaikie [Mon, 13 Jul 2020 03:31:08 +0000 (20:31 -0700)]
Reapply "Rename/refactor isIntegerConstantExpression to getIntegerConstantExpression"
Reapply
49e5f603d40083dce9c05796e3cde3a185c3beba
which had been reverted in
c94332919bd922032e979b3ae3ced5ca5bdf9650.
Originally reverted because I hadn't updated it in quite a while when I
got around to committing it, so there were a bunch of missing changes to
new code since I'd written the patch.
Reviewers: aaron.ballman
Differential Revision: https://reviews.llvm.org/D76646
Xing GUO [Wed, 22 Jul 2020 02:16:52 +0000 (10:16 +0800)]
[DWARFYAML] Use yaml::Hex64 rather than uint64_t as length. NFC.
It's better to use yaml::Hex64 as length in the compilation unit.
Zequan Wu [Wed, 22 Jul 2020 02:15:58 +0000 (19:15 -0700)]
[Coverage] fix failed test case.
peter klausler [Wed, 22 Jul 2020 00:10:14 +0000 (17:10 -0700)]
[flang] Replay a FORMAT at the right position
When FORMAT control reaches the final parenthesis and data items
remain, we advance a record and revert to the beginning of the
FORMAT for further items. But when the FORMAT contains any
nested parenthesized group of editing descriptors, possibly
repeated, reversion must be to the beginning of the last such
top-level parenthesized group, including its repetition count.
Reviewed By: sscalpone, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D84281
peter klausler [Wed, 22 Jul 2020 00:57:06 +0000 (17:57 -0700)]
[flang] Fix source line continuation in potential macro calls (bugzilla 46768)
The prescanner looks for implicit continuation lines when
there are unclosed parentheses at the end of a line, so that
source preprocessing macro references with arguments that span
lines are recognized. The condition that determines this
implicit continuation has been put into a predicate member
function and corrected to apply only when the following line
is source (not a preprocessing directive, comment, &c.).
Fixes bugzilla #46768.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84280
peter klausler [Wed, 22 Jul 2020 00:37:35 +0000 (17:37 -0700)]
[flang] Implement byte-swapped external unformatted I/O in runtime
Add SetConvert() to the OPEN statement's runtime API.
Add ByteswapOption() to the main program's runtime API.
Check a $FORT_CONVERT environment variable, too, for
a swapping specifier.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84284
peter klausler [Wed, 22 Jul 2020 00:21:08 +0000 (17:21 -0700)]
[flang] Handle leading zeroes after decimal in REAL formatted input
Leading zero digits after the decimal mark were being dropped.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84282
Zequan Wu [Wed, 22 Jul 2020 01:01:19 +0000 (18:01 -0700)]
[Coverage] Fix coverage test cases.
peter klausler [Wed, 22 Jul 2020 00:25:46 +0000 (17:25 -0700)]
[flang] Check for misplaced labels
In fixed form source, complain when a label digit appears
outside the label field & when a non-digit appears in the label
field.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84283
Chen Zheng [Wed, 22 Jul 2020 00:40:32 +0000 (20:40 -0400)]
[PowerPC] add store (load float*) pattern to isProfitableToHoist
store (load float*) can be optimized to store(load i32*) in InstCombine pass.
Add store (load float*) to isProfitableToHoist to make sure we don't break
the opt in InstCombine pass.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D82341
Brian Cain [Wed, 22 Jul 2020 00:47:38 +0000 (19:47 -0500)]
[test-release] fallback to py3's venv module
If virtualenv is not available, we can look for py3's venv instead. We only
use this particular env for installing and running the test suite.
Logan Smith [Wed, 22 Jul 2020 00:48:36 +0000 (17:48 -0700)]
Disable -Wsuggest-override for all remaining unittests/ directories
Logan Smith [Wed, 22 Jul 2020 00:40:26 +0000 (17:40 -0700)]
[lld] Disable -Wsuggest-override for unittests
Zequan Wu [Mon, 20 Jul 2020 19:57:03 +0000 (12:57 -0700)]
[Coverage] Add comment to skipped regions
Bug filled here: https://bugs.llvm.org/show_bug.cgi?id=45757.
Add comment to skipped regions so we don't track execution count for lines containing only comments.
Differential Revision: https://reviews.llvm.org/D84208
Juneyoung Lee [Wed, 22 Jul 2020 00:30:42 +0000 (09:30 +0900)]
[ValueTracking] Fix incorrect handling of canCreateUndefOrPoison
.. in isGuaranteedNotToBeUndefOrPoison.
This caused early exit of isGuaranteedNotToBeUndefOrPoison, making it return
imprecise result.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84251
Wang, Pengfei [Tue, 21 Jul 2020 09:06:11 +0000 (17:06 +0800)]
[CFE] Add nomerge function attribute to inline assembly.
Sometimes we also want to avoid merging inline assembly. This patch add
the nomerge function attribute to inline assembly.
Reviewed By: zequanwu
Differential Revision: https://reviews.llvm.org/D84225
Amy Huang [Tue, 21 Jul 2020 23:54:52 +0000 (16:54 -0700)]
[PDB][NativeSession] Clean up some things in NativeSession.
-Use the actual sect/offset to keep track of symbols in the cache so they don't get created multiple times with different addresses.
-Remove getSymTag from PDBFunctionSymbol/PDBPublicSymbol because it's already implemented in the base class
-Merge the symbolizer test files for DIA and native, since the tests are the same.
-Implement getCompilandId for NativeLineNumber
Reviewed By: amccarth
Differential Revision: https://reviews.llvm.org/D84208
Logan Smith [Tue, 21 Jul 2020 23:38:35 +0000 (16:38 -0700)]
[clang] Disable -Wsuggest-override for unittests/
Adrian Prantl [Tue, 21 Jul 2020 23:03:56 +0000 (16:03 -0700)]
[NFC] Clean up doc comment and implementation for Module::isSubModuleOf.
Patch by Varun Gandhi!
Differential Revision: https://reviews.llvm.org/D84087
Matt Arsenault [Sun, 28 Jun 2020 14:06:26 +0000 (10:06 -0400)]
GlobalISel: Use Register and update comment physical register syntax
Amy Kwan [Tue, 21 Jul 2020 21:26:47 +0000 (16:26 -0500)]
[PowerPC][Power10] Add Vector Multiply/Mod/Divide Instruction Definitions and MC Tests
This patch adds the td definitions and asm/disasm tests for the following instructions:
- Vector Multiply Low Doubleword: vmulld
- Vector Modulus Word/Doubleword: vmodsw, vmoduw, vmodsd, vmodud
- Vector Divide Word/Doubleword: vdivsw, vdivuw, vdivsd, vdivud
- Vector Multiply High Word/Doubleword: vmulhsw, vmulhsd, vmulhuw, vmulhud
- Vector Divide Extended Word/Doubleword: vdivesw, vdiveuw, vdivesd, vdiveud
Differential Revision: https://reviews.llvm.org/D82929
Amara Emerson [Tue, 21 Jul 2020 22:15:39 +0000 (15:15 -0700)]
Revert "[AArch64][GlobalISel] Add post-legalize combine for sext_inreg(trunc(sextload)) -> copy"
This reverts commit
64eb3a4915f00cca9af4c305a9ff36209003cd7b.
It caused miscompiles with optimizations enabled. Reverting while I investigate.
Amara Emerson [Wed, 15 Jul 2020 00:15:27 +0000 (17:15 -0700)]
[AArch64][GlobalISel] Fix TLS accesses clobbering registers incorrectly.
This was happening because the BLR didn't have a use of the X0 arg register,
which would end up being re-used in high reg pressure situations.
The change also avoids hard coding the use of X0 for the sequence except to
copy the value for the call. ld64 should still be able to optimize it.
rdar://
65438258
Matt Arsenault [Tue, 21 Jul 2020 16:28:52 +0000 (12:28 -0400)]
AMDGPU/GlobalISel: Add some baseline degenerate call argument tests
Matt Arsenault [Tue, 21 Jul 2020 22:24:03 +0000 (18:24 -0400)]
AMDGPU/GlobalISel: Fix not erasing inst when lowering G_FRINT
Matt Arsenault [Fri, 17 Jul 2020 15:01:15 +0000 (11:01 -0400)]
GlobalISel: Legalize G_FPOWI
Matt Arsenault [Fri, 17 Jul 2020 14:26:23 +0000 (10:26 -0400)]
GlobalISel: Translate llvm.powi intrinsic
There are a few questionable things about this intrinsic and existing
DAG implementation. For some reason the intrinsic hardcodes the second
operand to be scalar-only i32, and SelectionDAG builder makes a
legalization decision based on whether the operand is constant.
Matt Arsenault [Thu, 7 May 2020 14:47:25 +0000 (10:47 -0400)]
AMDGPU: Start interpreting byref on kernel arguments
These are treated identically to value aggregates placed in the kernel
argument list. A %struct.foo or %struct.foo addrspace(4)*
byref(sizeof(%struct.foo)) align(alignof(%struct.foo)) argument should
produce the same offsets and argument metadata.
This handles all 3 kernel ABI implementations, and the two HSA
metadata emission paths.
Chris Morin [Tue, 21 Jul 2020 21:57:49 +0000 (14:57 -0700)]
[mlir][docs] Fix Markdown format in Language Reference
Differential Revision: https://reviews.llvm.org/D84271
Yaxun (Sam) Liu [Tue, 21 Jul 2020 20:54:41 +0000 (16:54 -0400)]
Fix pow and ldexp in HIP header