platform/upstream/llvm.git
3 years agoFix for test failure caused by 84c475437267e7fffedc40029ce274b099d8f8f3.
Leonard Chan [Tue, 4 May 2021 18:43:26 +0000 (11:43 -0700)]
Fix for test failure caused by 84c475437267e7fffedc40029ce274b099d8f8f3.

Reduces the number of targets/triples for this test since not all cmake
invocations will build for those targets.

3 years ago[Driver] Fix `ToolChain::getCompilerRTPath()` to return the correct path on Apple...
Dan Liew [Sat, 1 May 2021 02:10:18 +0000 (19:10 -0700)]
[Driver] Fix `ToolChain::getCompilerRTPath()` to return the correct path on Apple platforms.

When the target triple was an Apple platform `ToolChain::getOSLibName()`
(called by `getCompilerRTPath()`) would return the full OS name
including the version number (e.g. `darwin20.3.0`). This is not correct
because the library directory for all Apple platforms is `darwin`.

This in turn caused

* `-print-runtime-dir` to return a non-existant path.
* `-print-file-name=<any compiler-rt library>` to return the filename
  instead of the full path to the library.

Two regression tests are included.

rdar://77417317

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

3 years agoAdd monthly MemorySSA sync.
Alina Sbirlea [Tue, 4 May 2021 18:23:12 +0000 (11:23 -0700)]
Add monthly MemorySSA sync.

3 years ago[llvm-objdump] Delete temporary Hexagon workaround options
Fangrui Song [Tue, 4 May 2021 18:05:11 +0000 (11:05 -0700)]
[llvm-objdump] Delete temporary Hexagon workaround options

3 years ago[Format] Don't sort includes if DisableFormat is true
Nathan James [Tue, 4 May 2021 18:04:11 +0000 (19:04 +0100)]
[Format] Don't sort includes if DisableFormat is true

Fixes https://llvm.org/PR35099.

I'm not sure if this decision was intentional but its definitely confusing for users.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, curdeius

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

3 years ago[Hexagon][test] Migrate llvm-objdump --mv6[0567]t?/--mhvx to --mcpu=hexagonv*/--mattr...
Fangrui Song [Tue, 4 May 2021 18:00:01 +0000 (11:00 -0700)]
[Hexagon][test] Migrate llvm-objdump --mv6[0567]t?/--mhvx to --mcpu=hexagonv*/--mattr=+hvx

3 years ago[clang] Add -fc++-abi= flag for specifying which C++ ABI to use
Leonard Chan [Wed, 21 Apr 2021 22:09:12 +0000 (15:09 -0700)]
[clang] Add -fc++-abi= flag for specifying which C++ ABI to use

This implements the flag proposed in RFC
http://lists.llvm.org/pipermail/cfe-dev/2020-August/066437.html.

The goal is to add a way to override the default target C++ ABI through a
compiler flag. This makes it easier to test and transition between different
C++ ABIs through compile flags rather than build flags.

In this patch:

- Store -fc++-abi= in a LangOpt. This isn't stored in a CodeGenOpt because
  there are instances outside of codegen where Clang needs to know what the
  ABI is (particularly through ASTContext::createCXXABI), and we should be
  able to override the target default if the flag is provided at that point.
- Expose the existing ABIs in TargetCXXABI as values that can be passed
  through this flag.
  - Create a .def file for these ABIs to make it easier to check flag values.
  - Add an error for diagnosing bad ABI flag values.

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

3 years ago[libFuzzer] Disable non-exec-time test again.
Matt Morehouse [Tue, 4 May 2021 17:50:29 +0000 (10:50 -0700)]
[libFuzzer] Disable non-exec-time test again.

It was previously disabled for the past 6+ months.  I tried to re-enable
it after some deflaking, but it still fails occasionally.

3 years ago[SimplifyCFG] Create logical or in SimplifyCondBranchToCondBranch()
Nikita Popov [Tue, 4 May 2021 17:11:37 +0000 (19:11 +0200)]
[SimplifyCFG] Create logical or in SimplifyCondBranchToCondBranch()

We need to use a logical or instead of a bitwise or to preserve
poison behavior. Poison from the second condition should not
propagate if the first condition is true.

We were already handling this correctly in FoldBranchToCommonDest(),
but not in this fold. (There are still other folds with this issue.)

3 years ago[SimplifyCFG] Regenerate test checks (NFC)
Nikita Popov [Tue, 4 May 2021 17:15:05 +0000 (19:15 +0200)]
[SimplifyCFG] Regenerate test checks (NFC)

Regenerate the branch weight test using --check-globals.

3 years ago[SimplifyCFG] Extract helper for creating logical op (NFC)
Nikita Popov [Tue, 4 May 2021 17:06:46 +0000 (19:06 +0200)]
[SimplifyCFG] Extract helper for creating logical op (NFC)

3 years ago[libFuzzer] Further deflake exec-time test.
Matt Morehouse [Tue, 4 May 2021 17:46:11 +0000 (10:46 -0700)]
[libFuzzer] Further deflake exec-time test.

Increase runs to 200,000 since we currently get a random failure about
once per day on the buildbot.

3 years ago[llvm-objdump] Delete temporary workaround option --riscv-no-aliases
Fangrui Song [Tue, 4 May 2021 17:41:40 +0000 (10:41 -0700)]
[llvm-objdump] Delete temporary workaround option --riscv-no-aliases

Use the user-facing `-M no-aliases` instead.

3 years ago[RISCV][test] Migrate llvm-objdump --riscv-no-aliases to -M no-aliases
Fangrui Song [Tue, 4 May 2021 17:38:33 +0000 (10:38 -0700)]
[RISCV][test] Migrate llvm-objdump --riscv-no-aliases to -M no-aliases

