Gongyu Deng [Mon, 11 May 2020 13:21:37 +0000 (15:21 +0200)]
Complete breakpoint enable/disable/delete/modify with a list of breakpoint IDs
Summary:
1. A new common completion `CommandCompletions::Breakpoints` to provide a list of the breakpoints of the current context;
2. Apply the completion above to the commands breakpoint enable/disable/delete/modify;
3. Unit test.
Reviewers: teemperor, JDevlieghere
Reviewed By: teemperor
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D79666
Alex Zinenko [Mon, 11 May 2020 13:00:48 +0000 (15:00 +0200)]
[mlir] NFC: Rename LoopOps dialect to SCF (Structured Control Flow)
This dialect contains various structured control flow operaitons, not only
loops, reflect this in the name. Drop the Ops suffix for consistency with other
dialects.
Note that this only moves the files and changes the C++ namespace from 'loop'
to 'scf'. The visible IR prefix remains the same and will be updated
separately. The conversions will also be updated separately.
Differential Revision: https://reviews.llvm.org/D79578
Kirill Bobyrev [Mon, 11 May 2020 10:27:49 +0000 (12:27 +0200)]
[clangd] Fix remote index build for macOS with Homebrew-installed gRPC and Protobuf
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79387
Tyker [Mon, 11 May 2020 09:50:35 +0000 (11:50 +0200)]
[AssumeBundles] fix crashes
Summary:
this patch fixe crash/asserts found in the test-suite.
the AssumeptionCache cannot be assumed to have all assumes contrary to what i tought.
prevent generation of information for terminators, because this can create broken IR in transfromation where we insert the new terminator before removing the old one.
Reviewers: jdoerfert
Reviewed By: jdoerfert
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79458
OCHyams [Thu, 7 May 2020 11:41:20 +0000 (12:41 +0100)]
[NFC][DwarfDebug] Add test for variables with a single location which
don't span their entire scope.
The previous commit (
6d1c40c171e) is an older version of the test.
Reviewed By: aprantl, vsk
Differential Revision: https://reviews.llvm.org/D79573
OCHyams [Thu, 7 May 2020 11:41:20 +0000 (12:41 +0100)]
[NFC][DwarfDebug] Add test for variables with a single location which
don't span their entire scope.
The previous commit (
6d1c40c171e) is an older version of the test.
Reviewed By: aprantl, vsk
Differential Revision: https://reviews.llvm.org/D79573
OCHyams [Mon, 4 May 2020 12:28:07 +0000 (13:28 +0100)]
[NFC][DwarfDebug] Add test for variables with a single location which
don't span their entire scope.
Reviewed By: aprantl, vsk
Differential Revision: https://reviews.llvm.org/D79573
Sander de Smalen [Mon, 11 May 2020 07:52:02 +0000 (08:52 +0100)]
[SveEmitter] Add builtins for svmovlb and svmovlt
These builtins are expanded in CGBuiltin to use intrinsics
for (signed/unsigned) shift left long top/bottom.
Reviewers: efriedma, SjoerdMeijer
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D79579
Kadir Cetinkaya [Sun, 10 May 2020 21:29:27 +0000 (23:29 +0200)]
[clangd] Make version in PublishDiagnosticsParams optional
Summary: We were serializing it no matter what, which was against the spec
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79692
Hanhan Wang [Mon, 11 May 2020 08:29:08 +0000 (01:29 -0700)]
[mlir][StandardToLLVM] Add support for lowering FPToSIOp to LLVM.
Summary: Depends On D79374
Differential Revision: https://reviews.llvm.org/D79455
Hanhan Wang [Mon, 11 May 2020 08:26:57 +0000 (01:26 -0700)]
[mlir][StandardToSPIRV] Add support for lowering FPToSIOp to SPIR-V.
Summary: Depends On D79373
Differential Revision: https://reviews.llvm.org/D79374
Hanhan Wang [Mon, 11 May 2020 08:25:45 +0000 (01:25 -0700)]
[mlir] Add FPToSIOp to Standard dialect.
Summary:
Cast from a value interpreted as floating-point to the corresponding signed
integer value. Similar to an element-wise `static_cast` in C++, performs an
element-wise conversion operation.
Differential Revision: https://reviews.llvm.org/D79373
Djordje Todorovic [Mon, 11 May 2020 07:30:36 +0000 (09:30 +0200)]
[NFC][DwarfDebug] Avoid default capturing when using lambdas
It is bad practice to capture by default (via [&] in this case) when
using lambdas, so we should avoid that as much as possible.
This patch fixes that in the getForwardingRegsDefinedByMI
from DwarfDebug module.
Differential Revision: https://reviews.llvm.org/D79616
Haojian Wu [Mon, 11 May 2020 07:23:32 +0000 (09:23 +0200)]
Add a missing test file for recovery expressions.
The test was missed in
8222107aa9249aada81334c922a2d284042242.
Haojian Wu [Mon, 11 May 2020 07:19:42 +0000 (09:19 +0200)]
Fix -Wunused compiler warning.
Djordje Todorovic [Fri, 8 May 2020 10:04:45 +0000 (12:04 +0200)]
[NFC][DwarfDebug] Prefer explicit to auto type deduction
We should use explicit type instead of auto type deduction when
the type is so obvious. In addition, we remove ambiguity, since auto
type deduction sometimes is not that intuitive, so that could lead
us to some unwanted behavior.
This patch fixes that in the collectCallSiteParameters() from
DwarfDebug module.
Differential Revision: https://reviews.llvm.org/D79624
Haojian Wu [Fri, 8 May 2020 14:13:17 +0000 (16:13 +0200)]
[AST] Preserve the type in RecoveryExprs for broken function calls.
RecoveryExprs are modeled as dependent type to prevent bogus diagnostics
and crashes in clang.
This patch allows to preseve the type for broken calls when the
RecoveryEprs have a known type, e.g. a broken non-overloaded call, a
overloaded call when the all candidates have the same return type, so
that more features (code completion still work on "take2args(x).^") still
work.
However, adding the type is risky, which may result in more clang code being
affected leading to new crashes and hurt diagnostic, and it requires large
effort to minimize the affect (update all sites in clang to handle errorDepend
case), so we add a new flag (off by default) to allow us to develop/test
them incrementally.
This patch also has some trivial fixes to suppress diagnostics (to prevent regressions).
Tested:
all existing tests are passed (when both "-frecovery-ast", "-frecovery-ast-type" flags are flipped on);
Reviewed By: sammccall
Subscribers: rsmith, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79160
Muhammad Omair Javaid [Mon, 11 May 2020 05:18:50 +0000 (10:18 +0500)]
[LLDB] Fix broken testsuite due to Xfail decorators
Following test cases need minor adjustment in order to accomodate xfail
decorator:
lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp
lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp
Xun Li [Mon, 11 May 2020 04:50:32 +0000 (21:50 -0700)]
Remove an unused Module param
Summary:
In D65848 the function getFuncNameInModule was refactored to no longer use module.
This diff removes the parameter and rename the function name to avoid confusion.
Reviewers: wenlei, wmi, davidxl
Reviewed By: wenlei
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79310
Xing GUO [Mon, 11 May 2020 05:02:39 +0000 (13:02 +0800)]
[Object] Remove unused variable after D79560. NFC.
Fangrui Song [Mon, 11 May 2020 00:16:01 +0000 (17:16 -0700)]
[gcov] Implement --stdout -t
gcov by default prints to a .gcov file. With --stdout, stdout is used.
Some summary information is omitted. There is no separator for multiple
source files.
Johannes Doerfert [Fri, 17 Apr 2020 01:32:46 +0000 (20:32 -0500)]
[Attributor] Merge the query set into AbstractAttribute
The old QuerriedAAs contained two vectors, one for required one for
optional dependences (=queries). We now use a single vector and encode
the kind directly in the pointer.
This reduces memory consumption and makes the connection between
abstract attributes and their dependences clearer.
No functional change is intended, changes in the test are due to
different order in the query map. Neither the order before nor now is in
any way special.
---
Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):
Before:
```
calls to allocation functions: 543734 (329735/s)
temporary memory allocations: 105895 (64217/s)
peak heap memory consumption: 19.19MB
peak RSS (including heaptrack overhead): 102.26MB
total memory leaked: 269.10KB
```
After:
```
calls to allocation functions: 513292 (341511/s)
temporary memory allocations: 106028 (70544/s)
peak heap memory consumption: 13.35MB
peak RSS (including heaptrack overhead): 95.64MB
total memory leaked: 269.10KB
```
Difference:
```
calls to allocation functions: -30442 (208506/s)
temporary memory allocations: 133 (-910/s)
peak heap memory consumption: -5.84MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```
---
Reviewed By: uenoku
Differential Revision: https://reviews.llvm.org/D78729
QingShan Zhang [Mon, 11 May 2020 02:41:10 +0000 (02:41 +0000)]
[DAGCombine] Remove the getNegatibleCost to avoid the out of sync with getNegatedExpression
We have the getNegatibleCost/getNegatedExpression to evaluate the cost and negate the expression.
However, during negating the expression, the cost might change as we are changing the DAG,
and then, hit the assertion if we negated the wrong expression as the cost is not trustful anymore.
This patch is target to remove the getNegatibleCost to avoid the out of sync with getNegatedExpression,
and check the cost during negating the expression. It also reduce the duplicated code between
getNegatibleCost and getNegatedExpression. And fix the crash for the test in D76638
Reviewed By: RKSimon, spatel
Differential Revision: https://reviews.llvm.org/D77319
Muhammad Omair Javaid [Mon, 11 May 2020 02:01:39 +0000 (07:01 +0500)]
[LLDB] Decorate tests failing on arm-linux buildbot
Tests impacted by these decorators fail on arm-linux-gnueabihf.
These have been triaged and appropriate bugs have been filed.
Muhammad Omair Javaid [Sun, 10 May 2020 23:44:57 +0000 (04:44 +0500)]
Remove XFAIL arm-linux decorator from passing tests
Muhammad Omair Javaid [Sun, 10 May 2020 23:40:23 +0000 (04:40 +0500)]
XFAIL NativePDB tests on arm-linux
NativePDB tests fail on arm-linux buildbot. clang-cl driver crashes with
-m32 option. Bug files http://llvm.org/pr45867
Fangrui Song [Mon, 11 May 2020 01:21:18 +0000 (18:21 -0700)]
[X86] Fix combineVectorCompareAndMaskUnaryOp regression after
0e8e731449d8fbfa6ba4523de928b4812ef9f100
Lang Hames [Mon, 11 May 2020 00:33:48 +0000 (17:33 -0700)]
[examples] Fix the SpeculativeJIT and ThinLtoJIT examples for
41379f1ec46.
Nico Weber [Mon, 11 May 2020 00:15:29 +0000 (20:15 -0400)]
Remove a comment that is no longer true after
d03838343f2.
Nico Weber [Mon, 11 May 2020 00:13:05 +0000 (20:13 -0400)]
Remove a variable write that is not needed after
d03838343f2.
Johannes Doerfert [Sat, 9 May 2020 17:48:29 +0000 (12:48 -0500)]
[Attributor][FIX] Carefully handle/ignore/forget `argmemonly`
When we have an existing `argmemonly` or `inaccessiblememorargmemonly`
we used to "know" that information. However, interprocedural constant
propagation can invalidate these attributes. We now ignore and remove
these attributes for internal functions (which may be affected by IP
constant propagation), if we are deriving new attributes for the
function.
Johannes Doerfert [Sun, 10 May 2020 04:29:43 +0000 (23:29 -0500)]
[Attributor] Use "simplify to constant" in genericValueTraversal
As we replace values with constants interprocedurally, we also need to
do this "look-through" step during the generic value traversal or we
would derive properties from replaced values. While this is often not
problematic, it is when we use the "kind" of a value for reasoning,
e.g., accesses to arguments allow `argmemonly`.
Johannes Doerfert [Sun, 10 May 2020 21:53:07 +0000 (16:53 -0500)]
[Attributor] Ignore illegal accesses to `null`
When we categorize a pointer value we bailed at `null` before. If we
know `null` is not a valid memory location we can ignore it as there
won't be an access at all.
Johannes Doerfert [Sun, 10 May 2020 18:16:49 +0000 (13:16 -0500)]
[Attributor] Use existing helpers to determine IR facts
We now use getPointerDereferenceableBytes to determine `nonnull` and
`dereferenceable` facts from the IR. We also use getPointerAlignment in
AAAlign for the same reason. The latter can interfere with callbacks so
we do restrict it to non-function-pointers for now.
Johannes Doerfert [Sat, 9 May 2020 17:49:39 +0000 (12:49 -0500)]
[Attributor][NFC] Clang format Attributor*.cpp
Lang Hames [Sun, 10 May 2020 18:34:04 +0000 (11:34 -0700)]
[ORC] Share ownership of JITDylibs between ExecutionSession and
MaterializationResponsibility.
MaterializationResponsibility objects provide a connection between a
materialization process (compiler, jit linker, etc.) and the JIT state held in
the ExecutionSession and JITDylib objects. Switching to shared ownership
extends the lifetime of JITDylibs to ensure they remain accessible until all
materializers targeting them have completed. This will allow (in a follow-up
patch) JITDylibs to be removed from the ExecutionSession and placed in a
pending-destruction state while they are kept alive to communicate errors
to/from any still-runnning materialization processes. The intent is to enable
JITDylibs to be safely removed even if they have running compiles targeting
them.
Fangrui Song [Sun, 10 May 2020 19:47:45 +0000 (12:47 -0700)]
[gcov] Default coverage version to '407*' and delete CC1 option -coverage-cfg-checksum
Defaulting to -Xclang -coverage-version='407*' makes .gcno/.gcda
compatible with gcov [4.7,8)
In addition, delete clang::CodeGenOptionsBase::CoverageExtraChecksum and GCOVOptions::UseCfgChecksum.
We can infer the information from the version.
With this change, .gcda files produced by `clang --coverage a.o` linked executable can be read by gcov 4.7~7.
We don't need other -Xclang -coverage* options.
There may be a mismatching version warning, though.
(Note, GCC r173147 "split checksum into cfg checksum and line checksum"
made gcov 4.7 incompatible with previous versions.)
Ricky Zhou [Sun, 10 May 2020 20:51:01 +0000 (16:51 -0400)]
[examples] Fix llvm.memset prototype in BrainF example.
Commit
1e68724d24ba38de7c7cdb2e1939d78c8b37cc0d removed the alignment
argument from the memset intrinsic. Update the BrainF example to match.
Reviewed By: jyknight
Differential Revision: https://reviews.llvm.org/D79601
Matt Arsenault [Sun, 10 May 2020 19:27:40 +0000 (15:27 -0400)]
AMDGPU/GlobalISel: Remove -global-isel-abort=0 from tests
Richard Smith [Sun, 10 May 2020 21:13:25 +0000 (14:13 -0700)]
Fix clangd test that depended on a diagnostic removed in Clang.
Richard Smith [Sun, 10 May 2020 20:58:42 +0000 (13:58 -0700)]
Enforce the C++11 anonymous enum bitfields check even for
Objective-C++11 and under MS extensions.
This matches the MSVC behavior, and means that Objective-C behaves as a
set of extensions to the base language, rather than replacing the base
language rule with a different one.
Richard Smith [Sun, 10 May 2020 20:39:23 +0000 (13:39 -0700)]
Fix typo in enum-base disambiguation.
Martin Storsjö [Fri, 8 May 2020 08:01:09 +0000 (11:01 +0300)]
[LLD] [COFF] Fix def file exporting of symbols containing periods
This fixes an accidental breakage of exporting symbols using def
files, when the symbol name contains a period, since commit
0ca06f7950e5, mixing up a symbol name containing a period with
the case of exporting a symbol as a forward to another dll.
Differential Revision: https://reviews.llvm.org/D79619
Richard Smith [Sun, 10 May 2020 20:14:51 +0000 (13:14 -0700)]
Properly implement 'enum class' parsing.
The 'class' or 'struct' keyword is only permitted as part of either an
enum definition or a standalone opaque-enum-declaration, not as part of
an elaborated type specifier. We previously failed to diagnose this, and
generally didn't properly implement the restrictions on elaborated type
specifiers for enumeration types.
In passing, also fixed incorrect parsing for enum-bases, which we
previously parsed as a type-name, but are actually a type-specifier-seq.
This matters for cases like 'enum E : int *p;', which is valid as a
Microsoft extension.
Plus some minor parse diagnostic improvements.
Bumped the recently-added ExtWarn for 'enum E : int x;' to be
DefaultError; this is not an intentional extension, so producing an
error by default seems appropriate, but the warning flag to disable it
may still be useful for code written against old Clang. The same
treatment is given here to the diagnostic for 'enum class E x;', which
we similarly have incorrectly accepted for many years. These diagnostics
continue to be suppressed under -fms-extensions and when compiling
Objective-C code. We will need to decide separately whether Objective-C
should follow the C++ rules or the (older) MSVC rules.
Fangrui Song [Sun, 10 May 2020 17:50:20 +0000 (10:50 -0700)]
[gcov] Delete CC1 option -coverage-no-function-names-in-data
rL144865 incorrectly wrote function names for GCOV_TAG_FUNCTION
(this might be part of the reasons the header says
"We emit files in a corrupt version of GCOV's "gcda" file format").
rL176173 and rL177475 realized the problem and introduced -coverage-no-function-names-in-data
to work around the issue. (However, the description is wrong.
libgcov never writes function names, even before GCC 4.2).
In reality, the linker command line has to look like:
clang --coverage -Xclang -coverage-version='407*' -Xclang -coverage-cfg-checksum -Xclang -coverage-no-function-names-in-data
Failing to pass -coverage-no-function-names-in-data can make gcov 4.7~7
either produce wrong results (for one gcov-4.9 program, I see "No executable lines")
or segfault (gcov-7).
(gcov-8 uses an incompatible format.)
This patch deletes -coverage-no-function-names-in-data and the related
function names support from libclang_rt.profile
Craig Topper [Sun, 10 May 2020 08:32:56 +0000 (01:32 -0700)]
[X86] Add a few more shuffles to hasUndefRegUpdate.
Mostly found by asserting on tests that have undef operands. I'm
sure this isn't an exhaustive list.
Tyker [Sun, 10 May 2020 17:26:41 +0000 (19:26 +0200)]
[AssumeBundles] Remove non-determinisme from assume builder
Summary:
The assume builder was non-deterministic when working on unamed values.
this patch fixes this.
Reviewers: jdoerfert
Reviewed By: jdoerfert
Subscribers: hiraditya, mgrang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78616
Andrea Di Biagio [Sun, 10 May 2020 17:55:58 +0000 (18:55 +0100)]
[MCA][InstrBuilder] Correctly mark reserved resources in initializeUsedResources.
This fixes a bug reported by Alex Renda on LLVMDev where mca did not correctly
mark a resource group as "reserved".
(See http://lists.llvm.org/pipermail/llvm-dev/2020-May/141485.html).
The issue was caused by a wrong check in function `initializeUsedResources`.
As a consequence of this, a resource group was left unreserved, and its field
`NumUnits` incorrectly reported an unrealistic number of consumed resource
units.
This patch fixes the issue with the handling of reserved resources in the
InstrBuilder class, and adds a simple test for it. Ideally, as suggested by
Andy Trick, most of these problems will disappear if in the future we will
introduce a (optional) DelayCycles vector for SchedWriteRes.
Fangrui Song [Sun, 10 May 2020 18:17:17 +0000 (11:17 -0700)]
[gcov] Temporarily unsupport host-byteorder-big-endian
Fangrui Song [Sun, 10 May 2020 18:01:06 +0000 (11:01 -0700)]
[compiler-rt][test] Add feature host-byteorder-big-endian
This is needed to make
5a9b792d7251e19f69f96c9619cde49497c79a07 "[gcov] Temporarily unsupport host-byteorder-big-endian"
work.
Fangrui Song [Sun, 10 May 2020 17:26:10 +0000 (10:26 -0700)]
[gcov] Temporarily unsupport host-byteorder-big-endian
llvm-cov gcov does not support host-byteorder-big-endian yet.
Tyker [Sun, 10 May 2020 16:20:34 +0000 (18:20 +0200)]
[AssumeBundles] Prevent generation of some redundant assumes
Summary: with this patch the assume salvageKnowledge will not generate assume if all knowledge is already available in an assume with valid context. assume bulider can also in some cases update an existing assume with better information.
Reviewers: jdoerfert
Reviewed By: jdoerfert
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78014
Fangrui Song [Sun, 10 May 2020 17:12:26 +0000 (10:12 -0700)]
[gcov] Don't skip leading zeros when reading a string
Even a 2003 version of gcov_read_string does not have the behavior
described by rL204881. The wrong impression might come from
libclang_rt.profile (GCDAProfiling.c)'s corrupted output (since the
initial import rL144865). Note, the corrupted output crashes gcov.
Fangrui Song [Sat, 9 May 2020 17:36:34 +0000 (10:36 -0700)]
[gcov] Fix .gcda decoding and support GCC 8, 9 and 10
GCDAProfiling.c unnecessarily writes function names to .gcda files.
GCC 4.2 gcc/libgcov.c (now renamed to libgcc/libgcov*) did not write function
names. gcov-7 (compatible) crashes on .gcda produced by libclang_rt.profile
rL176173 realized the problem and introduced a mode to remove function
names.
llvm-cov code apparently takes GCDAProfiling.c output format as truth
and tries to decode function names. Additionally, llvm-cov tries to
decode tags in certain order which does not match libgcov emitted .gcda
files.
This patch fixes the .gcda decoder and makes it work with GCC 8 and 9
(10 is compatible with 9). Note, line statistics are broken and not
fixed by this patch.
Add test/tools/llvm-cov/gcov-{4.7,8,9}.c to test compatibility.
Florian Hahn [Sun, 10 May 2020 15:48:06 +0000 (16:48 +0100)]
[LAA] Move runtime-check generation to Transforms/Utils/loopUtils (NFC)
Currently LAA's uses of ScalarEvolutionExpander blocks moving the
expander from Analysis to Transforms. Conceptually the expander does not
fit into Analysis (it is only used for code generation) and
runtime-check generation also seems to be better suited as a
transformation utility.
Reviewers: Ayal, anemet
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D78460
Simon Pilgrim [Sun, 10 May 2020 15:59:39 +0000 (16:59 +0100)]
CodeMetrics.cpp - remove unused includes. NFC.
Simon Pilgrim [Sun, 10 May 2020 15:58:34 +0000 (16:58 +0100)]
LoopUtils.h - remove unused forward declarations. NFC.
Simon Pilgrim [Sun, 10 May 2020 15:57:46 +0000 (16:57 +0100)]
Local.h - remove unused forward declaration. NFC.
Sanjay Patel [Sun, 10 May 2020 15:37:47 +0000 (11:37 -0400)]
[InstCombine] canonicalize bitcast after insertelement into undef
We have a transform in the opposite direction only for the x86 MMX type,
Other types are not handled either way before this patch.
The motivating case from PR45748:
https://bugs.llvm.org/show_bug.cgi?id=45748
...is the last test diff. In that example, we are triggering an existing
bitcast transform, so we reduce the number of casts, and that should give
us the ideal x86 codegen.
Differential Revision: https://reviews.llvm.org/D79171
Sanjay Patel [Sun, 10 May 2020 15:25:37 +0000 (11:25 -0400)]
[CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC
This test would break with the proposed change to IR canonicalization
in D79171.
The test tried to do the right thing by only using -mem2reg with opt,
but it was using -O3 before that step, so the opt part was meaningless.
Sanjay Patel [Sun, 10 May 2020 15:19:43 +0000 (11:19 -0400)]
[CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC
This test would break with the proposed change to IR canonicalization
in D79171. The raw unoptimized IR from clang is massive, so I've
replaced -instcombine with -mem2reg to make it more manageable,
but still be unlikely to break with unrelated changed to optimization.
Simon Pilgrim [Sun, 10 May 2020 15:00:13 +0000 (16:00 +0100)]
[InstCombine] matchOrConcat - match BITREVERSE
Fold or(zext(bitreverse(x)),shl(zext(bitreverse(y)),bw/2) -> bitreverse(or(zext(x),shl(zext(y),bw/2))
Practically this is the same as the BSWAP pattern so we might as well handle it.
Florian Hahn [Sun, 10 May 2020 14:04:49 +0000 (15:04 +0100)]
Recommit "[LAA] Remove one addRuntimeChecks function (NFC)."
The failing assertion has been fixed and the problematic test case has
been added.
This reverts the revert commit
fc44617f28847417e55836193bbe8e9c3f09eca9.
Simon Pilgrim [Sun, 10 May 2020 13:22:02 +0000 (14:22 +0100)]
PassInstrumentation.h - reduce TypeName.h include to StringRef forward declaration. NFC.
Simon Pilgrim [Sun, 10 May 2020 13:19:54 +0000 (14:19 +0100)]
CoverageMapping.h - remove unused StringSet.h include. NFC.
Simon Pilgrim [Sun, 10 May 2020 13:17:52 +0000 (14:17 +0100)]
PassManager.h - remove unused raw_ostream.h include. NFC.
Simon Pilgrim [Sun, 10 May 2020 13:03:13 +0000 (14:03 +0100)]
Mangler.h - reduce GlobalValue.h include to forward declaration. NFC.
Exposes implicit dependency in ModuleSymbolTable.h - added missing Module forward declaration.
Simon Pilgrim [Sun, 10 May 2020 13:01:26 +0000 (14:01 +0100)]
LoopPass.h - remove unnecessary PMStack forward declaration. NFC.
We have to include LegacyPassManagers.h where its defined.
Florian Hahn [Sun, 10 May 2020 12:27:10 +0000 (13:27 +0100)]
Revert "[LAA] Remove one addRuntimeChecks function (NFC)."
This reverts commit
c28114c8ffde705d7e16cd4c065fd23269661c81.
This causes some bots to fail:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/30596/steps/build%20android%2Faarch64/logs/stdio
Alex Zinenko [Sun, 10 May 2020 12:14:10 +0000 (14:14 +0200)]
[mlir] Affine dim and symbol checkers: support detached regions
Functions checking whether an SSA value is a valid dimension or symbol for
affine operations can be called on values defined in a detached region (a
region that is not yet attached to an operation), for example, during parsing
or operation construction. These functions will attempt to uncondtionally
dereference a pointer to the parent operation of a region, which may be null
(as fixed by the previous commit, uninitialized before that). Since one cannot
know to which operation a region will be attached, conservatively this
operation would not be a valid affine scope and act accordingly, instead of
crashing.
Alex Zinenko [Sun, 10 May 2020 12:14:04 +0000 (14:14 +0200)]
[mlir] Initialize the Region::container field to nullptr by default
Region has a default constructor that is called when a region is constructed
while an operation is being created, and therefore before the region can be
attached to this operation. The `container` field is uninitialized, which makes
it impossible to check programmatically if a Region is attached to an operation
or not, leading to sly memory errors when this field is read. Initialize it to
nullptr by default and thus make sure one can check if a region is attached to
an operation or not.
Florian Hahn [Sun, 10 May 2020 11:26:33 +0000 (12:26 +0100)]
[LAA] Remove one addRuntimeChecks function (NFC).
In order to reduce the API surface area (preparation for D78460), remove
a addRuntimeChecks() function and do the additional check in the single
caller.
Reviewers: Ayal, anemet
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D79679
Sanjay Patel [Sun, 10 May 2020 10:59:30 +0000 (06:59 -0400)]
[InstCombine] fold fpext into exact integer-to-FP cast
We can combine a floating-point extension cast with a conversion
from integer if we know the earlier cast is exact.
This is an optimization suggested in PR36617:
https://bugs.llvm.org/show_bug.cgi?id=36617#c19
However, this patch does not change the example suggested there.
This patch only uses the existing analysis to handle cases where
the integer source value magnitude is narrower than the
intermediate FP mantissa (guarantees that the conversion to FP is
exact). Follow-up patches to the analysis function can enable
more cases.
Differential Revision: https://reviews.llvm.org/D79116
LLVM GN Syncbot [Sun, 10 May 2020 11:04:15 +0000 (11:04 +0000)]
[gn build] Port
35d867a790c
Kadir Cetinkaya [Sat, 9 May 2020 10:34:06 +0000 (12:34 +0200)]
[clangd] Filter pch related flags coming from the user
Summary:
PCH format is unstable, hence using a preamble built with a different
version of clang (or even worse, a different compiler) might result in
unexpected behaviour.
PCH creation on the other hand is something clangd wouldn't want to perform, as
it doesn't generate any output files.
This patch makes sure clangd drops any PCH related compile commands after
parsing the command line args.
Fixes https://github.com/clangd/clangd/issues/248
Reviewers: sammccall
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79669
David Zarzycki [Sun, 10 May 2020 09:51:14 +0000 (05:51 -0400)]
[libcxx testing] Remove ALLOW_RETRIES from sleep_until.pass.cpp
Operating systems are best effort by default, so we cannot assume that
sleep-like APIs return as soon as we'd like.
Even if a sleep-like API returns when we want it to, the potential for
preemption means that attempts to measure time are subject to delays.
Sylvestre Ledru [Sun, 10 May 2020 09:26:53 +0000 (11:26 +0200)]
Revert two patches, not ready to be shared
Revert "clang-tidy doc: add a note for checkers with an autofix"
This reverts commit
dc0f79ea5b99b9609a21c29089c294ab82d88094.
Revert "add_new_check.py: Update of the template to add an autofix section"
This reverts commit
f97f92e5b0fd14240c2ec27c44e1b3cfddfdf668.
Sylvestre Ledru [Sun, 10 May 2020 09:22:53 +0000 (11:22 +0200)]
clang-tidy doc: Fix the syntax to use rst list type
Sylvestre Ledru [Mon, 13 Apr 2020 20:33:11 +0000 (22:33 +0200)]
clang-tidy doc: add a note for checkers with an autofix
Summary:
Currently, when looking at a checker documentation, we have to go back
to the whole list or look at the sources to figure out if an autofix
is available or not.
Reviewers: alexfh, aaron.ballman
Subscribers: wuzish, Eugene.Zelenko, nemanjai, kbarton, arphaman, Charusso, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77983
Sylvestre Ledru [Mon, 13 Apr 2020 20:22:19 +0000 (22:22 +0200)]
add_new_check.py: Update of the template to add an autofix section
Summary: As discussed here: https://reviews.llvm.org/D77983
Reviewers: alexfh
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78052
Jez Ng [Sun, 10 May 2020 09:22:33 +0000 (02:22 -0700)]
[lld-macho] Delete dylink-lazy test for now
Summary: It's breaking Windows builds
Jez Ng [Sun, 10 May 2020 07:22:36 +0000 (00:22 -0700)]
[lld-macho] Try to unbreak dylink-lazy test on Windows
Arthur Eubanks [Sat, 9 May 2020 03:19:05 +0000 (20:19 -0700)]
Add missing pass initialization
Summary: This was preventing MemorySanitizerLegacyPass from appearing in --print-after-all.
Reviewers: vitalybuka
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79661
Jez Ng [Mon, 27 Apr 2020 19:59:20 +0000 (12:59 -0700)]
[lld-macho] Support pc-relative section relocations
Summary: So far we've only supported symbol relocations.
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79211
Jez Ng [Thu, 23 Apr 2020 03:00:57 +0000 (20:00 -0700)]
[lld-macho] Use export trie instead of symtab when linking against dylibs
Summary:
This allows us to link against stripped dylibs. Moreover, it's simply
more correct: The symbol table includes symbols that the dylib uses but
doesn't export.
This temporarily regresses our ability to do lazy symbol binding because
dyld_stub_binder isn't in libSystem's export trie. Rather, it is in one
of the sub-libraries libSystem re-exports. (This doesn't affect our
tests since we are mocking out dyld_stub_binder there.) A follow-up diff
will address this by adding support for sub-libraries.
Depends on D79114.
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79226
Jez Ng [Wed, 29 Apr 2020 12:30:47 +0000 (05:30 -0700)]
[lld-macho] Dylib symbols should always replace undefined symbols
Summary:
Otherwise we get undefined symbol errors depending on the order of
arguments on the command line.
Depends on D78270.
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79114
Jez Ng [Wed, 6 May 2020 00:38:10 +0000 (17:38 -0700)]
[lld-macho] Support calls to functions in dylibs
Summary:
This diff implements lazy symbol binding -- very similar to the PLT
mechanism in ELF.
ELF's .plt section is broken up into two sections in Mach-O:
StubsSection and StubHelperSection. Calls to functions in dylibs will
end up calling into StubsSection, which contains indirect jumps to
addresses stored in the LazyPointerSection (the counterpart to ELF's
.plt.got).
Initially, the LazyPointerSection contains addresses that point into one
of the entry points in the middle of the StubHelperSection. The code in
StubHelperSection will push on the stack an offset into the
LazyBindingSection. The push is followed by a jump to the beginning of
the StubHelperSection (similar to PLT0), which then calls into
dyld_stub_binder. dyld_stub_binder is a non-lazily bound symbol, so this
call looks it up in the GOT.
The stub binder will look up the bind opcodes in the LazyBindingSection
at the given offset. The bind opcodes will tell the binder to update the
address in the LazyPointerSection to point to the symbol, so that
subsequent calls don't have to redo the symbol resolution. The binder
will then jump to the resolved symbol.
Depends on D78269.
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78270
Jez Ng [Wed, 6 May 2020 00:25:58 +0000 (17:25 -0700)]
[lld-macho] Follow-up to D77893
Summary:
1. Don't have isHidden() depend on isNeeded(). Whether a section is
hidden is orthogonal from whether it is needed: hidden sections will
never have a header regardless of whether they have a body. (I know we
override this method with return false for synthetic sections, but
regardless I think it's confusing to write it this way for non-synthetic
sections.)
2. Don't call writeTo() on unneeded sections. D78270 assumes that this
is true when implementing the stub helper section.
3. Filter out the unneeded sections early on to avoid having to deal
with them in multiple places.
4. Remove assumption in test that the referenced file has no other symbols.
(We should create separate input files for future tests to avoid such
issues.)
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79460
Jinsong Ji [Sun, 10 May 2020 02:33:57 +0000 (02:33 +0000)]
[sanitizer] Enable whitelist/blacklist in new PM
https://reviews.llvm.org/D63616 added `-fsanitize-coverage-whitelist`
and `-fsanitize-coverage-blacklist` for clang.
However, it was done only for legacy pass manager.
This patch enable it for new pass manager as well.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D79653
Craig Topper [Sun, 10 May 2020 00:04:34 +0000 (17:04 -0700)]
[X86] Add test cases for vXi16 PMULH opportunities that don't end in truncate.
We already have matching for extend+mul+shift+trunc. But we could
also match up to the shift without the truncate and just extend the
result. That would still be a savings.
Matt Arsenault [Sun, 29 Mar 2020 22:04:53 +0000 (18:04 -0400)]
GlobalISel: Handle more cases in lowerUnmergeValues
Handle scalar sources, as well as vectors.
Craig Topper [Sat, 9 May 2020 22:33:08 +0000 (15:33 -0700)]
[BreakFalseDeps] Harden pickBestRegisterForUndef against changing tied operands or physical registers that aren't renamable.
I don't have any test cases since X86 doesn't return any tied
operands from getUndefRegClearance today. But conceivably we could
want BreakFalseDeps to insert a dependency breaking XOR for
a tied operand in the future.
Florian Hahn [Sat, 9 May 2020 21:07:51 +0000 (22:07 +0100)]
[LAA] Remove unneeded PtrRtChecking argument (NFC).
The argument is not required and simplifies D78460 a bit.
Simon Pilgrim [Sat, 9 May 2020 21:09:01 +0000 (22:09 +0100)]
[X86] isVectorShiftByScalarCheap - don't limit fast XOP vector shifts to 128-bit vectors
XOP targets have fast per-element vector shifts and we're better off splitting to 128-bit shifts where necessary (which is what we already do in LowerShift).
Petr Hosek [Sat, 9 May 2020 20:44:20 +0000 (13:44 -0700)]
[Clang] Pass -z max-page-size to linker for Fuchsia
Currently all Fuchsia ABIs use a 4k page size, departing from
the recommended page sizes in the respective psABI documents.
Differential Revision: https://reviews.llvm.org/D79667
Petr Hosek [Sat, 9 May 2020 20:42:19 +0000 (13:42 -0700)]
[Clang] Pass --pack-dyn-relocs=relr to lld for Fuchsia
The compact format is fully supported on Fuchsia and is the
preferred default.
Patch By: mcgrathr
Differential Revision: https://reviews.llvm.org/D79665
Matt Arsenault [Sun, 29 Mar 2020 19:51:54 +0000 (15:51 -0400)]
GlobalISel: Move code into lowering for G_MERGE_VALUES
Currently this code exists in widenScalar for G_MERGE_VALUE
sources. I'm not sure if the existing expansion in widenScalar should
be removed or not. The widenScalar variant tries to extend to the
requested size, but this just uses the original bitwidth.
Matt Arsenault [Sat, 4 Apr 2020 19:07:28 +0000 (15:07 -0400)]
GlobalISel: Combine G_UNMERGE_VALUES with G_TRUNC
G_BITCAST can be lowered with a pair of G_UNMERGE_VALUES and
G_MERGE_VALUES with different types, but G_UNMERGE_VALUES of a vector
can also be implemented with a bitcast to a scalar, which introduces
the possibility for infinite loops. Try to eliminate an illegal source
register type in the artifact combiner to avoid this from happening.
Avoids infinite looping in the legalizer in a future patch which
allows lowering G_UNMERGE_VALUES of a vector source with a G_BITCAST.
Matt Arsenault [Fri, 8 May 2020 19:35:41 +0000 (15:35 -0400)]
InstCombine: Broaden copy-constant-to-alloca optimization
Consider any constant memory type, not just global constants. AMDGPU
kernel parameters are effectively global constants, but appear as
either reads from an intrinsic derived pointer or function argument.
Matt Arsenault [Wed, 6 May 2020 00:25:03 +0000 (20:25 -0400)]
Fix typo