Fangrui Song [Sun, 19 Jul 2020 04:01:41 +0000 (21:01 -0700)]
[Driver] --print-search-dirs: print -B options and COMPILER_PATH
Fangrui Song [Sun, 19 Jul 2020 03:26:01 +0000 (20:26 -0700)]
[Driver] -B: don't search for target triple prefixes
To match GCC (either crossing or not), which doesn't prepend target triple prefixes to `exec_prefixes`.
As an example, powerpc64le-linux-gnu-gcc does not search "powerpc64le-linux-gnu-${name}" in a -B path.
Mehdi Amini [Sat, 18 Jul 2020 22:21:29 +0000 (22:21 +0000)]
Fix invalid link in the MLIR Standard Dialect www page (2nd attempt)
Fangrui Song [Sat, 18 Jul 2020 22:07:46 +0000 (15:07 -0700)]
[gcov] Add __gcov_dump/__gcov_reset and delete __gcov_flush
GCC r187297 (2012-05) introduced `__gcov_dump` and `__gcov_reset`.
`__gcov_flush = __gcov_dump + __gcov_reset`
The resolution to https://gcc.gnu.org/PR93623 ("No need to dump gcdas when forking" target GCC 11.0) removed the unuseful and undocumented __gcov_flush.
Close PR38064.
Reviewed By: calixte, serge-sans-paille
Differential Revision: https://reviews.llvm.org/D83149
Fangrui Song [Sun, 12 Jul 2020 00:17:21 +0000 (17:17 -0700)]
[gcov][test] Simplify instrprof-dlopen-dlclose-gcov.test
Nikita Popov [Sat, 18 Jul 2020 21:36:42 +0000 (23:36 +0200)]
[InstCombine] Add test for PR46680 (NFC)
Bruno Ricci [Sat, 18 Jul 2020 19:44:06 +0000 (20:44 +0100)]
[clang][NFC] Tests showing the problems with some uses of NamedDecl::getDeclName in diagnostics, SemaOverload.cpp+SemaStmt.cpp part
Bruno Ricci [Sat, 18 Jul 2020 19:39:16 +0000 (20:39 +0100)]
[clang][NFC] Tests showing the problems with some uses of NamedDecl::getDeclName in diagnostics, SemaExpr.cpp part
Bruno Ricci [Sat, 18 Jul 2020 19:35:16 +0000 (20:35 +0100)]
[clang] Provide a more specific diagnostic for a misplaced lambda capture-default.
Currently a capture-default which is not the first element in the lambda-capture
is diagnosed with a generic expected variable name or 'this' in lambda capture
list, which is true but not very helpful.
If we don't have already parsed a capture-default then a lone "&" or "=" is
likely to be a misplaced capture-default, so diagnose it as such.
Differential Revision: https://reviews.llvm.org/D83681
Reviewed By: aaron.ballman
peter klausler [Fri, 17 Jul 2020 18:17:39 +0000 (11:17 -0700)]
[flang] Improve output from a STOP statement
Add a missing newline to IEEE FP flag formatting, and
don't neglect to emit STOP when there's no code number.
Reviewed By: tskeith
Differential Revision: https://reviews.llvm.org/D84060
Fangrui Song [Sat, 18 Jul 2020 18:10:18 +0000 (11:10 -0700)]
[gcov][test] Call wait() to make gcov-fork.c reliable
If the parent exit before the child, the line counts might be 1.
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26: 1: 21: if (fork() == -1) return 1; // CHECK-NEXT: 1: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27: 1: 22: func2(); // CHECK-NEXT: 2: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28: 1: 23: return 0; // CHECK-NEXT: 2: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
peter klausler [Fri, 17 Jul 2020 18:14:28 +0000 (11:14 -0700)]
[flang] Insert leading blanks in LOGICAL formatted output fields
Summary: For Lw output editing, emit (w-1) blanks before the T or the F.
Reviewed By: sscalpone, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D84059
Artem Dergachev [Sat, 18 Jul 2020 02:42:20 +0000 (19:42 -0700)]
[analyzer] scan-build: Fix silencing multiple core checkers.
It was only silencing one checker because -analyzer-config flags
can only carry one value at a time.
Joseph Huber [Sat, 18 Jul 2020 16:00:08 +0000 (12:00 -0400)]
[OpenMP] Add Additional Function Attribute Information to OMPKinds.def
Summary:
This patch adds more function attribute information to the runtime function definitions in OMPKinds.def. The goal is to provide sufficient information about OpenMP runtime functions to perform more optimizations on OpenMP code.
Reviewers: jdoerfert
Subscribers: aaron.ballman cfe-commits yaxunl guansong sstefan1 llvm-commits
Tags: #OpenMP #clang #LLVM
Differential Revision: https://reviews.llvm.org/D81031
Roman Lebedev [Sat, 18 Jul 2020 16:41:21 +0000 (19:41 +0300)]
[NFC][CVP] processSDiv(): pacify gcc compilers
Mehdi Amini [Sat, 18 Jul 2020 16:22:31 +0000 (16:22 +0000)]
Fix dead link on MLIR website
Mehdi Amini [Sat, 18 Jul 2020 16:12:41 +0000 (16:12 +0000)]
Fix Markdown format for lists in the Standard Dialect documentation
This affects the rendering on the website.
Fangrui Song [Sat, 18 Jul 2020 16:07:40 +0000 (09:07 -0700)]
[ELF][test] Update test after DW_EH_PE_sdata4/DW_EH_PE_sdata8 change
Anders Waldenborg [Sat, 18 Jul 2020 15:26:06 +0000 (17:26 +0200)]
[clang-format] Make sure rst documentation matches comments
clang/docs/tools/dump_format_style.py is used to read the comments
from clang/include/clang/Format/Format.h and update the contents of
clang/docs/ClangFormatStyleOptions.rst
Recent changes made these out of date. This commit syncs them by
folding the improved wording back to the comments and then
regenerating the rst file.
Differential Revision: https://reviews.llvm.org/D84103
Fangrui Song [Sat, 18 Jul 2020 15:59:05 +0000 (08:59 -0700)]
[DebugInfo] Respect relocations when decoding DW_EH_PE_sdata4 & DW_EH_PE_sdata8 and support R_ARM_REL32
The addresses in llvm-dwarfdump --eh-frame output for object files are closer to readelf -wf output now.
Florian Hahn [Sat, 18 Jul 2020 14:59:51 +0000 (15:59 +0100)]
[PredicateInfo] Fold PredicateWithCondition into PredicateBase (NFC).
Each concrete instance of a predicate has a condition (also noted in the
original PredicateBase comment) and to me it seems like there is no
clear benefit of having both PredicateBase and PredicateWithCondition
and they can be folded together.
Reviewers: nikic, efriedma
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84089
Roman Lebedev [Sat, 18 Jul 2020 10:23:26 +0000 (13:23 +0300)]
[CVP] Soften SDiv into a UDiv as long as we know domains of both of the operands.
Yes, if operands are non-positive this comes at the extra cost
of two extra negations. But a. division is already just
ridiculously costly, two more subtractions can't hurt much :)
and b. we have better/more analyzes/folds for an unsigned division,
we could end up narrowing it's bitwidth, converting it to lshr, etc.
This is essentially a take two on
0fdcca07ad2c0bdc2cdd40ba638109926f4f513b,
which didn't fix the potential regression i was seeing,
because ValueTracking's computeKnownBits() doesn't make use
of dominating conditions in it's analysis.
While i could teach it that, this seems like the more general fix.
This big hammer actually does catch said potential regression.
Over vanilla test-suite + RawSpeed + darktable
(10M IR instrs, 1M IR BB, 1M X86 ASM instrs), this fires/converts 5 more
(+2%) SDiv's, the total instruction count at the end of middle-end pipeline
is only +6, so out of +10 extra negations, ~half are folded away,
and asm instr count is only +1, so practically speaking all extra
negations are folded away and are therefore free.
Sadly, all these new UDiv's remained, none folded away.
But there are two less basic blocks.
https://rise4fun.com/Alive/VS6
Name: v0
Pre: C0 >= 0 && C1 >= 0
%r = sdiv i8 C0, C1
=>
%r = udiv i8 C0, C1
Name: v1
Pre: C0 <= 0 && C1 >= 0
%r = sdiv i8 C0, C1
=>
%t0 = udiv i8 -C0, C1
%r = sub i8 0, %t0
Name: v2
Pre: C0 >= 0 && C1 <= 0
%r = sdiv i8 C0, C1
=>
%t0 = udiv i8 C0, -C1
%r = sub i8 0, %t0
Name: v3
Pre: C0 <= 0 && C1 <= 0
%r = sdiv i8 C0, C1
=>
%r = udiv i8 -C0, -C1
Roman Lebedev [Sat, 18 Jul 2020 10:13:01 +0000 (13:13 +0300)]
[NFC][CVP] Rename predicates - s/positive/non negative/ to better note that zero is ok
Roman Lebedev [Sat, 18 Jul 2020 10:07:13 +0000 (13:07 +0300)]
[NFC][CVP] Refactor isPositive() out of hasPositiveOperands()
Roman Lebedev [Sat, 18 Jul 2020 14:30:42 +0000 (17:30 +0300)]
[NFC][CVP] Add tests for possible sdiv->udiv where operands are not non-negative
Currently that fold requires both operands to be non-negative,
but the only real requirement for the fold is that we must know
the domains of the operands.
Matt Arsenault [Sat, 18 Jul 2020 14:35:40 +0000 (10:35 -0400)]
AMDGPU/GlobalISel: Address some test fixmes that don't fail now
Matt Arsenault [Sat, 18 Jul 2020 14:08:17 +0000 (10:08 -0400)]
AMDGPU/GlobalISel: Fix test copy paste error
David Green [Fri, 17 Jul 2020 07:35:04 +0000 (08:35 +0100)]
[LV] Add additional InLoop redution tests. NFC
Evgeny Leviant [Sat, 18 Jul 2020 11:11:40 +0000 (14:11 +0300)]
[CodeGen][TargetPassConfig] Add TargetTransformInfo pass correctly
Patch adds tti pass directly enforcing its execution with correctly set
TargetTransformInfo.
Differential revision: https://reviews.llvm.org/D84047
Vitaly Buka [Sat, 18 Jul 2020 09:16:17 +0000 (02:16 -0700)]
[sanitizer] Disable test on incompatible platforms
Yash Jain [Sat, 18 Jul 2020 07:39:30 +0000 (13:09 +0530)]
[MLIR] Add lowering for affine.parallel to scf.parallel
Add lowering conversion from affine.parallel to scf.parallel.
Differential Revision: https://reviews.llvm.org/D83239
Fangrui Song [Sat, 18 Jul 2020 06:49:15 +0000 (23:49 -0700)]
[RelocationResolver] Support R_AARCH64_PREL32
Code from D83800 by Yichao Yu
Fangrui Song [Sat, 18 Jul 2020 06:29:50 +0000 (23:29 -0700)]
[RelocationResolver] Support R_PPC_REL32 & R_PPC64_REL{32,64}
This suppresses `failed to compute relocation: R_PPC_REL32, Invalid data was encountered while parsing the file`
and its 64-bit variants when running llvm-dwarfdump on a PowerPC object file with .eh_frame
Unfortunately it is difficult to test the computation:
DWARFDataExtractor::getEncodedPointer does not use the relocated value
and even if it does, we need to teach llvm-dwarfdump --eh-frame to do
some linker job to report a reasonable address.
Gui Andrade [Sat, 18 Jul 2020 03:49:17 +0000 (03:49 +0000)]
[MSAN tests] Require android for sigandorset.cpp
Gui Andrade [Sat, 18 Jul 2020 03:53:00 +0000 (03:53 +0000)]
Revert "update libatomic instrumentation"
This was committed mistakenly.
This reverts commit
1f29171ae77f81cacea32808b67d7ae62da23e0c.
Gui Andrade [Sat, 18 Jul 2020 03:39:14 +0000 (03:39 +0000)]
update libatomic instrumentation
Gui Andrade [Sat, 18 Jul 2020 03:18:48 +0000 (03:18 +0000)]
[LLVM] Add libatomic load/store functions to TargetLibraryInfo
This allows treating these functions like libcalls.
This patch is a prerequisite to instrumenting them in MSAN: https://reviews.llvm.org/D83337
Differential Revision: https://reviews.llvm.org/D83361
Gui Andrade [Sat, 18 Jul 2020 03:09:39 +0000 (03:09 +0000)]
sanitizers: Implement sig{and,or}set interceptors
Also adds a sanitizers-wide test, and a msan test, for these functions.
Chen Zheng [Sat, 18 Jul 2020 02:51:00 +0000 (22:51 -0400)]
[PowerPC]add testcase for adding store (load float*) pattern, nfc
Chen Zheng [Wed, 15 Jul 2020 08:03:35 +0000 (04:03 -0400)]
[SCEV][IndVarSimplify] insert point should not be block front.
Recommit after removing the unused cast instructions.
Differential Revision: https://reviews.llvm.org/D80975
Joel E. Denny [Sat, 18 Jul 2020 01:35:21 +0000 (21:35 -0400)]
[OpenMP] Fix map clause for unused var: don't ignore it
For example, without this patch:
```
$ cat test.c
int main() {
int x[3];
#pragma omp target map(tofrom:x[0:3])
#ifdef USE
x[0] = 1
#endif
;
return 0;
}
$ clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -S -emit-llvm test.c
$ grep '^@.offload_maptypes' test.ll
$ echo $?
1
$ clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -S -emit-llvm test.c \
-DUSE
$ grep '^@.offload_maptypes' test.ll
@.offload_maptypes = private unnamed_addr constant [1 x i64] [i64 35]
```
With this patch, both greps produce the same result.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D83922
Vitaly Buka [Sat, 18 Jul 2020 01:29:47 +0000 (18:29 -0700)]
Corrected __libfuzzer_is_present symbol inclusion for MSVC x86 32-bit
The incorrect symbol will cause linking failures for 32-bit targets:
clang_rt.fuzzer-i386.lib(FuzzerDriver.obj) : error LNK2001: unresolved external symbol __libfuzzer_is_present
Verified no longer fails to link with this change for 32-bit and still succeeds for 64-bit MSVC.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D83594
Arthur Eubanks [Sat, 18 Jul 2020 00:49:46 +0000 (17:49 -0700)]
[NewPM][ASan] Make ASan tests work under NPM
Under NPM, the asan-globals-md analysis is required but cannot be run
within the asan function pass due to module analyses not being able to
run from a function pass. So this pins all tests using "-asan" to the
legacy PM and adds a corresponding RUN line with
-passes='require<asan-globals-md>,function(asan)'.
Now all tests in Instrumentation/AddressSanitizer pass when
-enable-new-pm is by default on.
Tests were automatically converted using the following python script and
failures were manually fixed up.
import sys
for i in sys.argv:
with open(i, 'r') as f:
s = f.read()
with open(i, 'w') as f:
for l in s.splitlines():
if "RUN:" in l and ' -asan -asan-module ' in l and '\\' not in l:
f.write(l.replace(' -asan -asan-module ', ' -asan -asan-module -enable-new-pm=0 '))
f.write('\n')
f.write(l.replace(' -asan -asan-module ', " -passes='require<asan-globals-md>,function(asan),module(asan-module)' "))
f.write('\n')
elif "RUN:" in l and ' -asan ' in l and '\\' not in l:
f.write(l.replace(' -asan ', ' -asan -enable-new-pm=0 '))
f.write('\n')
f.write(l.replace(' -asan ', " -passes='require<asan-globals-md>,function(asan)' "))
f.write('\n')
else:
f.write(l)
f.write('\n')
See https://bugs.llvm.org/show_bug.cgi?id=46611.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D83921
Lang Hames [Fri, 17 Jul 2020 21:56:51 +0000 (14:56 -0700)]
[llvm-jitlink] Add suppport for testing GOT entries and stubs for ELF.
This enables regression testing of GOT and stub handling with
llvm-jitlink.
Kuba Mracek [Sat, 18 Jul 2020 00:39:43 +0000 (17:39 -0700)]
[asan] Use dynamic shadow memory position on Apple Silicon macOS
This is needed because macOS on Apple Silicon has some reserved pages inside the "regular" shadow memory location, and mapping over that location fails.
Differential Revision: https://reviews.llvm.org/D82912
Logan Smith [Fri, 17 Jul 2020 03:39:45 +0000 (20:39 -0700)]
[clang][NFC] Add a missing 'override'
Logan Smith [Fri, 17 Jul 2020 03:38:41 +0000 (20:38 -0700)]
[llvm][NFC] Add missing 'override's
Logan Smith [Fri, 17 Jul 2020 03:36:46 +0000 (20:36 -0700)]
[llvm][NFC] Add missing 'override's in unittests/
Vitaly Buka [Sat, 18 Jul 2020 00:29:20 +0000 (17:29 -0700)]
[sanitizer] Another attempt to fix protoent test
Now we are going to pick name and index based on output of getprotoent_r.
peter klausler [Sat, 18 Jul 2020 00:02:47 +0000 (17:02 -0700)]
[flang] Prevent bogus runtime I/O error message
The runtime was requiring that STATUS='OLD' be explicitly specified
on an OPEN statement for a connected unit. There error should issue
only if a STATUS= other than 'OLD' is specified; an OPEN with no
STATUS= specifier is okay.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84079
peter klausler [Fri, 17 Jul 2020 23:40:49 +0000 (16:40 -0700)]
[flang] Treat tabs like spaces in formatted input.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84078
peter klausler [Fri, 17 Jul 2020 23:36:59 +0000 (16:36 -0700)]
[flang] Support <name>=<integer> syntax in compiler directives
Accept name=value as part of a !DIR$ compiler directive. These
are currently ignored in semantics, but we should recognize
more directive forms to facilitate testing. In due course,
these placeholding directive parsers will be replaced.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84077
Arthur Eubanks [Fri, 17 Jul 2020 23:47:41 +0000 (16:47 -0700)]
Revert "[PGO][PGSO] Add profile guided size optimization to loop vectorization legality."
This reverts commit
30c382a7c6607a7d898730f8d288768110cdf1d2.
See https://crbug.com/1106813.
Michele Scandale [Fri, 17 Jul 2020 23:43:05 +0000 (16:43 -0700)]
[CMake] Make `intrinsics_gen` dependency unconditional.
The `intrinsics_gen` target exists in the CMake exports since r309389
(see LLVMConfig.cmake.in), hence projects can depend on `intrinsics_gen`
even it they are built separately from LLVM.
Reviewed By: MaskRay, JDevlieghere
Differential Revision: https://reviews.llvm.org/D83454
Aditya Nandakumar [Fri, 17 Jul 2020 23:03:20 +0000 (16:03 -0700)]
[GISel: Add support for CSEing SrcOps which are immediates
https://reviews.llvm.org/D84072
Add G_EXTRACT to CSEConfigFull and add unit test as well.
Leonard Chan [Fri, 17 Jul 2020 22:29:50 +0000 (15:29 -0700)]
Revert "[AddressSanitizer] Don't use weak linkage for __{start,stop}_asan_globals"
This reverts commit
d76e62fdb7a93d9a33f642b6b528f2562cc3c3f4.
Reverting since this can lead to linker errors:
```
ld.lld: error: undefined hidden symbol: __start_asan_globals
```
when using --gc-sections. The linker can discard __start_asan_globals
once there are no more `asan_globals` sections left, which can lead to
this error if we have external linkages to them.
peter klausler [Fri, 17 Jul 2020 18:21:08 +0000 (11:21 -0700)]
[flang] Allow ! and // comments after some preprocessing directives
Old-style C /*comments*/ are omitted from preprocessor directive
token sequences by the prescanner, but line-ending C++ and Fortran
free-form comments are not since their handling might depend on
the directive. Add code to skip these line-ending comments as
appropriate in place of existing code that just skipped blanks.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84061
AndreyChurbanov [Fri, 17 Jul 2020 22:15:37 +0000 (01:15 +0300)]
[OpenMP] libomp cleanup: check presence of hwloc objects CORE, PACKAGE
hwloc documentation guarantees the only object that is always present
in the topology is PU. We can check the presence of other objects
in the topology, just in case.
Differential Revision: https://reviews.llvm.org/D84065
Michael Spencer [Fri, 17 Jul 2020 22:12:18 +0000 (16:12 -0600)]
[clangd] Fix the build with clang <3.9.
In clang <3.9 the `unique_ptr` constructor that is supposed to allow
for Derived to Base conversion does not work. Remove this if we drop
support for such configurations.
This is the same fix as in
fda901a987ddd, and it updates the comments
to better reflect the actual issue. The same thing reproduces with
libc++ with older clangs.
Eric Christopher [Fri, 17 Jul 2020 22:05:42 +0000 (15:05 -0700)]
Temporarily Revert "[OpenMP] Add Additional Function Attribute Information to OMPKinds.def"
as it's causing a few unused variable warnings via the macro instantiation:
sources/llvm-project/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def:649:17: error: unused variable 'InaccessibleOnlyAttrs' [-Werror,-Wunused-variable]
__OMP_ATTRS_SET(InaccessibleOnlyAttrs,
^
This reverts commit
09fe0c5ab9ca5846d6cb625e9be47fdcfe49b93c.
Eric Christopher [Fri, 17 Jul 2020 21:58:01 +0000 (14:58 -0700)]
Temporarily Revert "[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks"
as it is failing the inline-replay.ll test as well as sanitizers/Werror
from returning a stack local variable.
This reverts commit
029946b112684c27b27f7c2d7554f22b33ae1e0b.
Joseph Huber [Fri, 17 Jul 2020 21:54:01 +0000 (17:54 -0400)]
[OpenMP] Add Additional Function Attribute Information to OMPKinds.def
Summary:
This patch adds more function attribute information to the runtime function definitions in OMPKinds.def. The goal is to provide sufficient information about OpenMP runtime functions to perform more optimizations on OpenMP code.
Reviewers: jdoerfert
Subscribers: aaron.ballman cfe-commits yaxunl guansong sstefan1 llvm-commits
Tags: #OpenMP #clang #llvm
Differential Revision: https://reviews.llvm.org/D81031
Teresa Johnson [Fri, 17 Jul 2020 21:48:28 +0000 (14:48 -0700)]
[compiler-rt][asan][hwasan] Fix Fuchsia build
Fix build failure in Fuchsia build from refactoring in
5d2be1a18845c528d3e86f7efcc59872e4a757c3
Guard the moved versions of ReserveShadowMemoryRange and ProtectGap
the same way they were in the asan code originally (not for Fuchsia or
RTEMS). Otherwise we end up with unsats as they invoke functions not
defined there.
peter klausler [Fri, 17 Jul 2020 18:24:29 +0000 (11:24 -0700)]
[flang] Rework read/write permission management for runtime file opening
Anonymous Fortran unit files (e.g., "./fort.7") need to be created
O_RDWR so that they can be written, rewound, and read. Other
files opened with no ACTION= specifier need to set read/write
permissions based on the file, if it exists.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84063
Sjoerd Meijer [Fri, 17 Jul 2020 21:40:41 +0000 (22:40 +0100)]
Remove clang matrix lowering test for now as it is still failing under the NPM.
Wenlei He [Tue, 14 Jul 2020 05:12:28 +0000 (22:12 -0700)]
[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks
Summary:
This change added a new inline advisor that takes optimization remarks for previous inlining as input, and provide the decision as advice so current inlining can replay inline decision of a different compilation. Dwarf inline stack with line and discriminator is used as anchor for call sites. The change can be useful for Inliner tuning.
A switch -sample-profile-inline-replay=<inline_remarks_file> is added to hook up the new inliner advisor with SampleProfileLoader's inline decision for replay. The new inline advisor can also be used by regular CGSCC inliner later if needed.
Reviewers: davidxl, mtrofin, wmi, hoy
Subscribers: aprantl, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83743
Xiangling Liao [Thu, 16 Jul 2020 18:29:13 +0000 (14:29 -0400)]
[AIX] report_fatal_error on `-fregister_global_dtors_with_atexit` for static init
On AIX, the semantic of global_dtors contains __sterm functions associated with C++
cleanup actions and user-declared __attribute__((destructor)) functions. We should
never merely register __sterm with atexit(), so currently
-fregister_global_dtors_with_atexit does not work well on AIX: It would cause
finalization actions to not occur when unloading shared libraries. We need to figure
out a way to handle that when we start supporting user-declared
__attribute__((destructor)) functions.
Currently we report_fatal_error on this option temporarily.
Differential Revision: https://reviews.llvm.org/D83974
Mitch Phillips [Fri, 17 Jul 2020 19:59:09 +0000 (12:59 -0700)]
[GWP-ASan] Split the unwinder into segv/non-segv.
Summary:
Splits the unwinder into a non-segv (for allocation/deallocation traces) and a
segv unwinder. This ensures that implementations can select an accurate, slower
unwinder in the segv handler (if they choose to use the GWP-ASan provided one).
This is important as fast frame-pointer unwinders (like the sanitizer unwinder)
don't like unwinding through signal handlers.
Reviewers: morehouse, cryptoad
Reviewed By: morehouse, cryptoad
Subscribers: cryptoad, mgorny, eugenis, pcc, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D83994
Xinan Jiang [Fri, 17 Jul 2020 19:57:08 +0000 (20:57 +0100)]
[InstCombine] Fix typo in comment.
Reviewers: fhahn
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D83951
Roman Lebedev [Fri, 17 Jul 2020 19:35:21 +0000 (22:35 +0300)]
[InstCombine] Fold X sdiv (-1 << C) -> -(X u>> Y) iff X is non-negative
This is the one i'm seeing as missed optimization,
although there are likely other possibilities, as usual.
There are 4 variants of a general sdiv->udiv fold:
https://rise4fun.com/Alive/VS6
Name: v0
Pre: C0 >= 0 && C1 >= 0
%r = sdiv i8 C0, C1
=>
%r = udiv i8 C0, C1
Name: v1
Pre: C0 <= 0 && C1 >= 0
%r = sdiv i8 C0, C1
=>
%t0 = udiv i8 -C0, C1
%r = sub i8 0, %t0
Name: v2
Pre: C0 >= 0 && C1 <= 0
%r = sdiv i8 C0, C1
=>
%t0 = udiv i8 C0, -C1
%r = sub i8 0, %t0
Name: v3
Pre: C0 <= 0 && C1 <= 0
%r = sdiv i8 C0, C1
=>
%r = udiv i8 -C0, -C1
If we really don't like sdiv (more than udiv that is),
and are okay with increasing instruction count (2 new negations),
and we ensure that we don't undo the fold,
then we could just implement these..
Roman Lebedev [Fri, 17 Jul 2020 19:28:36 +0000 (22:28 +0300)]
[NFC][InstCombine] Add some tests with sdiv-by-negative-power-of-two
peter klausler [Fri, 17 Jul 2020 18:27:40 +0000 (11:27 -0700)]
[flang] Add entry points for internal scalar list-directed I/O
BeginInternalListInput and BeginInternalListOutput were missing
from the I/O API implementation; add them.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D84066
Michael Spencer [Fri, 17 Jul 2020 19:32:12 +0000 (13:32 -0600)]
[Clang] Fix building with Clang < 3.9.
This is a workaround for a bug in older versions of Clang when. The
constructor that is supposed to allow for Derived to Base conversion
does not work. Remove this if we drop support for such configurations.
Siva Chandra Reddy [Thu, 16 Jul 2020 19:49:47 +0000 (12:49 -0700)]
[libc][NFC] Use RemoveCVType to implement IsIntegral and IsPointerType.
Added IsSameV as a convenience variable and used it where convenient.
Reviewers: abrachet, lntue
Differential Revision: https://reviews.llvm.org/D83980
Stella Laurenzo [Fri, 17 Jul 2020 18:12:07 +0000 (11:12 -0700)]
Pass -rtlib=libgcc in tests conditioned on the default.
Summary:
* This test was failing in our builds that configure compiler-rt as the configure-time rtlib.
* Opted for this test fix instead of a rollback, and hopefully TI can fix forward if this weakens the tests beyond expectations.
* Suspected this failure introduced in D81676.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84058
David Blaikie [Fri, 17 Jul 2020 17:43:12 +0000 (10:43 -0700)]
[llvm] Add contains(KeyType) -> bool methods to StringSet
Matches C++20 API addition.
Differential Revision: https://reviews.llvm.org/D83449
David Blaikie [Fri, 17 Jul 2020 17:43:01 +0000 (10:43 -0700)]
[llvm] Add contains(KeyType) -> bool methods to SparseSet
Matches C++20 API addition.
Differential Revision: https://reviews.llvm.org/D83449
David Blaikie [Fri, 17 Jul 2020 17:42:23 +0000 (10:42 -0700)]
[llvm] Add contains(KeyType) -> bool methods to SmallSet
Matches C++20 API addition.
Differential Revision: https://reviews.llvm.org/D83449
David Blaikie [Fri, 17 Jul 2020 17:41:35 +0000 (10:41 -0700)]
[llvm] Add contains(KeyType) -> bool methods to SmallPtrSet
Matches C++20 API addition.
Differential Revision: https://reviews.llvm.org/D83449
David Blaikie [Fri, 17 Jul 2020 17:41:03 +0000 (10:41 -0700)]
[llvm] Add contains(KeyType) -> bool methods to SetVector
Matches C++20 API addition.
Differential Revision: https://reviews.llvm.org/D83449
David Blaikie [Fri, 17 Jul 2020 17:40:42 +0000 (10:40 -0700)]
[llvm] Add contains(KeyType) -> bool methods to DenseSet
Matches C++20 API addition.
Differential Revision: https://reviews.llvm.org/D83449
AndreyChurbanov [Fri, 17 Jul 2020 18:10:25 +0000 (21:10 +0300)]
[OpenMP] libomp: add itt notifications for teams construct on host
Add barrier/region notification for parallel inside teams construct
when number of teams is 1, as VTune only shows outer level regions for
simplicity.
Differential Revision: https://reviews.llvm.org/D84024
Stanislav Mekhanoshin [Wed, 15 Jul 2020 22:30:46 +0000 (15:30 -0700)]
Fixed warning about signed/unsigned comparison
I've got the report clang11 issues signed/unsigned mismatch
warning here. For some reason only clang11 seems to issue
this warning.
Differential Revision: https://reviews.llvm.org/D83916
Jonas Devlieghere [Fri, 17 Jul 2020 15:18:22 +0000 (08:18 -0700)]
[lldb] Unify sleep and time outs in GDB remote testcases
Reduce sleep and time outs in GDB remote testcases to one default value
for each. Stop passing these values around and always use the default
instead.
Differential revision: https://reviews.llvm.org/D83904
George Rokos [Thu, 16 Jul 2020 22:57:27 +0000 (15:57 -0700)]
Added missing API call to OpenMP test
Nicolas Vasilache [Fri, 17 Jul 2020 17:17:09 +0000 (13:17 -0400)]
[mlir][Vector] Fix masking logic in VectorToSCF
Summary: The logic was conservative but inverted: cases that should remain unmasked became 1-D masked.
Differential Revision: https://reviews.llvm.org/D84051
Dmitry Preobrazhensky [Fri, 17 Jul 2020 16:48:36 +0000 (19:48 +0300)]
[AMDGPU] Removed s_mov_regrd and mov_fed opcodes
These opcodes are not intended for public use.
Reviewers: arsenm, rampitec
Differential Revision: https://reviews.llvm.org/D81659
Aleksandr Platonov [Fri, 17 Jul 2020 16:48:56 +0000 (18:48 +0200)]
[clang][Tooling] Try to avoid file system access if there is no record for the file in compile_commads.json
Summary:
If there is no record in compile_commands.json, we try to find suitable record with `MatchTrie.findEquivalent()` call.
This is very expensive operation with a lot of `llvm::sys::fs::equivalent()` calls in some cases.
This patch disables file symlinks for performance reasons.
Example scenario without this patch:
- compile_commands.json generated at clangd build (contains ~3000 files).
- it tooks more than 1 second to get compile command for newly created file in the root folder of LLVM project.
- we wait for 1 second every time when clangd requests compile command for this file (at file change).
Reviewers: sammccall, kadircet, hokein
Reviewed By: sammccall
Subscribers: chandlerc, djasper, klimek, ilya-biryukov, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83621
Yonghong Song [Thu, 16 Jul 2020 21:26:09 +0000 (14:26 -0700)]
BPF: generate .rodata BTF datasec for certain initialized local var's
Currently, BTF datasec type for .rodata is generated only if there are
user-defined readonly global variables which have debuginfo generated.
Certain readonly global variables may be generated from initialized
local variables. For example,
void foo(const void *);
int test() {
const struct {
unsigned a[4];
char b;
} val = { .a = {2, 3, 4, 5}, .b = 6 };
foo(&val);
return 0;
}
The clang will create a private linkage const global to store
the initialized value:
@__const.test.val = private unnamed_addr constant %struct.anon
{ [4 x i32] [i32 2, i32 3, i32 4, i32 5], i8 6 }, align 4
This global variable eventually is put in .rodata ELF section.
If there is .rodata ELF section, libbpf expects a BTF .rodata
datasec as well even though it may be empty meaning there are no
global readonly variables with proper debuginfo. Martin reported
a bug where without this empty BTF .rodata datasec, the bpftool
gen will exit with an error.
This patch fixed the issue by generating .rodata BTF datasec
if there exists local var intial data which will result in
.rodata ELF section.
Differential Revision: https://reviews.llvm.org/D84002
Adrian McCarthy [Thu, 16 Jul 2020 22:15:51 +0000 (15:15 -0700)]
With MSVC, file needs to be compiled with /BIGOBJ
MSVC, by default, limits the number of sections generated by a single
translation unit to 2^16. In a debug build, each function or method
can require 4 sections, so it's not uncommon to hit it.
I saw the problem when building tests for LLDB (but, interestingly, not
for LLDB itself).
Differential Revision: https://reviews.llvm.org/D83991
Fangrui Song [Fri, 17 Jul 2020 16:18:24 +0000 (09:18 -0700)]
[OptTable] Support grouped short options
POSIX.1-2017 12.2 Utility Syntax Guidelines, Guideline 5 says:
> One or more options without option-arguments, followed by at most one option that takes an option-argument, should be accepted when grouped behind one '-' delimiter.
i.e. -abc represents -a -b -c. The grouped short options are very common. Many
utilities extend the syntax by allowing (an option with an argument) following a
sequence of short options.
This patch adds the support to OptTable, similar to cl::Group for CommandLine
(D58711). llvm-symbolizer will use the feature (D83530). CommandLine is exotic
in some aspects. OptTable is preferred if the user wants to get rid of the
behaviors.
* `cl::opt<bool> i(...)` can be disabled via -i=false or -i=0, which is
different from conventional --no-i.
* Handling --foo & --no-foo requires a comparison of argument positions,
which is a bit clumsy in user code.
OptTable::parseOneArg (non-const reference InputArgList) is added along with
ParseOneArg (const ArgList &). The duplicate does not look great at first
glance. However, The implementation can be simpler if ArgList is mutable.
(ParseOneArg is used by clang-cl (FlagsToInclude/FlagsToExclude) and lld COFF
(case-insensitive). Adding grouped short options can make the function even more
complex.)
The implementation allows a long option following a group of short options. We
probably should refine the code to disallow this in the future. Allowing this
seems benign for now.
Reviewed By: grimar, jhenderson
Differential Revision: https://reviews.llvm.org/D83639
Nico Weber [Fri, 17 Jul 2020 16:30:25 +0000 (12:30 -0400)]
[gn build] Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nikita Popov [Fri, 17 Jul 2020 16:25:56 +0000 (18:25 +0200)]
[IR] Fix MSVC warning (NFC)
As requested by Andrew Kaylor, rewrite this code in a way that does
not warn on old MSVC versions.
Avoid the buggy constexpr warning by just not using constexpr and
removing the static_assert that depends on it.
Nico Weber [Fri, 17 Jul 2020 16:27:21 +0000 (12:27 -0400)]
[gn build] (manually) merge
6c43ed608
Pierre Oechsel [Fri, 17 Jul 2020 16:02:11 +0000 (12:02 -0400)]
[mlir] [vector] Add an optional filter to vector contract lowering patterns.
Summary: Vector contract patterns were only parameterized by a `vectorTransformsOptions`. As a result, even if an mlir file was containing several occurrences of `vector.contract`, all of them would be lowered in the same way. More granularity might be required . This Diff adds a `constraint` argument to each of these patterns which allows the user to specify with more precision on which `vector.contract` should each of the lowering apply.
Differential Revision: https://reviews.llvm.org/D83960
Nico Weber [Fri, 17 Jul 2020 15:51:08 +0000 (11:51 -0400)]
[gn build] Make sync_source_lists_from_cmake handle one-line sources lines
sync_source_lists_from_cmake now also looks for source files in
`sources += [ "foo.cc" ]` lines, which allows us to remove most
`# Make `gn format` not collapse this` comments.
(sync_source_lists_from_cmake doesn't look for `foo_headers += [...]`
still, so the comment is still needed in two places for that.)
No intentional behavior change.
Sanjay Patel [Fri, 17 Jul 2020 13:48:27 +0000 (09:48 -0400)]
[InstSimplify] add tests for fcmp with infinity; NFC
Matt Arsenault [Fri, 17 Jul 2020 15:02:10 +0000 (11:02 -0400)]
AMDGPU: Fix promoting f16 fpowi with legal f16
Nico Weber [Fri, 17 Jul 2020 15:21:42 +0000 (11:21 -0400)]
[gn format] (manually) merge
6bddd099ac
Nicolas Vasilache [Fri, 17 Jul 2020 15:09:35 +0000 (11:09 -0400)]
[mlir][EDSC] Allow conditionBuilder to capture the IfOp
When the IfOp returns values, it can easily be obtained from one of the Values.
However, when no values are returned, the information is lost.
This revision lets the caller specify a capture IfOp* to return the produced
IfOp.
Differential Revision: https://reviews.llvm.org/D84025