--riscv-no-aliases is an internal cl::opt option not intended to be exported.
Use the user-facing -M no-aliases instead.

3 years ago[InstSimplify] Added tests for PR50173, NFC
Dávid Bolvanský [Tue, 4 May 2021 15:27:31 +0000 (17:27 +0200)]
[InstSimplify] Added tests for PR50173, NFC

3 years ago[Clang][AArch64] Disable rounding of return values for AArch64
Andrew Savonichev [Tue, 13 Apr 2021 13:28:32 +0000 (16:28 +0300)]
[Clang][AArch64] Disable rounding of return values for AArch64

If a return value is explicitly rounded to 64 bits, an additional zext
instruction is emitted, and in some cases it prevents tail call
optimization.

As discussed in D100225, this rounding is not necessary and can be
disabled.

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

3 years ago[docs] Fix some wording
Arthur Eubanks [Tue, 4 May 2021 17:21:38 +0000 (10:21 -0700)]
[docs] Fix some wording

3 years ago[clang-tidy][NFC] Update tests and Default options to use boolean value
Nathan James [Tue, 4 May 2021 17:17:55 +0000 (18:17 +0100)]
[clang-tidy][NFC] Update tests and Default options to use boolean value

Change instances where options which are boolean are assigned the value 1|0 to use true|false instead.

Reviewed By: aaron.ballman

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

3 years ago[llvm-objdump] Fix -a after D100433
Fangrui Song [Tue, 4 May 2021 17:17:36 +0000 (10:17 -0700)]
[llvm-objdump] Fix -a after D100433

-a is alias for --archive-headers, not --all-headers

3 years ago[ValueTypes] Add MVTs for v256i16 and v256f16
Fraser Cormack [Tue, 4 May 2021 14:17:44 +0000 (15:17 +0100)]
[ValueTypes] Add MVTs for v256i16 and v256f16

This patch adds the two MVTs to fix a legalizer crash when using vector
shuffles of <256 x i16> and <128 x i16> on RISC-V. The legalizer can't
promote the operand of `v256i32 = any_extend_vector_inreg v128i16`.

Reviewed By: craig.topper, RKSimon

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

3 years ago[PowerPC] Prevent argument promotion of types with size greater than 128 bits
Ahsan Saghir [Fri, 23 Apr 2021 13:26:45 +0000 (08:26 -0500)]
[PowerPC] Prevent argument promotion of types with size greater than 128 bits

This patch prevents argument promotion of types having
type size greater than 128 bits.

Fixes Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=49952

Reviewed By: #powerpc, nemanjai

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

3 years agoRevert "Make dependency between certain analysis passes transitive"
Bjorn Pettersson [Tue, 4 May 2021 17:07:05 +0000 (19:07 +0200)]
Revert "Make dependency between certain analysis passes transitive"

This reverts commit 3655f0757f2b4b61419446b326410118658826ba.

It caused assertion failures related to setLastUser in polly builds.

3 years ago[libc++] NFC: Fix typo in Ranges Status
Louis Dionne [Tue, 4 May 2021 17:06:51 +0000 (13:06 -0400)]
[libc++] NFC: Fix typo in Ranges Status

3 years ago[SampleFDO] Fix a bug when appending function symbol into the Callees set of
Wei Mi [Tue, 4 May 2021 05:55:53 +0000 (22:55 -0700)]
[SampleFDO] Fix a bug when appending function symbol into the Callees set of
Root node in ProfiledCallGraph.

In ProfiledCallGraph::addProfiledFunction, to add a function symbol into the
ProfiledCallGraph, currently an uninitialized ProfiledCallGraphNode node is
created by ProfiledFunctions[Name] and inserted into Callees set of Root node
before the node is initialized. The Callees set use
ProfiledCallGraphNodeComparer as its comparator so the uninitialized
ProfiledCallGraphNode may fail to be inserted into Callees set if it happens
to contain a name in memory which has been inserted into the Callees set
before. The problem will prevent some function symbols from being annotated
with profiles and cause performance regression. The patch fixes the problem.

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

3 years ago[llvm-objdump] Improve newline consistency between different pieces of information
Fangrui Song [Tue, 4 May 2021 16:56:06 +0000 (09:56 -0700)]
[llvm-objdump] Improve newline consistency between different pieces of information

When dumping multiple pieces of information (e.g. --all-headers),
there is sometimes no separator between two pieces.
This patch uses the "\nheader:\n" style, which generally improves
compatibility with GNU objdump.

Note: objdump -t/-T does not add a newline before "SYMBOL TABLE:" and "DYNAMIC SYMBOL TABLE:".
We add a newline to be consistent with other information.

`objdump -d` prints two empty lines before the first 'Disassembly of section'.
We print just one with this patch.

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

3 years ago[llvm-objdump] Remove Generic Options group from help text output
gbreynoo [Tue, 4 May 2021 16:42:20 +0000 (17:42 +0100)]
[llvm-objdump] Remove Generic Options group from help text output

Reapply 7368624 after revert and fix

Looking at other tools using tablegen for help output, general options
like --help are not separated from other options. This change removes
the "Generic Options" option group so the options are listed together.
the macho specific option group is left unaffected.

The test help.test was modified to reflect this change.

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

3 years ago[lldb/Core] Add SourceLocationSpec class (NFC)
Med Ismail Bennani [Fri, 30 Apr 2021 22:44:54 +0000 (22:44 +0000)]
[lldb/Core] Add SourceLocationSpec class (NFC)

A source location specifier class that holds a Declaration object containing
a FileSpec with line and column information. The column line is optional.
It also holds search flags that can be fetched by resolvers to look inlined
declarations and/or exact matches.

