OSDN Git Service

android-x86/external-llvm-project.git
4 years ago[DebugInfo] Explicitly permit addr_size = 0x02 when parsing DWARF data
Anatoly Trosinenko [Mon, 22 Jun 2020 10:08:20 +0000 (13:08 +0300)]
[DebugInfo] Explicitly permit addr_size = 0x02 when parsing DWARF data

Current LLVM implementation uses `MCAsmInfo::CodePointerSize` as addr_size when emitting the DWARF data. llvm-dwarfdump, on the other hand, handles `addr_size`s of 4 and 8 properly and considers all other sizes as an error. This works for most of mainline targets except for MSP430 and AVR.

msp430-gcc v8.3.1 emits DWARF32 with addr_size = 4 (DWARF32 does not imply addr_size = 4, 32 refers to internal offset width of 4 bytes) that is handled by llvm-dwarfdump already. Still, emitting 2-byte target pointers on MSP430 seems correct as well (but not for MSP430X that is supported by msp430-gcc but not by LLVM and has 20-bit address space).

This patch make it possible for MSP430 debug info support to be tested with llvm-dwarfdump.

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

4 years ago[clang-tidy] Improved accuracy of check list updater script
Nathan James [Mon, 22 Jun 2020 10:07:21 +0000 (11:07 +0100)]
[clang-tidy] Improved accuracy of check list updater script

 - Added `FixItHint` comments to Check files for the script to mark those checks as offering fix-its when the fix-its are generated in another file.
 - Case insensitive file searching when looking for the file a checker code resides in.

Also regenerated the list, sphinx had no issue generating the docs after this.

Reviewed By: sylvestre.ledru

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

4 years ago[DSE,MSSA] Remove unused arguments for isDSEBarrier (NFC).
Florian Hahn [Mon, 22 Jun 2020 09:57:44 +0000 (10:57 +0100)]
[DSE,MSSA] Remove unused arguments for isDSEBarrier (NFC).

4 years agoFixed ASTMatchers registry and regen ast docs
Nathan James [Mon, 22 Jun 2020 09:56:04 +0000 (10:56 +0100)]
Fixed ASTMatchers registry and regen ast docs

4 years ago[mlir] make the bitwidth of device side index computations configurable
Tobias Gysi [Mon, 22 Jun 2020 09:37:01 +0000 (11:37 +0200)]
[mlir] make the bitwidth of device side index computations configurable

The patch makes the index type lowering of the GPU to NVVM/ROCDL
conversion configurable. It introduces a pass option that controls the
bitwidth used when lowering index computations.

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

4 years ago[Analyzer][StreamChecker] Add note tags for file opening.
Balázs Kéri [Mon, 22 Jun 2020 07:04:05 +0000 (09:04 +0200)]
[Analyzer][StreamChecker] Add note tags for file opening.

Summary:
Bug reports of resource leak are now improved.
If there are multiple resource leak paths for the same stream,
only one wil be reported.

Reviewers: Szelethus, xazax.hun, baloghadamsoftware, NoQ

Reviewed By: Szelethus, NoQ

Subscribers: NoQ, 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/D81407

4 years ago[CSInfo][MIPS] Don't describe parameters loaded by sub/super reg copy
Djordje Todorovic [Mon, 22 Jun 2020 07:01:59 +0000 (09:01 +0200)]
[CSInfo][MIPS] Don't describe parameters loaded by sub/super reg copy

When describing parameter value loaded by a COPY instruction, consider
case where needed Reg value is a sub- or super- register of the COPY
instruction's destination register. Without this patch, compile process
will crash with the assertion "TargetInstrInfo::describeLoadedValue
can't describe super- or sub-regs for copy instructions".

Patch by Nikola Tesic

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

4 years ago[clang][Driver] Correct tool search path priority
David Spickett [Mon, 11 May 2020 16:13:00 +0000 (17:13 +0100)]
[clang][Driver] Correct tool search path priority

Summary:
As seen in:
https://bugs.llvm.org/show_bug.cgi?id=45693

When clang looks for a tool it has a set of
possible names for it, in priority order.
Previously it would look for these names in
the program path. Then look for all the names
in the PATH.