It describes a specific location in a source file and allows the user
to perform checks and comparaisons between multiple instances of that class.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[lldb] Move and clean-up the Declaration class (NFC)
Med Ismail Bennani [Fri, 30 Apr 2021 03:35:59 +0000 (03:35 +0000)]
[lldb] Move and clean-up the Declaration class (NFC)

This patch moves the Declaration class from the Symbol library to the
Core library. This will allow to use it in a more generic fashion and
aims to lower the dependency cycles when it comes to the linking.

The patch also does some cleaning up by making column information
permanent and removing the LLDB_ENABLE_DECLARATION_COLUMNS directives.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[lldb/Utility] Update path in FileSpec documentation (NFC)
Med Ismail Bennani [Wed, 21 Apr 2021 05:37:43 +0000 (05:37 +0000)]
[lldb/Utility] Update path in FileSpec documentation (NFC)

Update FileSpec doxygen path to reflect its actual location in the
source-tree.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years agoRevert "[llvm-objdump] Remove Generic Options group from help text output"
Dimitry Andric [Tue, 4 May 2021 16:28:31 +0000 (18:28 +0200)]
Revert "[llvm-objdump] Remove Generic Options group from help text output"

This reverts commit 73686247ac3e60c91fa5943c98956093df5e49ff, as there
were git stash conflict markers left unresolved.

3 years agoDAG: Cleanup assertion in EmitFuncArgumentDbgValue
Christudasan Devadasan [Fri, 30 Apr 2021 03:50:26 +0000 (09:20 +0530)]
DAG: Cleanup assertion in EmitFuncArgumentDbgValue

Removing an assertion introduced with D68945. The
patch was later reverted with 6531a78ac4b5, but failed
to remove this assertion. It causes a problem while
trying to split a 64-bit argument into sub registers.

Reviewed By: arsenm

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

3 years agoReland "[MC][ELF] Work around R_MIPS_LO16 relocation handling problem"
Dimitry Andric [Tue, 4 May 2021 14:58:54 +0000 (16:58 +0200)]
Reland "[MC][ELF] Work around R_MIPS_LO16 relocation handling problem"

This fixes PR49821, and avoids "ld.lld: error: test.o:(.rodata.str1.1):
offset is outside the section" errors when linking MIPS objects with
negative R_MIPS_LO16 implicit addends.

ld.lld handles R_MIPS_HI16/R_MIPS_LO16 separately, not as a whole, so it
doesn't know that an R_MIPS_HI16 with implicit addend 1 and an
R_MIPS_LO16 with implicit addend -32768 represents 32768, which is in
range of a MergeInputSection. We could introduce a new RelExpr member
(like R_RISCV_PC_INDIRECT for R_RISCV_PCREL_HI20 / R_RISCV_PCREL_LO12)
but the complexity is unnecessary given that GNU as keeps the original
symbol for this case as well.

Adds a new test case for PR49821, and also updates two other test cases
that are affected by this change.

Reviewed By: atanasyan, MaskRay

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

3 years agoFix assert on the variable which is used in omp clause is not marked
Jennifer Yu [Mon, 3 May 2021 18:19:59 +0000 (11:19 -0700)]
Fix assert on the variable which is used in omp clause is not marked
as used.

The problem only happens with constexpr variable, for constexpr variable,
variable is not marked during parser variable.   This is because compiler
might find some var's associate expressions may not actully an odr-used
later,  the variables get kept in MaybeODRUseExprs, in normal case, at
end of process fullExpr, the variable will be marked during the call to
CleanupVarDeclMarking(). Since we are processing expression of OpenMP
clauses, and the ActOnFinishFullExpr is not getting called that casue
variable is not get marked.

One way to fix this is to call CleanupVarDeclMarking() in EndOpenMPClause
for each omp directive.

This to fix https://bugs.llvm.org/show_bug.cgi?id=50206

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

3 years ago[libFuzzer] Preserve position hint in auto dictionary
Fabian Meumertzheim [Tue, 4 May 2021 15:52:17 +0000 (08:52 -0700)]
[libFuzzer] Preserve position hint in auto dictionary

Currently, the position hint of an entry in the persistent auto
dictionary is fixed to 1. As a consequence, with a 50% chance, the entry
is applied right after the first byte of the input. As the position 1
does not appear to have any particular significance, this is likely a
bug that may have been caused by confusing the constructor parameter
with a success count.

This commit resolves the issue by preserving any existing position hint
or disabling the hint if the original entry didn't have one.

Reviewed By: morehouse

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

3 years ago[InstCombine] avoid infinite loops with select/icmp transforms
Sanjay Patel [Tue, 4 May 2021 15:43:01 +0000 (11:43 -0400)]
[InstCombine] avoid infinite loops with select/icmp transforms

This fixes https://llvm.org/PR48900 , but as seen in the
regression tests prevents some optimizations.

There are a few options to restore those (switch to min/max
intrinsics, add larger pattern matching for select with
dominating condition, improve CVP), but we need to prevent
the bug 1st.

3 years ago[llvm-objdump] Remove Generic Options group from help text output
gbreynoo [Tue, 4 May 2021 15:48:03 +0000 (16:48 +0100)]
[llvm-objdump] Remove Generic Options group from help text output

Looking at other tools using tablegen for help output, general options
like --help are not separated from other options. This change removes
the "Generic Options" option group so the options are listed together.
the macho specific option group is left unaffected.

The test help.test was modified to reflect this change.

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

3 years ago[PowerPC][NFC] Update atomic patterns to use the refactored load/store implementation
Amy Kwan [Fri, 30 Apr 2021 15:52:50 +0000 (10:52 -0500)]
[PowerPC][NFC] Update atomic patterns to use the refactored load/store implementation