This means that aarch64-none-elf-gcc on the PATH
would lose to gcc in the program path.
(which was /usr/bin in the bug's case)

This changes that logic to search each name in both
possible locations, then move to the next name.
Which is more what you would expect to happen when
using a non default triple.

(-B prefixes maybe should follow this logic too,
but are not changed in this patch)

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

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

4 years ago[mlir] Add for loop specialization
Stephan Herhut [Fri, 19 Jun 2020 12:14:30 +0000 (14:14 +0200)]
[mlir] Add for loop specialization

Summary:
We already had a parallel loop specialization pass that is used to
enable unrolling and consecutive vectorization by rewriting loops
whose bound is defined as a min of a constant and a dynamic value
into a loop with static bound (the constant) and the minimum as
bound, wrapped into a conditional to dispatch between the two.
This adds the same rewriting for for loops.

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

4 years agoReturn false if the identifier is not in the global module index.
Vassil Vassilev [Fri, 19 Jun 2020 07:01:02 +0000 (07:01 +0000)]
Return false if the identifier is not in the global module index.

This allows clients to use the idiom:

if (GlobalIndex->lookupIdentifier(Name, FoundModules)) {
  // work on the FoundModules
}

This is also a minor performance improvent for clang.

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

4 years ago[Peeling] Extend the scope of peeling a bit
Serguei Katkov [Wed, 3 Jun 2020 10:56:08 +0000 (17:56 +0700)]
[Peeling] Extend the scope of peeling a bit

Currently we allow peeling of the loops if there is a exiting latch block
and all other exits are blocks ending with deopt.

Actually we want that exit would end up with deopt unconditionally but
it is not required that exit itself ends with deopt.

Reviewers: reames, ashlykov, fhahn, apilipenko, fedor.sergeev
Reviewed By: apilipenko
Subscribers: hiraditya, zzheng, dantrushin, llvm-commits
Differential Revision: https://reviews.llvm.org/D81140

4 years ago[flang]Fix individual tests with lit when building out of tree
sameeran joshi [Mon, 22 Jun 2020 04:54:28 +0000 (10:24 +0530)]
[flang]Fix individual tests with lit when building out of tree

Summary:

Fix individual check tests with lit when building out-of-tree
`ninja check-flang-<folder>` was not working.
The CMakeLists.txt was looking for the lit tests in the source directory
instead of the build directory.

This commit extends @CarolineConcatto previous patch[D81002]

Reviewers: DavidTruby, sscalpone, tskeith, CarolineConcatto, jdoerfert

Reviewed By: DavidTruby

Subscribers: flang-commits, llvm-commits, CarolineConcatto

Tags: #flang, #llvm

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

4 years ago[X86] Add an AVX check prefix to bitcast-vector-bool.ll to combine checks where AVX1...
Craig Topper [Mon, 22 Jun 2020 03:30:13 +0000 (20:30 -0700)]
[X86] Add an AVX check prefix to bitcast-vector-bool.ll to combine checks where AVX1/2/512 are all the same. NFC

4 years ago[X86] Add test file that was supposed to go with D81327.
Craig Topper [Mon, 22 Jun 2020 00:46:33 +0000 (17:46 -0700)]
[X86] Add test file that was supposed to go with D81327.

Must have forgotten to git add the file.

4 years ago[amdgpu] Fix REL32 relocations with negative offsets.
Michael Liao [Fri, 19 Jun 2020 04:09:20 +0000 (00:09 -0400)]
[amdgpu] Fix REL32 relocations with negative offsets.

Summary: - The offset should be treated as a signed one.

Reviewers: rampitec, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[lld-macho] Refactor segment/section creation, sorting, and merging
Jez Ng [Mon, 15 Jun 2020 07:03:24 +0000 (00:03 -0700)]
[lld-macho] Refactor segment/section creation, sorting, and merging

Summary:
There were a few issues with the previous setup:

1. The section sorting comparator used a declarative map of section names to
  determine the correct order, but it turns out we need to match on more than
  just names -- in particular, an upcoming diff will sort based on whether the
  S_ZERO_FILL flag is set. This diff changes the sorter to a more imperative but
  flexible form.

2. We were sorting OutputSections stored in a MapVector, which left the
  MapVector in an inconsistent state -- the wrong keys map to the wrong values!
  In practice, we weren't doing key lookups (only container iteration) after the
  sort, so this was fine, but it was still a dubious state of affairs. This diff
  copies the OutputSections to a vector before sorting them.

3. We were adding unneeded OutputSections to OutputSegments and then filtering
  them out later, which meant that we had to remember whether an OutputSegment
  was in a pre- or post-filtered state. This diff only adds the sections to the
  segments if they are needed.

In addition to those major changes, two minor ones worth noting:

1. I renamed all OutputSection variable names to `osec`, to parallel `isec`.
  Previously we were using some inconsistent combination of `osec`, `os`, and
  `section`.

2. I added a check (and a test) for InputSections with names that clashed with
  those of our synthetic OutputSections.

Reviewers: #lld-macho

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[X86] Add cooperlake and tigerlake to the enum in cpu_model.c
Craig Topper [Sun, 21 Jun 2020 23:20:24 +0000 (16:20 -0700)]
[X86] Add cooperlake and tigerlake to the enum in cpu_model.c

I forgot to do this when I added then to _cpu_indicator_init.

4 years ago[X86] Assign a feature priority to 'tigerlake' so it won't assert when used with...
Craig Topper [Sun, 21 Jun 2020 20:24:43 +0000 (13:24 -0700)]
[X86] Assign a feature priority to 'tigerlake' so it won't assert when used with function multiversioning

Also test cooperlake since it was also just added to function
multiversioning when it was enabled for __builtin_cpu_is.

4 years ago[VectorCombine] create class for pass to hold analyses, etc; NFC
Sanjay Patel [Sun, 21 Jun 2020 19:57:07 +0000 (15:57 -0400)]
[VectorCombine] create class for pass to hold analyses, etc; NFC

This doesn't change anything currently, but it would make sense
to create a class-level IRBuilder instead of recreating that
everywhere. As we expand to more optimizations, we will probably
also want to hold things like the DataLayout or other constant
refs in here too.

4 years ago[X86] Add 'cooperlake' and 'tigerlake' to __builtin_cpu_is.
Craig Topper [Sun, 21 Jun 2020 18:30:00 +0000 (11:30 -0700)]
[X86] Add 'cooperlake' and 'tigerlake' to __builtin_cpu_is.

Cooperlake can be detect by compiler-rt now, but not libgcc yet.
Tigerlake can't be detected by either. Both names are accepted by
gcc. Hopefully the detection code will be in place soon.

4 years ago[X86] Add cooperlake detection to _cpu_indicator_init.
Craig Topper [Sun, 21 Jun 2020 07:03:44 +0000 (00:03 -0700)]
[X86] Add cooperlake detection to _cpu_indicator_init.

libgcc has this enum encoding defined for a while, but their
detection code is missing. I've raised a bug with them so that
should get fixed soon.

4 years ago[clang-tidy] Implement storeOptions for checks missing it.
Nathan James [Sun, 21 Jun 2020 18:01:09 +0000 (19:01 +0100)]
[clang-tidy] Implement storeOptions for checks missing it.

Just adds the storeOptions for Checks that weren't already storing their options.

Reviewed By: aaron.ballman

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

4 years agofix clang/PCH/delayed-pch-instantiate test
Luboš Luňák [Sun, 21 Jun 2020 16:59:51 +0000 (18:59 +0200)]
fix clang/PCH/delayed-pch-instantiate test

-target must match between PCH creation and use.

4 years ago[CGP] Enable CodeGenPrepares phi type convertion.
David Green [Sun, 21 Jun 2020 11:56:30 +0000 (12:56 +0100)]
[CGP] Enable CodeGenPrepares phi type convertion.

4 years ago[DSE,MSSA] Move reachability check to main loop.
Florian Hahn [Sun, 21 Jun 2020 15:34:54 +0000 (16:34 +0100)]
[DSE,MSSA] Move reachability check to main loop.

As we traverse the CFG backwards, we could end up reaching unreachable
blocks. For unreachable blocks, we won't have computed post order
numbers and because DomAccess is reachable, unreachable blocks cannot be
on any path from it.

This fixes a crash with unreachable blocks.

4 years agoadd option to instantiate templates already in the PCH
Luboš Luňák [Sun, 19 Apr 2020 15:49:47 +0000 (17:49 +0200)]
add option to instantiate templates already in the PCH

Add -fpch-instantiate-templates which makes template instantiations be
performed already in the PCH instead of it being done in every single
file that uses the PCH (but every single file will still do it as well
in order to handle its own instantiations). I can see 20-30% build
time saved with the few tests I've tried.

The change may reorder compiler output and also generated code, but
should be generally safe and produce functionally identical code.
There are some rare cases that do not compile with it,
such as test/PCH/pch-instantiate-templates-forward-decl.cpp. If
template instantiation bailed out instead of reporting the error,
these instantiations could even be postponed, which would make them
work.

Enable this by default for clang-cl. MSVC creates PCHs by compiling
them using an empty .cpp file, which means templates are instantiated
while building the PCH and so the .h needs to be self-contained,
making test/PCH/pch-instantiate-templates-forward-decl.cpp to fail
with MSVC anyway. So the option being enabled for clang-cl matches this.

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

4 years ago[CGP] Convert phi types
David Green [Sun, 21 Jun 2020 10:28:31 +0000 (11:28 +0100)]
[CGP] Convert phi types

If a collection of interconnected phi nodes is only ever loaded, stored
or bitcast then we can convert the whole set to the bitcast type,
potentially helping to reduce the number of register moves needed as the
phi's are passed across basic block boundaries. This has to be done in
CodegenPrepare as it naturally straddles basic blocks.

The alorithm just looks from phi nodes, looking at uses and operands for
a collection of nodes that all together are bitcast between float and
integer types. We record visited phi nodes to not have to process them
more than once. The whole subgraph is then replaced with a new type.
Loads and Stores are bitcast to the correct type, which should then be
folded into the load/store, changing it's type.

This comes up in the biquad testcase due to the way MVE needs to keep
values in integer registers. I have also seen it come up from aarch64
partner example code, where a complicated set of sroa/inlining produced
integer phis, where float would have been a better choice.

I also added undef and extract element handling which increased the
potency in some cases.

This adds it with an option that defaults to off, and disabled for 32bit
X86 due to potential issues around canonicalizing NaNs.

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

4 years ago[CGP][AArch64] Convert Phi type tests. NFC
David Green [Sun, 21 Jun 2020 10:07:07 +0000 (11:07 +0100)]
[CGP][AArch64] Convert Phi type tests. NFC

4 years ago[ValueTracking, BasicAA] Don't simplify instructions
Nikita Popov [Sat, 20 Jun 2020 11:59:24 +0000 (13:59 +0200)]
[ValueTracking, BasicAA] Don't simplify instructions

GetUnderlyingObject() (and by required symmetry
DecomposeGEPExpression()) will call SimplifyInstruction() on the
passed value if other checks fail. This simplification is very
expensive, but has little effect in practice. This patch removes
the SimplifyInstruction call(), and replaces it with a check for
single-argument phis (which can occur in canonical IR in LCSSA
form), which is the only useful simplification case I was able to
identify.

At O3 the geomean CTMark improvement is -1.7%. The largest
improvement is SPASS with ThinLTO at -6%.

In test-suite, I see only two tests with a hash difference and
no code size difference (PAQ8p, Ptrdist), which indicates that
the simplification only ends up being useful very rarely. (I would
have liked to figure out which simplification is responsible here,
but wasn't able to spot it looking at transformation logs.)

The AMDGPU test case that is update was using two selects with
undef condition, in which case GetUnderlyingObject will return
the first select operand as the underlying object. This will of
course not happen with non-undef conditions, so this was not
testing anything realistic. Additionally this illustrates potential
unsoundness: While GetUnderlyingObject will pick the first operand,
the select might be later replaced by the second operand, resulting
in inconsistent assumptions about the undef value.

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

4 years agoRevert "Add --hot-func-list to llvm-profdata show for sample profiles"
Bruno Ricci [Sun, 21 Jun 2020 13:30:39 +0000 (14:30 +0100)]
Revert "Add --hot-func-list to llvm-profdata show for sample profiles"

This reverts commit 7348b951fe74f306970f6ac567fe5dddbb1c42d4.
It is causing Asan failures.

4 years ago[ValueTracking] improve analysis for fdiv with same operands
Sanjay Patel [Sun, 21 Jun 2020 12:50:29 +0000 (08:50 -0400)]
[ValueTracking] improve analysis for fdiv with same operands

(The 'nnan' variant of this pattern is already tested to produce '1.0'.)

https://alive2.llvm.org/ce/z/D4hPBy

define i1 @src(float %x, i32 %y) {
%0:
  %d = fdiv float %x, %x
  %uge = fcmp uge float %d, 0.000000
  ret i1 %uge
}
=>
define i1 @tgt(float %x, i32 %y) {
%0:
  ret i1 1
}
Transformation seems to be correct!

4 years ago[InstSimplify] add test for fdiv signbit; NFC
Sanjay Patel [Sun, 21 Jun 2020 12:18:24 +0000 (08:18 -0400)]
[InstSimplify] add test for fdiv signbit; NFC

4 years ago[clang][test][NFC] Also test for serialization in AST dump tests, part 3/n.
Bruno Ricci [Sun, 21 Jun 2020 12:49:27 +0000 (13:49 +0100)]
[clang][test][NFC] Also test for serialization in AST dump tests, part 3/n.

The outputs between the direct ast-dump test and the ast-dump test after
deserialization should match modulo a few differences.

For hand-written tests, strip the "<undeserialized declarations>"s and
the "imported"s with sed.

For tests generated with "make-ast-dump-check.sh", regenerate the output.

Part 3/n.

4 years ago[clang][test][NFC] Also test for serialization in AST dump tests, part 2/n.
Bruno Ricci [Sun, 21 Jun 2020 12:35:15 +0000 (13:35 +0100)]
[clang][test][NFC] Also test for serialization in AST dump tests, part 2/n.

The outputs between the direct ast-dump test and the ast-dump test after
deserialization should match modulo a few differences.

For hand-written tests, strip the "<undeserialized declarations>"s and
the "imported"s with sed.

For tests generated with "make-ast-dump-check.sh", regenerate the
output.

Part 2/n.

4 years ago[clang][NFC] Regenerate test/AST/ast-dump-lambda.cpp with --match-full-lines.
Bruno Ricci [Sun, 21 Jun 2020 12:32:10 +0000 (13:32 +0100)]
[clang][NFC] Regenerate test/AST/ast-dump-lambda.cpp with --match-full-lines.

4 years ago[clang][utils] Minor tweak to make-ast-dump-check.sh
Bruno Ricci [Sun, 21 Jun 2020 12:29:06 +0000 (13:29 +0100)]
[clang][utils] Minor tweak to make-ast-dump-check.sh

Remove the space after the "CHECK:" on each line. This space makes the use
of FileCheck --match-full-lines impossible.

4 years ago[clang][Serialization] Fix the serialization of ConstantExpr.
Bruno Ricci [Sun, 21 Jun 2020 12:02:48 +0000 (13:02 +0100)]
[clang][Serialization] Fix the serialization of ConstantExpr.

The serialization of ConstantExpr has currently a number of problems:

- Some fields are just not serialized (ConstantExprBits.APValueKind and
  ConstantExprBits.IsImmediateInvocation).

- ASTStmtReader::VisitConstantExpr forgets to add the trailing APValue
  to the list of objects to be destroyed when the APValue needs cleanup.

While we are at it, bring the serialization of ConstantExpr more in-line
with what is done with the other expressions by doing the following NFCs:

- Get rid of ConstantExpr::DefaultInit. It is better to not initialize
  the fields of an empty ConstantExpr since this will allow msan to
  detect if a field was not deserialized.

- Move the initialization of the fields of ConstantExpr to the constructor;
  ConstantExpr::Create allocates the memory and ConstantExpr::ConstantExpr
  is responsible for the initialization.

Review after commit since this is a straightforward mechanical fix
similar to the other serialization fixes.

4 years ago[clang][NFC] Fix typos/wording in the comments of ConstantExpr.
Bruno Ricci [Sun, 21 Jun 2020 11:47:18 +0000 (12:47 +0100)]
[clang][NFC] Fix typos/wording in the comments of ConstantExpr.

It is "trailing objects" and "tail-allocated storage".

4 years ago[LangRef] Fix sphinx warnings
Nikita Popov [Sun, 21 Jun 2020 11:51:07 +0000 (13:51 +0200)]
[LangRef] Fix sphinx warnings

4 years ago[Docs] Fix code block in MemorySSA docs (NFC)
Nikita Popov [Sun, 21 Jun 2020 11:45:43 +0000 (13:45 +0200)]
[Docs] Fix code block in MemorySSA docs (NFC)

4 years ago[X86][SSE] Add SimplifyDemandedVectorEltsForTargetShuffle to handle target shuffle...
Simon Pilgrim [Sun, 21 Jun 2020 10:16:07 +0000 (11:16 +0100)]
[X86][SSE] Add SimplifyDemandedVectorEltsForTargetShuffle to handle target shuffle variable masks

Pulled out from the ongoing work on D66004, currently we don't do a good job of simplifying variable shuffle masks that have already lowered to constant pool entries.

This patch adds SimplifyDemandedVectorEltsForTargetShuffle (a custom x86 helper) to first try SimplifyDemandedVectorElts (which we already do) and then constant pool simplification to help mark undefined elements.

To prevent lowering/combines infinite loops, we only handle basic constant pool loads instead of creating new BUILD_VECTOR nodes for lowering - e.g. we don't try to convert them to broadcast/vzext_load - there might be some benefit to this but if so I'd rather we come up with some way to reuse existing code than reimplement a lot of BUILD_VECTOR code.

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

4 years ago[Attributor][NFC] Fix indentation
clfbbn [Sun, 21 Jun 2020 06:18:47 +0000 (14:18 +0800)]
[Attributor][NFC] Fix indentation

Summary: The patch D81022 seems to break the indentation of the `cleanupIR()` function. This patch fixes this problem

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: jdoerfert

Subscribers: hiraditya, uenoku, kuter, llvm-commits

Tags: #llvm

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

4 years ago[Remarks] Add callsite locations to inline remarks
Wenlei He [Fri, 19 Jun 2020 17:25:31 +0000 (10:25 -0700)]
[Remarks] Add callsite locations to inline remarks

Summary:
Add call site location info into inline remarks so we can differentiate inline sites.
This can be useful for inliner tuning. We can also reconstruct full hierarchical inline
tree from parsing such remarks. The messege of inline remark is also tweaked so we can
differentiate SampleProfileLoader inline from CGSCC inline.

Reviewers: wmi, davidxl, hoy

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[lldb/Lua] Remove redundant variable (NFC)
Jonas Devlieghere [Sun, 21 Jun 2020 06:28:22 +0000 (23:28 -0700)]
[lldb/Lua] Remove redundant variable (NFC)

4 years ago[lldb] Remove unused <iostream> includes (NFC)
Jonas Devlieghere [Sun, 21 Jun 2020 05:38:26 +0000 (22:38 -0700)]
[lldb] Remove unused <iostream> includes (NFC)

4 years ago[PowerPC][Power10] Implement Vector Clear Left/Rightmost Bytes Builtins in LLVM/Clang
Amy Kwan [Sat, 20 Jun 2020 23:29:16 +0000 (18:29 -0500)]
[PowerPC][Power10] Implement Vector Clear Left/Rightmost Bytes Builtins in LLVM/Clang

This patch implements builtins for the following prototypes:
```
vector signed char vec_clrl (vector signed char a, unsigned int n);
vector unsigned char vec_clrl (vector unsigned char a, unsigned int n);
vector signed char vec_clrr (vector signed char a, unsigned int n);
vector signed char vec_clrr (vector unsigned char a, unsigned int n);
```

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

4 years ago[clang/llvm] As part of using inclusive language within
Eric Christopher [Sat, 20 Jun 2020 23:02:27 +0000 (16:02 -0700)]
[clang/llvm] As part of using inclusive language within
the llvm project, migrate away from the use of blacklist and whitelist.

4 years ago[X86] Set the cpu_vendor in __cpu_indicator_init to VENDOR_OTHER if cpuid isn't suppo...
Craig Topper [Sat, 20 Jun 2020 22:36:04 +0000 (15:36 -0700)]
[X86] Set the cpu_vendor in __cpu_indicator_init to VENDOR_OTHER if cpuid isn't supported on the CPU.

We need to set the cpu_vendor to a non-zero value to indicate
that we already called __cpu_indicator_init once.

This should only happen on a 386 or 486 CPU.

4 years ago[clang-tidy] As part of using inclusive language within
Eric Christopher [Sat, 20 Jun 2020 22:20:11 +0000 (15:20 -0700)]
[clang-tidy] As part of using inclusive language within
the llvm project, migrate away from the use of blacklist and whitelist.

4 years agoUpdate comment to be more clear.
Eric Christopher [Sat, 20 Jun 2020 21:44:41 +0000 (14:44 -0700)]
Update comment to be more clear.

4 years agoRename function to more accurately reflect what it does.
Eric Christopher [Sat, 20 Jun 2020 21:37:29 +0000 (14:37 -0700)]
Rename function to more accurately reflect what it does.

4 years agoTemporarily Revert "[lldb][NFC] Add more test for builtin formats"
Eric Christopher [Sat, 20 Jun 2020 21:20:51 +0000 (14:20 -0700)]
Temporarily Revert "[lldb][NFC] Add more test for builtin formats"
as it's failing on the debian buildbots:

http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/12531

This reverts commit 90c1af106a20785ffd01c0d6a41db8bc0160fd11.

4 years ago[flang] Add BoxValue.h
Eric Schweitz [Fri, 19 Jun 2020 18:42:23 +0000 (11:42 -0700)]
[flang] Add BoxValue.h

The bridge uses internal boxes of related ssa-values to track all the
information associated with a Fortran variable. Variables may have a
location and a value, but may also carry other properties such as rank,
shape, LEN parameters, etc. in Fortran.

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

4 years agoTypos around a -> an.
Eric Christopher [Sat, 20 Jun 2020 21:04:48 +0000 (14:04 -0700)]
Typos around a -> an.

4 years ago[VectorCombine] fix assert for type of compare operand
Sanjay Patel [Sat, 20 Jun 2020 19:18:27 +0000 (15:18 -0400)]
[VectorCombine] fix assert for type of compare operand

As shown in the post-commit comment for D81661 - we need to
loosen the type assertion to allow scalarization of a compare
for vectors of pointers.

4 years ago[lldb][NFC] Add more test for builtin formats
Raphael Isemann [Sat, 20 Jun 2020 17:30:20 +0000 (19:30 +0200)]
[lldb][NFC] Add more test for builtin formats

The previous tests apparently missed a few code branches in DumpDataExtractor
code. Also renames the 'test_instruction' which had the same name as another
test (and Python therefore ignored the test entirely).

4 years agoAdd --hot-func-list to llvm-profdata show for sample profiles
weihe [Sat, 20 Jun 2020 17:13:02 +0000 (10:13 -0700)]
Add --hot-func-list to llvm-profdata show for sample profiles

Summary: Add the --hot-func-list feature to llvm-profdata show for sample profiles. This feature prints a list of hot functions whose max sample count are above the 99% threshold, with their numbers of total samples, total samples percentage, max samples, entry samples, and their function names.

Reviewers: wmi, hoyFB, wenlei

Reviewed By: wmi

Subscribers: hoyFB, wenlei, llvm-commits, weihe

Tags: #llvm

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

4 years ago[InstCombine] remove unused parameter and add assert; NFC
Sanjay Patel [Sat, 20 Jun 2020 15:47:00 +0000 (11:47 -0400)]
[InstCombine] remove unused parameter and add assert; NFC

4 years ago[InstCombine] add tests for fmul/fdiv with fabs operands; NFC
Sanjay Patel [Sat, 20 Jun 2020 15:07:23 +0000 (11:07 -0400)]
[InstCombine] add tests for fmul/fdiv with fabs operands; NFC

4 years agoProfileSummaryInfo.h - reduce unnecessary Function.h include to forward declaration...
Simon Pilgrim [Sat, 20 Jun 2020 14:57:05 +0000 (15:57 +0100)]
ProfileSummaryInfo.h - reduce unnecessary Function.h include to forward declaration. NFC.

4 years agoRegionPass.h - remove unnecessary Function.h include. NFC.
Simon Pilgrim [Sat, 20 Jun 2020 14:30:11 +0000 (15:30 +0100)]
RegionPass.h - remove unnecessary Function.h include. NFC.

Forward declaration is already used.

4 years ago[InstCombine] fabs(X) / fabs(X) -> X / X
Sanjay Patel [Sat, 20 Jun 2020 14:20:21 +0000 (10:20 -0400)]
[InstCombine] fabs(X) / fabs(X) -> X / X

Also, consolidate related folds so we don't miss/repeat these.

4 years ago[InstCombine] add tests for fabs(x) / fabs (x); NFC
Sanjay Patel [Sat, 20 Jun 2020 13:52:12 +0000 (09:52 -0400)]
[InstCombine] add tests for fabs(x) / fabs (x); NFC

4 years ago[X86] combineSetCCMOVMSK - consistently use CmpBits variable. NFCI.
Simon Pilgrim [Sat, 20 Jun 2020 11:35:24 +0000 (12:35 +0100)]
[X86] combineSetCCMOVMSK - consistently use CmpBits variable. NFCI.

The comparison value should be the same size - I've added an assert to be absolutely certain.

4 years ago[X86][SSE] Fold MOVMSK(PCMPEQ(X,0)) != -1 -> !PTESTZ(X,X) allof patterns
Simon Pilgrim [Fri, 19 Jun 2020 15:05:04 +0000 (16:05 +0100)]
[X86][SSE] Fold MOVMSK(PCMPEQ(X,0)) != -1 -> !PTESTZ(X,X) allof patterns

4 years ago[CVP] Add another non null test (NFC)
Nikita Popov [Sat, 20 Jun 2020 11:01:54 +0000 (13:01 +0200)]
[CVP] Add another non null test (NFC)

4 years ago[JumpThreading] Make test more robust (NFC)
Nikita Popov [Sat, 20 Jun 2020 10:52:53 +0000 (12:52 +0200)]
[JumpThreading] Make test more robust (NFC)

Optimizing away this comparison is not the point of this test,
so make sure it cannot be optimized away.

4 years ago[LVI] Extract addValueHandle() method (NFC)
Nikita Popov [Sat, 20 Jun 2020 10:49:08 +0000 (12:49 +0200)]
[LVI] Extract addValueHandle() method (NFC)

There will be more places registering value handles.

4 years ago[LVI] Use find_as() where possible (NFC)
Nikita Popov [Sat, 13 Jun 2020 13:15:39 +0000 (15:15 +0200)]
[LVI] Use find_as() where possible (NFC)

This prevents us from creating temporary PoisoningVHs and
AssertingVHs while performing hashmap lookups. As such, it only
matters in assertion-enabled builds.

4 years ago[clang] SequenceChecker: C++17 sequencing rule for overloaded operators.
Bruno Ricci [Sat, 20 Jun 2020 09:51:46 +0000 (10:51 +0100)]
[clang] SequenceChecker: C++17 sequencing rule for overloaded operators.

In C++17 the operand(s) of an overloaded operator are sequenced as for
the corresponding built-in operator when the overloaded operator is
called with the operator notation ([over.match.oper]p2).

Reported in PR35340.

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

Reviewed By: rsmith

4 years ago[lldb] Skip TestBuiltinFormats.py on arm for now
Raphael Isemann [Sat, 20 Jun 2020 09:22:44 +0000 (11:22 +0200)]
[lldb] Skip TestBuiltinFormats.py on arm for now

4 years agoRevert "[BasicAA] Use known lower bounds for index values for size based check."
Florian Hahn [Sat, 20 Jun 2020 08:54:45 +0000 (09:54 +0100)]
Revert "[BasicAA] Use known lower bounds for index values for size based check."

This potentially related to https://bugs.llvm.org/show_bug.cgi?id=46335
and causes a slight compile-time regression. Revert while investigating.

This reverts commit d99a1848c4f8ca164c0c0768e10eafc850b2a68a.

4 years ago[CMake] Fix runtimes build for host Windows (default target)
Kristina Bessonova [Mon, 15 Jun 2020 10:05:13 +0000 (12:05 +0200)]
[CMake] Fix runtimes build for host Windows (default target)

When building runtimes, the compiler name (e.g. clang, clang-cl) is set based on
`CMAKE_SYSTEM_NAME` passed to `llvm_ExternalProject_Add()` through `CMAKE_ARGS` argument.
This mechanism doesn't work well if the target is Windows host.
`runtime_default_target()`/`builtin_default_target()` doesn't provide a way
to specify `CMAKE_SYSTEM_NAME` and doesn't set it either.

This patch appends variables specified in `RUNTIMES_CMAKE_ARGS`/`BUILTINS_CMAKE_ARGS`
to `CMAKE_ARGS` argument of `llvm_ExternalProject_Add()` in the case of called
from `runtime_default_target()`/`builtin_default_target()` thus in particular
it allows passing CMAKE_SYSTEM_NAME whenever it is required.

Reviewed By: phosek, compnerd, plotfi

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

4 years agoTemporarily Revert "[flang][OpenMP] Enhance parser support for flush construct to...
Eric Christopher [Sat, 20 Jun 2020 08:18:53 +0000 (01:18 -0700)]
Temporarily Revert "[flang][OpenMP] Enhance parser support for flush construct to OpenMP 5.0"
as it's failing Semantics/omp-clause-validity01.f90.

This reverts commit b32401464f4c9c9d43a3ddcb351cb6c7c713fdb4.

4 years ago[AST/Lex/Parse/Sema] As part of using inclusive language within
Eric Christopher [Sat, 20 Jun 2020 08:14:57 +0000 (01:14 -0700)]
[AST/Lex/Parse/Sema] As part of using inclusive language within
the llvm project, migrate away from the use of blacklist and whitelist.

4 years ago[flang][OpenMP] Enhance parser support for flush construct to OpenMP 5.0
Kiran Kumar T P [Sat, 20 Jun 2020 08:02:15 +0000 (13:32 +0530)]
[flang][OpenMP] Enhance parser support for flush construct to OpenMP 5.0

Summary:
This patch enhances parser support for flush construct to OpenMP 5.0 by including memory-order-clause.

2.18.8 flush Construct
!$omp flush [memory-order-clause] [(list)]
where memory-order-clause is
acq_rel
release
acquire

The patch includes code changes and testcase modifications.

Reviewed By: klausler, kiranchandramohan

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

4 years ago[cpplint] As part of using inclusive language within the llvm project,
Eric Christopher [Sat, 20 Jun 2020 07:58:04 +0000 (00:58 -0700)]
[cpplint] As part of using inclusive language within the llvm project,
migrate away from the use of blacklist and whitelist.

4 years ago[docs/examples] As part of using inclusive language within the llvm
Eric Christopher [Sat, 20 Jun 2020 07:51:18 +0000 (00:51 -0700)]
[docs/examples] As part of using inclusive language within the llvm
project, migrate away from the use of blacklist and whitelist.

4 years ago[Analysis/Transforms/Sanitizers] As part of using inclusive language
Eric Christopher [Sat, 20 Jun 2020 07:42:26 +0000 (00:42 -0700)]
[Analysis/Transforms/Sanitizers] As part of using inclusive language
within the llvm project, migrate away from the use of blacklist and
whitelist.

4 years agoAs part of using inclusive language within the llvm project,
Eric Christopher [Sat, 20 Jun 2020 07:24:57 +0000 (00:24 -0700)]
As part of using inclusive language within the llvm project,
migrate away from the use of blacklist and whitelist.

4 years ago[Support/Utils] As part of using inclusive language within the
Eric Christopher [Sat, 20 Jun 2020 07:15:50 +0000 (00:15 -0700)]
[Support/Utils] As part of using inclusive language within the
llvm project, migrate away from the use of blacklist and whitelist.

4 years ago[Target] As part of using inclusive language within the llvm project,
Eric Christopher [Sat, 20 Jun 2020 07:05:32 +0000 (00:05 -0700)]
[Target] As part of using inclusive language within the llvm project,
migrate away from the use of blacklist and whitelist.

This change affects an internal llvm command line option.

4 years ago[DWARFYAML][debug_info] Fix array index out of bounds error
Xing GUO [Sat, 20 Jun 2020 06:25:56 +0000 (14:25 +0800)]
[DWARFYAML][debug_info] Fix array index out of bounds error

This patch is trying to fix the array index out of bounds error. I observed it in (https://reviews.llvm.org/harbormaster/unit/view/99638/).

Reviewed By: jhenderson, MaskRay

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

4 years ago[X86] Correct the implementation of ud1(a.k.a. ud2b) instruction.
Craig Topper [Sat, 20 Jun 2020 06:47:43 +0000 (23:47 -0700)]
[X86] Correct the implementation of ud1(a.k.a. ud2b) instruction.

We were missing the modrm byte this instruction has according
to current Intel SDM. Experiments with gcc indicate that different
modrm values are chosen based on 2 operands so I've added those
as well.

I think our previous implementation was based on an older behavior of
binutils that has since been changed.

4 years agoUpdate error to read a little better when an error occurs.
Eric Christopher [Sat, 20 Jun 2020 06:33:37 +0000 (23:33 -0700)]
Update error to read a little better when an error occurs.

4 years agoFix warning caused by TableGen verifier predicate (NFC)
Mehdi Amini [Sat, 20 Jun 2020 06:22:04 +0000 (06:22 +0000)]
Fix warning caused by TableGen verifier predicate (NFC)

Avoid using max on unsigned constants, in case the caller is using 0 we
end up with:

  warning: taking the max of unsigned zero and a value is always equal to the other value [-Wmax-unsigned-zero]

Instead we can just use native TableGen to fold the comparison here.

4 years agoUpdate redirected output file.
Eric Christopher [Sat, 20 Jun 2020 06:30:16 +0000 (23:30 -0700)]
Update redirected output file.

4 years agoUpdate test file.
Eric Christopher [Sat, 20 Jun 2020 06:13:28 +0000 (23:13 -0700)]
Update test file.

4 years ago[clang-change-namespace] As part of using inclusive language
Eric Christopher [Sat, 20 Jun 2020 06:01:42 +0000 (23:01 -0700)]
[clang-change-namespace] As part of using inclusive language
within the llvm project, migrate away from the use of blacklist
and whitelist.

4 years ago[lldb/Test] Disable TestBuiltinFormats.py on Windows
Jonas Devlieghere [Sat, 20 Jun 2020 05:40:55 +0000 (22:40 -0700)]
[lldb/Test] Disable TestBuiltinFormats.py on Windows

Disable the test to turn the Windows bot green again until Raphael has
time to investigate.

4 years ago[lldb/Test] Temporarily skip watch simulator in TestSimulatorPlatform.py
Jonas Devlieghere [Sat, 20 Jun 2020 03:21:45 +0000 (20:21 -0700)]
[lldb/Test] Temporarily skip watch simulator in TestSimulatorPlatform.py

The simulator doesn't launch on green-dragon-10.

rdar://problem/64552748

4 years ago[X86] Ignore bits 2:0 of the modrm byte when disassembling lfence, mfence, and sfence.
Craig Topper [Sat, 20 Jun 2020 05:18:53 +0000 (22:18 -0700)]
[X86] Ignore bits 2:0 of the modrm byte when disassembling lfence, mfence, and sfence.

These are documented as using modrm byte of 0xe8, 0xf0, and 0xf8
respectively. But hardware ignore bits 2:0. So 0xe9-0xef is treated
the same as 0xe8. Similar for the other two.

Fixing this required adding 8 new formats to the X86 instructions
to convey this information. Could have gotten away with 3, but
adding all 8 made for a more logical conversion from format to
modrm encoding.

I renumbered the format encodings to keep the register modrm
formats grouped together.

4 years ago[SanitizeCoverage] Rename -fsanitize-coverage-{white,black}list to -fsanitize-coverag...
Fangrui Song [Sat, 20 Jun 2020 05:22:47 +0000 (22:22 -0700)]
[SanitizeCoverage] Rename -fsanitize-coverage-{white,black}list to -fsanitize-coverage-{allow,block}list

Keep deprecated -fsanitize-coverage-{white,black}list as aliases for compatibility for now.

Reviewed By: echristo

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

4 years ago[IR] Convert profile metadata in createCallMatchingInvoke()
Yevgeny Rouban [Sat, 20 Jun 2020 05:06:01 +0000 (12:06 +0700)]
[IR] Convert profile metadata in createCallMatchingInvoke()

When an invoke instruction is converted to a call its
profile metadata is dropped because it has incompatible
format (see commit 16ad6eeb94ff).
This patch adds an attempt to convert profile data to
format of the call instruction. This used to work well
before the commit dcfa78a4ccec.

Reviewers: reames
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82071

4 years ago[Mips] Error if a non-immediate operand is used while an immediate is expected
Wang Rui [Sat, 20 Jun 2020 05:05:28 +0000 (22:05 -0700)]
[Mips] Error if a non-immediate operand is used while an immediate is expected

The 32-bit type relocation (R_MIPS_32) cannot be used for instructions below:

ori $4, $4, start
ori $4, $4, (start - .)

We should print an error instead.

Reviewed By: atanasyan, MaskRay

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

4 years ago[lld] As part of using inclusive language within the llvm
Eric Christopher [Sat, 20 Jun 2020 04:50:14 +0000 (21:50 -0700)]
[lld] As part of using inclusive language within the llvm
project, migrate away from the use of blacklist and whitelist.

4 years ago[libcxx] As part of using inclusive language within the llvm
Eric Christopher [Sat, 20 Jun 2020 04:37:11 +0000 (21:37 -0700)]
[libcxx] As part of using inclusive language within the llvm
project, migrate away from the use of blacklist and whitelist.

4 years ago[UpdateTestChecks] As part of using inclusive language within the
Eric Christopher [Sat, 20 Jun 2020 04:30:17 +0000 (21:30 -0700)]
[UpdateTestChecks] As part of using inclusive language within the
llvm project, migrate away from the use of blacklist and whitelist.

4 years ago[StackSafety,NFC] Don't rerun on LiveIn change
Vitaly Buka [Thu, 18 Jun 2020 09:30:33 +0000 (02:30 -0700)]
[StackSafety,NFC] Don't rerun on LiveIn change

4 years ago[ObjectYAML][ELF] Add support for emitting the .debug_info section.
Xing GUO [Sat, 20 Jun 2020 04:09:22 +0000 (12:09 +0800)]
[ObjectYAML][ELF] Add support for emitting the .debug_info section.

This patch helps add support for emitting the .debug_info section to yaml2elf.

Reviewed By: jhenderson, grimar, MaskRay

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