This patch updates the scalar atomic patterns to use the refactored load/store
implementation introduced in D93370.
All existing test cases pass with when the refactored patterns are utilized.

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

3 years ago[MLIR] Add not icmp canonicalization documentation
William S. Moses [Tue, 4 May 2021 15:42:10 +0000 (11:42 -0400)]
[MLIR] Add not icmp canonicalization documentation

See: https://reviews.llvm.org/D101710

3 years ago[llvm-objdump] Remove --cfg option from command guide
gbreynoo [Tue, 4 May 2021 15:40:30 +0000 (16:40 +0100)]
[llvm-objdump] Remove --cfg option from command guide

The llvm-objdump command guide has the option --cfg which was removed
from the tool by 888320e9fa5eb33194c066f68d50f1e73c5fff5e in 2014. This
change updates the command guide to reflect this.

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

3 years ago[MLIR][SCF] Assume uses of condition in the body of scf.while is true
William S. Moses [Tue, 4 May 2021 03:40:44 +0000 (23:40 -0400)]
[MLIR][SCF] Assume uses of condition in the body of scf.while is true

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

3 years ago[VPlan] Representing backedge def-use feeding reduction phis.
Florian Hahn [Tue, 4 May 2021 15:18:53 +0000 (16:18 +0100)]
[VPlan] Representing backedge def-use feeding reduction phis.

This patch updates the code handling reduction recipes to also keep
track of the incoming value from the latch in the recipe. This is needed
to model the def-use chains completely in VPlan, so that it is possible
to replace the incoming value with an arbitrary VPValue.

Reviewed By: Ayal

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

3 years ago[MLIR] Replace a not of a comparison with appropriate comparison
William S. Moses [Sun, 2 May 2021 04:16:41 +0000 (00:16 -0400)]
[MLIR] Replace a not of a comparison with appropriate comparison

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

3 years agoRename a template parameter that conflicted with a common macro; NFC
Zachary Henkel [Tue, 4 May 2021 15:19:54 +0000 (11:19 -0400)]
Rename a template parameter that conflicted with a common macro; NFC

The CALLBACK macro is used extensively in the Windows SDK.

3 years ago[libc++] Move the Debug iterators check to CI stage 3
Louis Dionne [Tue, 4 May 2021 15:10:04 +0000 (11:10 -0400)]
[libc++] Move the Debug iterators check to CI stage 3

It's not a default configuration, so it belongs to stage 3.

3 years ago[gn build] Port 2021d272ad6c
LLVM GN Syncbot [Tue, 4 May 2021 15:06:28 +0000 (15:06 +0000)]
[gn build] Port 2021d272ad6c

3 years ago[libc++] Implement ranges::view
Louis Dionne [Wed, 28 Apr 2021 19:22:11 +0000 (15:22 -0400)]
[libc++] Implement ranges::view

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

3 years ago[CodeView] Truncate Long Type Names With An MD5 Hash
Brock Wyma [Wed, 3 Mar 2021 19:48:48 +0000 (14:48 -0500)]
[CodeView] Truncate Long Type Names With An MD5 Hash

Replace long CodeView type names with an MD5 hash of the name.

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

3 years ago[analyzer] Fix a crash for dereferencing an empty llvm::Optional variable in SMTConst...
Ella Ma [Tue, 4 May 2021 14:50:21 +0000 (16:50 +0200)]
[analyzer] Fix a crash for dereferencing an empty llvm::Optional variable in SMTConstraintManager.h.

The first crash reported in the bug report 44338.

Condition `!isSat.hasValue() || isNotSat.getValue()` here should be
`!isNotSat.hasValue() || isNotSat.getValue()`.
`getValue()` here crashed when we used the static analyzer to analyze
postgresql-12.0.

Patch By: OikawaKirie

Reviewed By: steakhal, martong

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

3 years ago[LangRef] Fix a typo in the vector-type memory layout section
Fraser Cormack [Tue, 4 May 2021 14:34:07 +0000 (15:34 +0100)]
[LangRef] Fix a typo in the vector-type memory layout section

3 years agoReland "[LV] Calculate max feasible scalable VF."
Sander de Smalen [Tue, 4 May 2021 08:34:21 +0000 (09:34 +0100)]
Reland "[LV] Calculate max feasible scalable VF."

Relands https://reviews.llvm.org/D98509

This reverts commit 51d648c119d7773ce6fb809353bd6bd14bca8818.

3 years agoFix some typos in d7ec48d71bd671
Nico Weber [Tue, 4 May 2021 14:44:01 +0000 (10:44 -0400)]
Fix some typos in d7ec48d71bd671

3 years ago[mlir][linalg] Always lower index operations during loop lowering.
Tobias Gysi [Tue, 4 May 2021 14:03:04 +0000 (14:03 +0000)]
[mlir][linalg] Always lower index operations during loop lowering.

Ensure the index operations are lowered on all linalg loop lowering paths.

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

3 years ago[Matrix] Implement C-style explicit type conversions in CXX for matrix types
Saurabh Jha [Tue, 4 May 2021 12:44:58 +0000 (13:44 +0100)]
[Matrix] Implement C-style explicit type conversions in CXX for matrix types

This patch implements C-style explicit type conversions in CXX for matrix types. It is part of fixing https://bugs.llvm.org/show_bug.cgi?id=47141

Reviewed By: fhahn

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

3 years ago[clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist=
Nico Weber [Tue, 4 May 2021 13:50:43 +0000 (09:50 -0400)]
[clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist=

Use that for internal names (including the default ignorelists of the
sanitizers).

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

3 years ago[AArch64][SVE] Fold insert(zero, extract(X, 0), 0) -> X, when X is known to zero...
Bradley Smith [Tue, 27 Apr 2021 14:31:46 +0000 (15:31 +0100)]
[AArch64][SVE] Fold insert(zero, extract(X, 0), 0) -> X, when X is known to zero lanes 1-N

Specifically, this allow us to rely on the lane zero'ing behaviour of
SVE reduce instructions.

Co-authored-by: Paul Walker <paul.walker@arm.com>
Differential Revision: https://reviews.llvm.org/D101369

3 years agoLocal.cpp - Avoid DebugLoc copies - use const reference from getDebugLoc. NFCI.
Simon Pilgrim [Tue, 4 May 2021 13:31:29 +0000 (14:31 +0100)]
Local.cpp - Avoid DebugLoc copies - use const reference from getDebugLoc. NFCI.

3 years ago[OpenCL] Allow pipe as a valid identifier prior to OpenCL 2.0.
Anastasia Stulova [Tue, 4 May 2021 13:17:40 +0000 (14:17 +0100)]
[OpenCL] Allow pipe as a valid identifier prior to OpenCL 2.0.

Pipe has not been a reserved keyword in the earlier OpenCL
standards. However we failed to allow its use as an identifier
in the original commit. This issues is fixed now and testing
is improved accordingly.

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

3 years ago[clang][cli][docs] Clarify marshalling infrastructure documentation
Jan Svoboda [Tue, 4 May 2021 13:15:44 +0000 (15:15 +0200)]
[clang][cli][docs] Clarify marshalling infrastructure documentation

3 years ago[Utils] recognizeBSwapOrBitReverseIdiom - support matching from funnel shift roots...
Simon Pilgrim [Tue, 4 May 2021 12:46:45 +0000 (13:46 +0100)]
[Utils] recognizeBSwapOrBitReverseIdiom - support matching from funnel shift roots (PR40058)

We were missing bitreverse matches in cases where InstCombine had seen a byte-level rotation at the end of a bitreverse sequence (replacing or() with fshl()), hindering the exhaustive bitreverse matching in CodeGenPrepare later on.

3 years ago[CodeGenPrepare][X86] Add bitreverse detection tests
Simon Pilgrim [Tue, 4 May 2021 12:20:31 +0000 (13:20 +0100)]
[CodeGenPrepare][X86] Add bitreverse detection tests

Initially only test for XOP which is the only thing that supports scalar bitreverse - we can add vector tests later.

3 years ago[X86] Update PR20841 test description to make it clear we SHOULDN'T be folding EFLAGS...
Simon Pilgrim [Fri, 30 Apr 2021 12:09:28 +0000 (13:09 +0100)]
[X86] Update PR20841 test description to make it clear we SHOULDN'T be folding EFLAGS with XADD

3 years ago[clang][cli] NFC: Remove confusing `EmptyKPM` variable
Jan Svoboda [Tue, 4 May 2021 12:27:40 +0000 (14:27 +0200)]
[clang][cli] NFC: Remove confusing `EmptyKPM` variable

3 years ago[mlir] Add lowering from math.expm1 to LLVM.
Adrian Kuegel [Tue, 16 Feb 2021 13:34:35 +0000 (14:34 +0100)]
[mlir] Add lowering from math.expm1 to LLVM.

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

3 years ago[AMDGPU][AsmParser] Correct the order of optional operands to mimg
David Stuttard [Fri, 30 Apr 2021 10:23:33 +0000 (11:23 +0100)]
[AMDGPU][AsmParser] Correct the order of optional operands to mimg

Ordering of operands was incorrect meaning that a16 operand was treated as tfe

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

Change-Id: I3b15e71ef5ff625f19f52823414ab684d76aca33

3 years ago[IndVarSimplify] Add additional tests using isImpliedViaMerge.
Florian Hahn [Tue, 4 May 2021 10:24:14 +0000 (11:24 +0100)]
[IndVarSimplify] Add additional tests using isImpliedViaMerge.

3 years agoRevert "[SLP]Allow masked gathers only if allowed by target."
Alexey Bataev [Tue, 4 May 2021 11:52:28 +0000 (04:52 -0700)]
Revert "[SLP]Allow masked gathers only if allowed by target."

This reverts commit fd18547e0721983dcb273670d16341921f831e50. Need to
add a check for the size of the vectorization tree to avoid some extra
vectorization.

3 years ago[InstCombine] ctpop(X) ^ ctpop(Y) & 1 --> ctpop(X^Y) & 1 (PR50094)
Dávid Bolvanský [Tue, 4 May 2021 11:15:13 +0000 (13:15 +0200)]
[InstCombine] ctpop(X) ^ ctpop(Y) & 1 --> ctpop(X^Y) & 1 (PR50094)

Original pattern: (__builtin_parity(x) ^ __builtin_parity(y))

LLVM rewrites it as: (__builtin_popcount(x) ^ __builtin_popcount(y)) & 1

Optimized form:  __builtin_popcount(X^Y) & 1

Alive proof: https://alive2.llvm.org/ce/z/-GdWFr

Reviewed By: RKSimon

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

3 years ago[clang-tidy] Fix cppcoreguidelines-pro-type-vararg false positives with __builtin_ms_...
Georgy Komarov [Sun, 25 Apr 2021 15:52:16 +0000 (18:52 +0300)]
[clang-tidy] Fix cppcoreguidelines-pro-type-vararg false positives with __builtin_ms_va_list

This commit fixes cppcoreguidelines-pro-type-vararg false positives on
'char *' variables.

The incorrect warnings generated by clang-tidy can be illustrated with
the following minimal example:

```
goid foo(char* in) {
  char *tmp = in;
}
```

The problem is that __builtin_ms_va_list desugared as 'char *', which
leads to false positives.

Fixes bugzilla issue 48042.

Reviewed By: aaron.ballman

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

3 years agoIntroduce clangd-server-monitor tool
Kirill Bobyrev [Tue, 4 May 2021 10:48:20 +0000 (12:48 +0200)]
Introduce clangd-server-monitor tool

Reviewed By: kadircet

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

3 years ago[clang-format] Prevent extraneous space insertion in bitshift operators
Luis Penagos [Tue, 4 May 2021 10:00:00 +0000 (12:00 +0200)]
[clang-format] Prevent extraneous space insertion in bitshift operators

This serves to augment the improvements made in https://reviews.llvm.org/D86581. It prevents clang-format from interpreting bitshift operators as template arguments in certain circumstances. This is an attempt at fixing https://bugs.llvm.org/show_bug.cgi?id=49868

Reviewed By: MyDeveloperDay, krasimir

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

3 years ago[RISCV] Pre-commit tests for D101342
Jessica Clarke [Tue, 4 May 2021 10:12:43 +0000 (11:12 +0100)]
[RISCV] Pre-commit tests for D101342

These tests show inefficient sign extension for AMOs on RISC-V. The
normal CodeGen tests use anyext return values, but if marked signext
then we end up generating unnecessary sign extension instructions. This
can be seen when compiling C that returns an i32 (signed or unsigned),
where the calling convention results in a signext return value.

3 years ago[llvm] Unbreak no-assertion testing
David Zarzycki [Tue, 4 May 2021 10:05:38 +0000 (06:05 -0400)]
[llvm] Unbreak no-assertion testing

3 years ago[gn build] Port 1db4dbba24dd
LLVM GN Syncbot [Tue, 4 May 2021 09:56:46 +0000 (09:56 +0000)]
[gn build] Port 1db4dbba24dd

3 years agoMake dependency between certain analysis passes transitive
Bjorn Pettersson [Wed, 21 Apr 2021 12:18:32 +0000 (14:18 +0200)]
Make dependency between certain analysis passes transitive

LazyBlockFrequenceInfoPass, LazyBranchProbabilityInfoPass and
LoopAccessLegacyAnalysis all cache pointers to their nestled required
analysis passes. One need to use addRequiredTransitive to describe
that the nestled passes can't be freed until those analysis passes
no longer are used themselves.

There is still a bit of a mess considering the getLazyBPIAnalysisUsage
and getLazyBFIAnalysisUsage functions. Those functions are used from
both Transform, CodeGen and Analysis passes. I figure it is OK to
use addRequiredTransitive also when being used from Transform and
CodeGen passes. On the other hand, I figure we must do it when
used from other Analysis passes. So using addRequiredTransitive should
be more correct here. An alternative solution would be to add a
bool option in those functions to let the user tell if it is a
analysis pass or not. Since those lazy passes will be obsolete when
new PM has conquered the world I figure we can leave it like this
right now.

Intention with the patch is to fix PR49950. It at least solves the
problem for the reproducer in PR49950. However, that reproducer
need five passes in a specific order, so there are lots of various
"solutions" that could avoid the crash without actually fixing the
root cause.

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

3 years agoRecommit "[VP,Integer,#2] ExpandVectorPredication pass"
Simon Moll [Fri, 30 Apr 2021 11:43:48 +0000 (13:43 +0200)]
Recommit "[VP,Integer,#2] ExpandVectorPredication pass"

This reverts the revert 02c5ba8679873e878ae7a76fb26808a47940275b

Fix:

Pass was registered as DUMMY_FUNCTION_PASS causing the newpm-pass
functions to be doubly defined. Triggered in -DLLVM_ENABLE_MODULE=1
builds.

Original commit:

This patch implements expansion of llvm.vp.* intrinsics
(https://llvm.org/docs/LangRef.html#vector-predication-intrinsics).

VP expansion is required for targets that do not implement VP code
generation. Since expansion is controllable with TTI, targets can switch
on the VP intrinsics they do support in their backend offering a smooth
transition strategy for VP code generation (VE, RISC-V V, ARM SVE,
AVX512, ..).

Reviewed By: rogfer01

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

3 years ago[clangd] Fix hover crash on broken code
Kadir Cetinkaya [Mon, 3 May 2021 07:13:56 +0000 (09:13 +0200)]
[clangd] Fix hover crash on broken code

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

3 years agoIntroduce -Wreserved-identifier
serge-sans-paille [Wed, 9 Dec 2020 08:26:27 +0000 (09:26 +0100)]
Introduce -Wreserved-identifier

Warn when a declaration uses an identifier that doesn't obey the reserved
identifier rule from C and/or C++.

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

3 years ago[RISCV] Lower splats of non-constant i1s as SETCCs
Fraser Cormack [Wed, 28 Apr 2021 15:11:57 +0000 (16:11 +0100)]
[RISCV] Lower splats of non-constant i1s as SETCCs

This patch adds support for splatting i1 types to fixed-length or
scalable vector types. It does so by lowering the operation to a SETCC
of the equivalent i8 type.

Reviewed By: craig.topper

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

3 years ago[TTI] Replace ceil lambdas with divideCeil. NFCI
David Green [Tue, 4 May 2021 08:04:44 +0000 (09:04 +0100)]
[TTI] Replace ceil lambdas with divideCeil. NFCI

As pointed out in D101726, this function already exists in MathExtras.
It uses different types, but with the values used here I believe that
should not make a functional difference.

3 years ago[gn build] Port ed51156084dd
LLVM GN Syncbot [Tue, 4 May 2021 06:39:48 +0000 (06:39 +0000)]
[gn build] Port ed51156084dd

3 years ago[ModuleUtils] NFC: Add unit tests for appendToUsedList
Reshabh Sharma [Tue, 4 May 2021 06:35:50 +0000 (12:05 +0530)]
[ModuleUtils] NFC: Add unit tests for appendToUsedList

This patch adds initial unit tests for appendToUsedList
in the ModuleUtils. It specifically tests changes from
https://reviews.llvm.org/D101363 which intent to allow
insertion of globals in non-zero address spaces into the
llvm used lists.

Reviewed by: dblaikie

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

3 years ago[lld-macho] Implement builtin section renaming
Greg McGary [Sun, 25 Apr 2021 23:00:24 +0000 (16:00 -0700)]
[lld-macho] Implement builtin section renaming

ld64 automatically renames many sections depending on output type and assorted flags. Here, we implement the most common configs. We can add more obscure flags and behaviors as needed.

Depends on D101393

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

3 years ago[NFC] Give better diagnose on clang-format not found error
Shivam Gupta [Tue, 4 May 2021 03:52:06 +0000 (09:22 +0530)]
[NFC] Give better diagnose on clang-format not found error

Contributors often confused by whether this is a server or local issue.

3 years ago[clang][CodeGen] Use llvm::stable_sort for multi version resolver options
Alex Lorenz [Tue, 4 May 2021 03:05:38 +0000 (20:05 -0700)]
[clang][CodeGen] Use llvm::stable_sort for multi version resolver options

The use of llvm::sort causes periodic failures on the bot with EXPENSIVE_CHECKS enabled,
as the regular sort pre-shuffles the array in the expensive checks mode, leading to a
non-deterministic test result which causes the CodeGenCXX/attr-cpuspecific-outoflinedefs.cpp
testcase to fail on the bot (http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/).

3 years ago[mlir] Fix bug in TransferOpReduceRank when all dims are broadcasts
Matthias Springer [Tue, 4 May 2021 01:43:10 +0000 (10:43 +0900)]
[mlir] Fix bug in TransferOpReduceRank when all dims are broadcasts

TransferReadOps that are a scalar read + broadcast are handled by TransferReadToVectorLoadLowering.

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

3 years ago[mlir][tosa] Add lowerings for tosa.equal and tosa.arithmetic_right_shift
natashaknk [Tue, 4 May 2021 01:08:14 +0000 (18:08 -0700)]
[mlir][tosa] Add lowerings for tosa.equal and tosa.arithmetic_right_shift

Lowerings equal and arithmetic_right_shift for elementwise ops to linalg dialect using linalg.generic

Reviewed By: rsuderman

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

3 years ago[IndVarSimplify][NFC] Removed mayThrow from if-condition in predicateLoopExits of...
Philip Reames [Tue, 4 May 2021 01:23:41 +0000 (18:23 -0700)]
[IndVarSimplify][NFC] Removed mayThrow from if-condition in predicateLoopExits of IndVarSimplify

Instruction has mayHaveSideEffects method that returns true if mayThrow return true because this is called internally in the first method.  As such, the call being removed is redundant.

Patch By: vdsered (Daniil Seredkin)
Differential Revision: https://reviews.llvm.org/D101685

3 years ago[lld][WebAssembly] Fix crash with `-pie` without `--allow-undefined`
Sam Clegg [Sat, 1 May 2021 22:37:40 +0000 (15:37 -0700)]
[lld][WebAssembly] Fix crash with `-pie` without `--allow-undefined`

`shouldImport` was not returning true in PIC mode even though out
assumption elsewhere (in Relocations.cpp:scanRelocations) is that we
don't report undefined symbols in PIC mode today.  This was resulting
functions that were undefined and but also not imported which hits an
assert later on that all functions have valid indexes.

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

3 years ago[InstCombine] generalize select + select/and/or folding using implied conditions
Juneyoung Lee [Sun, 2 May 2021 11:07:25 +0000 (20:07 +0900)]
[InstCombine] generalize select + select/and/or folding using implied conditions

This patch optimizes the remaining possible cases in D101191 by generalizing isImpliedCondition()-based
foldings.

Assume that there is `op a, (select b, _, _)` where op is one of `and i1`, `or i1` or their select forms.

We can do the following optimization based on the result of `isImpliedCondition(a, b)`:

If a = true implies…
- b = true:
    - select a, (select b, A, B), false => select a, A, false : https://alive2.llvm.org/ce/z/WCnZYh
    - and a, (select b, A, B) => select a, A, false : https://alive2.llvm.org/ce/z/uZhcMG
- b = false:
    - select a, (select b, A, B), false => select a, B, false : https://alive2.llvm.org/ce/z/c2hJpV
    - and a, (select b, A, B) => select a, B, false : https://alive2.llvm.org/ce/z/5ggwMM

If a = false implies…
- b = true:
    - select a, true, (select b, A, B) => select a, true, A : https://alive2.llvm.org/ce/z/tidKvH
    - or a, (select b, A, B) =>  select a, true, A : https://alive2.llvm.org/ce/z/cC-uyb
- b = false:
    - select a, true, (select b, A, B) => select a, true, B : https://alive2.llvm.org/ce/z/ZXpJq9
    - or a, (select b, A, B) => select a, true, B : https://alive2.llvm.org/ce/z/hnDrJj

Reviewed By: nikic

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

3 years agoPrecommit tests for D101720 (NFC)
Juneyoung Lee [Sun, 2 May 2021 10:24:09 +0000 (19:24 +0900)]
Precommit tests for D101720 (NFC)

3 years agoClarify the help for "breakpoint command add" and "watchpoint command add".
Jim Ingham [Tue, 4 May 2021 00:17:51 +0000 (17:17 -0700)]
Clarify the help for "breakpoint command add" and "watchpoint command add".

These two commands add a list of commands to the breakpoint/watchpoint. The current
implementation only supports replacing the current command list.  I started with
that as overwrite seems to be the most common operation.  But using "add" will
allow us to later offer other add-modes: "prepend", "append" and "insert".
That and "overwrite" then make up a useful set of options for this operation.

3 years ago[NewPM] Only invalidate modified functions' analyses in CGSCC passes
Arthur Eubanks [Mon, 3 May 2021 23:50:26 +0000 (16:50 -0700)]
[NewPM] Only invalidate modified functions' analyses in CGSCC passes

Previously, any change in any function in an SCC would cause all
analyses for all functions in the SCC to be invalidated. With this
change, we now manually invalidate analyses for functions we modify,
then let the pass manager know that all function analyses should be
preserved.

So far this only touches the inliner, argpromotion, funcattrs, and
updateCGAndAnalysisManager(), since they are the most used.

Slight compile time improvements:
http://llvm-compile-time-tracker.com/compare.php?from=326da4adcb8def2abdd530299d87ce951c0edec9&to=8942c7669f330082ef159f3c6c57c3c28484f4be&stat=instructions

Reviewed By: mtrofin

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

3 years ago[lld][WebAssembly] Convert more tests to asm format. NFC
Sam Clegg [Sun, 2 May 2021 04:18:06 +0000 (21:18 -0700)]
[lld][WebAssembly] Convert more tests to asm format. NFC

Two of these are trivial.  The third (shared.s) did have some
expectations changes but only due to two data symbols being re-ordered.

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

3 years ago[libc] Introduce asctime, asctime_r to LLVM libc
Raman Tenneti [Wed, 31 Mar 2021 20:56:41 +0000 (13:56 -0700)]
[libc] Introduce asctime, asctime_r to LLVM libc

[libc] Introduce asctime, asctime_r to LLVM libc

asctime and asctime_r share the same common code. They call asctime_internal
a static inline function.

asctime uses snprintf to return the string representation in a buffer.
It uses the following format (26 characters is the buffer size) as per
7.27.3.1 section in http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2478.pdf.
The buf parameter for asctime_r shall point to a buffer of at least 26 bytes.

snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",...)

Reviewed By: sivachandra

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

3 years ago[gn build] Port 7310403e3cdf
LLVM GN Syncbot [Tue, 4 May 2021 00:04:57 +0000 (00:04 +0000)]
[gn build] Port 7310403e3cdf

3 years ago[demangler] Initial support for the new Rust mangling scheme
Tomasz Miąsko [Mon, 3 May 2021 23:41:30 +0000 (16:41 -0700)]
[demangler] Initial support for the new Rust mangling scheme

Add a demangling support for a small subset of a new Rust mangling
scheme, with complete support planned as a follow up work.

Intergate Rust demangling into llvm-cxxfilt and use llvm-cxxfilt for
end-to-end testing. The new Rust mangling scheme uses "_R" as a prefix,
which makes it easy to disambiguate it from other mangling schemes.

The public API is modeled after __cxa_demangle / llvm::itaniumDemangle,
since potential candidates for further integration use those.

Reviewed By: dblaikie

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

3 years ago[lld][WebAssembly] Do not merge comdat data segments
Sam Clegg [Sat, 1 May 2021 22:37:40 +0000 (15:37 -0700)]
[lld][WebAssembly] Do not merge comdat data segments

When running in relocatable mode any input data segments that are part
of a comdat group should not be merged with other segments of the same
name.  This is because the final linker needs to keep the separate so
they can be included/excluded individually.

Often this is not a problem since normally only one section with a given
name `foo` ends up in the output object file.  However, the problem
occurs when one input contains `foo` which part of a comdat and another
object contains a local symbol `foo` we were attempting to merge them.

This behaviour matches (I believe) that of the ELF linker.  See
`LinkerScript.cpp:addInputSec`.

Fixes: https://github.com/emscripten-core/emscripten/issues/9726

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

3 years agoRecommit "Generalize getInvertibleOperand recurrence handling slightly"
Philip Reames [Mon, 3 May 2021 23:35:47 +0000 (16:35 -0700)]
Recommit "Generalize getInvertibleOperand recurrence handling slightly"

This was reverted because of a reported problem.  It turned out this patch didn't introduce said problem, it just exposed it more widely.  15a4233 fixes the root issue, so this simple a) rebases over that, and b) adds a much more extensive comment explaining why that weakened assert is correct.

Original commit message follows:

Follow up to D99912, specifically the revert, fix, and reapply thereof.

This generalizes the invertible recurrence logic in two ways:
* By allowing mismatching operand numbers of the phi, we can recurse through a pair of phi recurrences whose operand orders have not been canonicalized.
* By allowing recurrences through operand 1, we can invert these odd (but legal) recurrence.

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

3 years ago[NewPM] Invalidate AAManager after populating GlobalsAA
Arthur Eubanks [Tue, 27 Apr 2021 15:56:11 +0000 (08:56 -0700)]
[NewPM] Invalidate AAManager after populating GlobalsAA

GlobalsAA is only created at the beginning of the inliner pipeline.  If
an AAManager is cached from previous passes, it won't get rebuilt to
include the newly created GlobalsAA.

Reviewed By: mtrofin

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

3 years ago[Attributor] Add AAExecutionDomainInfo interface to OpenMPOpt
Joseph Huber [Wed, 28 Apr 2021 20:22:53 +0000 (16:22 -0400)]
[Attributor] Add AAExecutionDomainInfo interface to OpenMPOpt

Summary:
Add the AAExecutionDomainInfo attributor instance to OpenMPOpt.
This will infer information relating to domain information that an
instruction might be expecting in. Right now this only includes a very
crude check for instructions that will be executed by the master thread
by comparing a thread-id function with a constant zero.

Reviewed By: jdoerfert

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