Heejin Ahn [Tue, 5 Feb 2019 01:59:49 +0000 (01:59 +0000)]
[WebAssembly] Fix indentation after adding IsCanonical property (NFC)
llvm-svn: 353132
Wouter van Oortmerssen [Tue, 5 Feb 2019 01:19:45 +0000 (01:19 +0000)]
[WebAssembly] Make disassembler always emit most canonical name.
Summary:
There are a few instructions that all map to the same opcode, so
when disassembling, we have to pick one. That was just the first one
before (the except_ref variant in the case of "call"), now it is the
one marked as IsCanonical in tablegen, or failing that, the shortest
name (which is typically the "canonical" one).
Also introduced a canonical "end" instruction for this purpose.
Reviewers: dschuff, tlively
Subscribers: sbc100, jgravelle-google, aheejin, llvm-commits, sunfish
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57713
llvm-svn: 353131
Davide Italiano [Tue, 5 Feb 2019 00:59:57 +0000 (00:59 +0000)]
[Python2 to Python 3] Fix print -> print().
llvm-svn: 353130
Wei Mi [Tue, 5 Feb 2019 00:57:50 +0000 (00:57 +0000)]
[SamplePGO][NFC] Minor improvement to replace a temporary vector with a
brace-enclosed init list.
Differential Revision: https://reviews.llvm.org/D57726
llvm-svn: 353129
Matt Arsenault [Tue, 5 Feb 2019 00:53:22 +0000 (00:53 +0000)]
GlobalISel: Fix verifier crashing on non-register operands
Also correct the wording of error on subregisters.
llvm-svn: 353128
Thomas Lively [Tue, 5 Feb 2019 00:49:55 +0000 (00:49 +0000)]
[WebAssembly] memory.copy
Summary: Depends on D57495.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish
Differential Revision: https://reviews.llvm.org/D57498
llvm-svn: 353127
Kristof Umann [Tue, 5 Feb 2019 00:39:33 +0000 (00:39 +0000)]
[analyzer] Creating standard Sphinx documentation
The lack of documentation has been a long standing issue in the Static Analyzer,
and one of the leading reasons behind this was a lack of good documentation
infrastucture.
This lead serious drawbacks, such as
* Not having proper release notes for years
* Not being able to have a sensible auto-generated checker documentations (which
lead to most of them not having any)
* The HTML website that has to updated manually is a chore, and has been
outdated for a long while
* Many design discussions are now hidden in phabricator revisions
This patch implements a new documentation infrastucture using Sphinx, like most
of the other subprojects in LLVM. It transformed some pages as a proof-of-
concept, with many others to follow in later patches. The eventual goal is to
preserve the original website's (https://clang-analyzer.llvm.org/) frontpage,
but move everything else to the new format.
Some other ideas, like creating a unipage for each checker (similar to how
clang-tidy works now), are also being discussed.
Patch by Dániel Krupp!
Differential Revision: https://reviews.llvm.org/D54429
llvm-svn: 353126
Matt Arsenault [Tue, 5 Feb 2019 00:26:12 +0000 (00:26 +0000)]
GlobalISel: Consolidate load/store legalization
The fewerElementsVectors implementation for load/stores
handles the scalar reduction case just as well, so drop
the redundant code in narrowScalar. This also introduces
support for narrowing irregular size breakdowns for
scalars.
llvm-svn: 353125
Craig Topper [Tue, 5 Feb 2019 00:22:23 +0000 (00:22 +0000)]
[DAGCombiner] Discard pointer info when combining extract_vector_elt of a vector load when the index isn't constant
Summary:
If the index isn't constant, this transform inserts a multiply and an add on the index to calculating the base pointer for a scalar load. But we still create a memory operand with an offset of 0 and the size of the scalar access. But the access is really to an unknown offset within the original access size.
This can cause the machine scheduler to incorrectly calculate dependencies between this load and other accesses. In the case we saw, there was a 32 byte vector store that was split into two 16 byte stores, one with offset 0 and one with offset 16. The size of the memory operand for both was 16. The scheduler correctly detected the alias with the offset 0 store, but not the offset 16 store.
This patch discards the pointer info so we don't incorrectly detect aliasing. I wasn't sure if we could keep using the original offset and size without risking some other transform on the load changing the size.
I tried to reduce a test case, but there's still a lot of memory operations needed to get the scheduler to do the bad reordering. So it looked pretty fragile to maintain.
Reviewers: efriedma
Reviewed By: efriedma
Subscribers: arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57616
llvm-svn: 353124
Teresa Johnson [Tue, 5 Feb 2019 00:18:38 +0000 (00:18 +0000)]
[SamplePGO] Minor efficiency improvement in samplePGO ICP
Summary:
When attaching prof metadata to promoted direct calls in SamplePGO
mode, no need to construct and use a SmallVector to pass a single count
to the ArrayRef parameter, we can simply use a brace-enclosed init list.
This made a small but consistent improvement for a ThinLTO backend
compile I was measuring.
Reviewers: wmi
Subscribers: mehdi_amini, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57706
llvm-svn: 353123
Matt Arsenault [Tue, 5 Feb 2019 00:13:44 +0000 (00:13 +0000)]
GlobalISel: Implement narrowScalar for select
Don't handle vector conditions.
I think this can be merged in the future with
fewerElementsVectorSelect, although this becomes slightly tricky with
a vector condition.
llvm-svn: 353122
Matt Arsenault [Mon, 4 Feb 2019 23:41:59 +0000 (23:41 +0000)]
GlobalISel: Combine g_extract with g_merge_values
Try to use the underlying source registers.
This enables legalization in more cases where some irregular
operations are widened and others narrowed.
This seems to make the test_combines_2 AArch64 test worse, since the
MERGE_VALUES has multiple uses. Since this should be required for
legalization, a hasOneUse check is probably inappropriate (or maybe
should only be used if the merge is legal?).
llvm-svn: 353121
Julian Lettner [Mon, 4 Feb 2019 23:37:50 +0000 (23:37 +0000)]
[Sanitizers] UBSan unreachable incompatible with Kernel ASan
Summary:
This is a follow up for https://reviews.llvm.org/D57278. The previous
revision should have also included Kernel ASan.
rdar://problem/
40723397
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57711
llvm-svn: 353120
Sam Clegg [Mon, 4 Feb 2019 23:36:38 +0000 (23:36 +0000)]
[llvm-readobj] Fix readobj test expectation broken in rL353109. NFC.
llvm-svn: 353119
Evandro Menezes [Mon, 4 Feb 2019 23:34:50 +0000 (23:34 +0000)]
Revert "[PATCH] [TargetLibraryInfo] Update run time support for Windows"
This reverts accidental commit
ff5527718d5d3b9966f6e8948866c0dc15ffcf3c.
llvm-svn: 353118
Evandro Menezes [Mon, 4 Feb 2019 23:34:38 +0000 (23:34 +0000)]
[ADT] Refactor the Windows query functions (NFC)
Increase reuse in the query functions for Windows.
llvm-svn: 353117
Joe Daniels [Mon, 4 Feb 2019 23:32:55 +0000 (23:32 +0000)]
[OBJC] Add attribute to mark Objective C class as non-lazy
A non-lazy class will be initialized eagerly when the Objective-C runtime is
loaded. This is required for certain system classes which have instances allocated in
non-standard ways, such as the classes for blocks and constant strings.
Adding this attribute is essentially equivalent to providing a trivial
+load method but avoids the (fairly small) load-time overheads associated
with defining and calling such a method.
Differential Revision: https://reviews.llvm.org/D56555
llvm-svn: 353116
Erik Pilkington [Mon, 4 Feb 2019 23:30:57 +0000 (23:30 +0000)]
[SemaObjC] Don't infer the availabilty of +new from -init if the receiver has Class type
rdar://
47713266
Differential revision: https://reviews.llvm.org/D57712
llvm-svn: 353115
Evandro Menezes [Mon, 4 Feb 2019 23:29:41 +0000 (23:29 +0000)]
[PATCH] [TargetLibraryInfo] Update run time support for Windows
It seems that the run time for Windows has changed and supports more math
functions than before. Since LLVM requires at least VS2015, I assume that
this is the run time that would be redistributed with programs built with
Clang. Thus, I based this update on the header file `math.h` that
accompanies it.
This patch addresses the PR40541. Unfortunately, I have no access to a
Windows development environment to validate it.
llvm-svn: 353114
Matt Arsenault [Mon, 4 Feb 2019 23:29:31 +0000 (23:29 +0000)]
GlobalISel: Enforce operand types for constants
A number of of tests were using imm operands, not cimm. Since CSE
relies on the exact ConstantInt* pointer used, and implicit
conversions are generally evil, also enforce the bitsize of the types.
llvm-svn: 353113
Matt Arsenault [Mon, 4 Feb 2019 23:29:16 +0000 (23:29 +0000)]
GlobalISel: Verify g_select
Factor the common vector element consistency check many instructions
need out, although this makes the error messages worse.
llvm-svn: 353112
Matt Arsenault [Mon, 4 Feb 2019 23:29:11 +0000 (23:29 +0000)]
MachineVerifier: Move verification of G_* instructions to function
llvm-svn: 353111
Vitaly Buka [Mon, 4 Feb 2019 23:25:55 +0000 (23:25 +0000)]
[tsan] Disable fgetpwent_r to work around performance issues
This was missed from D54041 when SANITIZER_INTERCEPT_FGETPWENT_R was branched from SANITIZER_INTERCEPT_GETPWENT_R
llvm-svn: 353110
Sam Clegg [Mon, 4 Feb 2019 23:07:34 +0000 (23:07 +0000)]
[WebAssembly] MC: Mark more function aliases as functions
Aliases of functions are now marked as function symbols even if
they are bitcast to some other other non-function type.
This is important for WebAssembly where object and function
symbols can't alias each other.
Fixes PR38866
Differential Revision: https://reviews.llvm.org/D57538
llvm-svn: 353109
Jonathan Metzman [Mon, 4 Feb 2019 23:01:06 +0000 (23:01 +0000)]
[libFuzzer][Windows] Clean up RawPrint
Summary:
Use `_write` instead of the deprecated alias `write` on Windows.
Also, remove comment saying RawPrint is untested on Windows.
Reviewers: vitalybuka
Reviewed By: vitalybuka
Subscribers: vitalybuka
Differential Revision: https://reviews.llvm.org/D57589
llvm-svn: 353108
Matt Arsenault [Mon, 4 Feb 2019 22:59:56 +0000 (22:59 +0000)]
MIR: Validate LLT types when parsing
llvm-svn: 353107
Sanjay Patel [Mon, 4 Feb 2019 22:37:05 +0000 (22:37 +0000)]
[CGP] fix bogus test names/comments; NFC
Inverted operand 0 and operand 1.
llvm-svn: 353106
Sam Clegg [Mon, 4 Feb 2019 22:34:07 +0000 (22:34 +0000)]
[WebAssembly] Update test to match new readobj output. NFC.
Differential Revision: https://reviews.llvm.org/D57715
llvm-svn: 353105
Sam Clegg [Mon, 4 Feb 2019 22:27:46 +0000 (22:27 +0000)]
[llvm-readobj] Report more WebAssembly symbol info
Differential Revision: https://reviews.llvm.org/D57695
llvm-svn: 353104
Sanjay Patel [Mon, 4 Feb 2019 22:27:08 +0000 (22:27 +0000)]
[CGP] add tests for usubo; NFC
llvm-svn: 353103
Matt Arsenault [Mon, 4 Feb 2019 22:26:33 +0000 (22:26 +0000)]
GlobalISel: Fix not calling observer when legalizing bitcount ops
This was hiding bugs from never legalizing the source type.
llvm-svn: 353102
Matt Arsenault [Mon, 4 Feb 2019 22:26:21 +0000 (22:26 +0000)]
AMDGPU: Don't rematerialize mov with implicit operands
This was pulling the mov used for register indexing on gfx9 out of the
loop.
llvm-svn: 353101
Julian Lettner [Mon, 4 Feb 2019 22:06:30 +0000 (22:06 +0000)]
[SanitizerCoverage] Clang crashes if user declares `__sancov_lowest_stack` variable
Summary:
If the user declares or defines `__sancov_lowest_stack` with an
unexpected type, then `getOrInsertGlobal` inserts a bitcast and the
following cast fails:
```
Constant *SanCovLowestStackConstant =
M.getOrInsertGlobal(SanCovLowestStackName, IntptrTy);
SanCovLowestStack = cast<GlobalVariable>(SanCovLowestStackConstant);
```
This variable is a SanitizerCoverage implementation detail and the user
should generally never have a need to access it, so we emit an error
now.
rdar://problem/
44143130
Reviewers: morehouse
Differential Revision: https://reviews.llvm.org/D57633
llvm-svn: 353100
David Major [Mon, 4 Feb 2019 21:27:38 +0000 (21:27 +0000)]
gn build: Windows: use a more standard format for PDB filenames
The current build was producing names like llvm-undname.exe.pdb, which looks unusual to me at least. This switches them to the more common llvm-undname.pdb style.
Differential Revision: https://reviews.llvm.org/D57613
llvm-svn: 353099
David Major [Mon, 4 Feb 2019 21:25:13 +0000 (21:25 +0000)]
gn build: Revert r353094 (bad merge)
llvm-svn: 353098
Nicolai Haehnle [Mon, 4 Feb 2019 21:24:19 +0000 (21:24 +0000)]
[InstCombine] Cleanup the TFE/LWE check in AMDGPU SimplifyDemanded
Summary:
The fix added in r352904 is not quite correct, or rather misleading:
1. When the texfailctrl (TFC) argument was non-constant, the fix assumed
non-TFE/LWE, which is incorrect.
2. Regardless, this code path cannot even be hit for correct
TFE/LWE-enabled calls, because those return a struct. Added
a test case for those for completeness.
Change-Id: I92d314dbc67a2670f6d7adaab765ef45f56a49cf
Reviewers: hliao, dstuttard, arsenm
Subscribers: kzhuravl, jvesely, wdng, yaxunl, tpr, t-tye, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57681
llvm-svn: 353097
Craig Topper [Mon, 4 Feb 2019 21:24:15 +0000 (21:24 +0000)]
[X86] Add test case for report_fatal_error added in r352699.
r352699 replaced an llvm_unreachable with a report_fatal_error. This patch adds a test case for it.
llvm-svn: 353096
Craig Topper [Mon, 4 Feb 2019 21:24:13 +0000 (21:24 +0000)]
[CodeGen][ARC][SystemZ][WebAssembly] Use MachineInstr::isInlineAsm in more places instead of just comparing opcode. NFCI
I'm looking at adding a second INLINEASM opcode for better modeling asm-goto
as a terminator. Using the existing predicate will reduce teh number of
places that will need to use the new opcode.
llvm-svn: 353095
David Major [Mon, 4 Feb 2019 21:20:25 +0000 (21:20 +0000)]
gn build: Windows: use a more standard format for PDB filenames
The current build was producing names like llvm-undname.exe.pdb, which looks unusual to me at least. This switches them to the more common llvm-undname.pdb style.
Differential Revision: https://reviews.llvm.org/D57613
llvm-svn: 353094
David Major [Mon, 4 Feb 2019 21:13:43 +0000 (21:13 +0000)]
gn build: Windows: write PDBs when is_debug
Without /DEBUG, the /Zi doesn't on its own create PDB files.
And since ninja runs multiple compilations in parallel, we need /FS to prevent contention on PDBs.
Differential Revision: https://reviews.llvm.org/D57612
llvm-svn: 353093
Malcolm Parsons [Mon, 4 Feb 2019 21:09:31 +0000 (21:09 +0000)]
[clang-tidy] Handle unions with existing default-member-init
Summary:
clang-tidy's modernize-use-default-member-init was crashing for unions
with an existing default member initializer.
Fixes PR40492
Reviewers: aaron.ballman, alexfh, JonasToth
Reviewed By: JonasToth
Subscribers: JonasToth, riccibruno, xazax.hun, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D57665
llvm-svn: 353092
Aditya Nandakumar [Mon, 4 Feb 2019 21:06:24 +0000 (21:06 +0000)]
[Tablegen][DAG]: Fix build breakage when LLVM_ENABLE_DAGISEL_COV=1
LLVM_ENABLE_DAGISEL_COV can be used to instrument DAGISel tablegen
selection code to show which patterns along with Complex patterns were
used when selecting instructions. Unfortunately this is turned off by
default and was broken but never tested.
This required a simple fix (missing new line) to get it to build again.
llvm-svn: 353091
Philip Pfaffe [Mon, 4 Feb 2019 21:02:49 +0000 (21:02 +0000)]
[NewPM][MSan] Add Options Handling
Summary: This patch enables passing options to msan via the passes pipeline, e.e., -passes=msan<recover;kernel;track-origins=4>.
Reviewers: chandlerc, fedor.sergeev, leonardchan
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57640
llvm-svn: 353090
Wolfgang Pieb [Mon, 4 Feb 2019 20:42:45 +0000 (20:42 +0000)]
[DEBUGINFO] Reposting r352642: Handle restore instructions in LiveDebugValues
The LiveDebugValues pass recognizes spills but not restores, which can
cause large gaps in location information for some variables, depending
on control flow. This patch make LiveDebugValues recognize restores and
generate appropriate DBG_VALUE instructions.
This patch was posted previously with r352642 and reverted in r352666 due
to buildbot errors. A missing return statement was the cause for the
failures.
Reviewers: aprantl, NicolaPrica
Differential Revision: https://reviews.llvm.org/D57271
llvm-svn: 353089
Johannes Doerfert [Mon, 4 Feb 2019 20:42:38 +0000 (20:42 +0000)]
Generalize pthread callback test case
Changes suggested by Eli Friedman <efriedma@quicinc.com>
llvm-svn: 353088
Jonas Devlieghere [Mon, 4 Feb 2019 20:33:35 +0000 (20:33 +0000)]
Update stale comment in lang/c/struct_types/main.c
rdar://
47322760
llvm-svn: 353087
JF Bastien [Mon, 4 Feb 2019 20:31:13 +0000 (20:31 +0000)]
Support tests in freestanding
Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".
Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:
In utils/libcxx/test/config.py add:
self.cxx.compile_flags += ['-ffreestanding']
Run the tests and they all fail.
Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).
Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.
The former was done with The Magic Of Sed.
The later was done with a (not quite correct but decent) clang tool:
https://gist.github.com/jfbastien/
793819ff360baa845483dde81170feed
This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.
Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.
<rdar://problem/
47754795>
Reviewers: ldionne, mclow.lists, EricWF
Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits
Differential Revision: https://reviews.llvm.org/D57624
llvm-svn: 353086
Petr Hosek [Mon, 4 Feb 2019 20:02:26 +0000 (20:02 +0000)]
[CMake] Support CMake variables for setting target, sysroot and toolchain
CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.
libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.
This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.
Differential Revision: https://reviews.llvm.org/D57670
llvm-svn: 353084
Scott Linder [Mon, 4 Feb 2019 20:00:07 +0000 (20:00 +0000)]
[AMDGPU] Support emitting GOT relocations for function calls
Differential Revision: https://reviews.llvm.org/D57416
llvm-svn: 353083
Michael Kruse [Mon, 4 Feb 2019 19:55:59 +0000 (19:55 +0000)]
[WarnMissedTransforms] Do not warn about already vectorized loops.
LoopVectorize adds llvm.loop.isvectorized, but leaves
llvm.loop.vectorize.enable. Do not consider such a loop for user-forced
vectorization since vectorization already happened -- by prioritizing
llvm.loop.isvectorized except for TM_SuppressedByUser.
Fixes http://llvm.org/PR40546
Differential Revision: https://reviews.llvm.org/D57542
llvm-svn: 353082
Matt Arsenault [Mon, 4 Feb 2019 19:53:22 +0000 (19:53 +0000)]
GlobalISel: Fix CheckMachineFunction passing if ReadCheckFile files
This could be tested, but the FileCheck library spams the error
message to the console.
llvm-svn: 353081
Matt Arsenault [Mon, 4 Feb 2019 19:53:19 +0000 (19:53 +0000)]
GlobalISel: Allow constructing SrcOp/DstOp from MachineOperand
llvm-svn: 353080
Hyrum Wright [Mon, 4 Feb 2019 19:28:20 +0000 (19:28 +0000)]
[clang-tidy] Add the abseil-duration-unnecessary-conversion check
Differential Revision: https://reviews.llvm.org/D57353
llvm-svn: 353079
Matt Arsenault [Mon, 4 Feb 2019 19:16:58 +0000 (19:16 +0000)]
GlobalISel: Fix parameter name in documentation
llvm-svn: 353078
Matt Arsenault [Mon, 4 Feb 2019 19:15:50 +0000 (19:15 +0000)]
GlobalISel: Fix CSE handling of buildConstant
This fixes two problems with CSE done in buildConstant. First, this
would hit an assert when used with a vector result type. Solve this by
allowing CSE on the vector elements, but not on the result vector for
now.
Second, this was also performing the CSE based on the input
ConstantInt pointer. The underlying buildConstant could potentially
convert the constant depending on the result type, giving in a
different ConstantInt*. Stop allowing the APInt and ConstantInt forms
from automatically casting to the result type to avoid any similar
problems in the future.
llvm-svn: 353077
Heejin Ahn [Mon, 4 Feb 2019 19:13:46 +0000 (19:13 +0000)]
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`.)
The list of fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D57499
llvm-svn: 353076
Heejin Ahn [Mon, 4 Feb 2019 19:13:39 +0000 (19:13 +0000)]
[WebAssembly] clang-tidy (NFC)
Summary:
This patch fixes clang-tidy warnings on wasm-only files.
The list of checks used is:
`-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,readability-identifier-naming,modernize-*`
(LLVM's default .clang-tidy list is the same except it does not have
`modernize-*`. But I've seen in multiple CLs in LLVM the modernize style
was recommended and code was fixed based on the style, so I added it as
well.)
The common fixes are:
- Variable names start with an uppercase letter
- Function names start with a lowercase letter
- Use `auto` when you use casts so the type is evident
- Use inline initialization for class member variables
- Use `= default` for empty constructors / destructors
- Use `using` in place of `typedef`
Reviewers: sbc100, tlively, aardappel
Subscribers: dschuff, sunfish, jgravelle-google, yurydelendik, kripken, MatzeB, mgorny, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D57500
llvm-svn: 353075
Jordan Rupprecht [Mon, 4 Feb 2019 19:09:20 +0000 (19:09 +0000)]
[llvm-objcopy][NFC] simplify an error return
llvm-svn: 353074
Roman Lebedev [Mon, 4 Feb 2019 19:04:26 +0000 (19:04 +0000)]
[X86] X86DAGToDAGISel::matchBitExtract(): prepare 'control' in 32 bits
Summary:
Noticed while looking at D56052.
```
// The 'control' of BEXTR has the pattern of:
// [15...8 bit][ 7...0 bit] location
// [ bit count][ shift] name
// I.e.
0b000000011'
00000001 means (x >> 0b1) & 0b11
```
I.e. we do not care about any of the bits aside from the low 16 bits.
So there is no point in doing the `slh`,`or` in 64 bits,
let's just do everything in 32 bits, and anyext if needed.
We could do that in 16 even, but we intentionally don't
zext to i16 (longer encoding IIRC),
so i'm guessing the same applies here.
Reviewers: craig.topper, andreadb, RKSimon
Reviewed By: craig.topper
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D56715
llvm-svn: 353073
Matt Arsenault [Mon, 4 Feb 2019 18:58:27 +0000 (18:58 +0000)]
GlobalISel: Improve gtest usage
Don't unnecessarily use ASSERT_*, and print the MachineFunction
on failure.
llvm-svn: 353072
David Callahan [Mon, 4 Feb 2019 18:46:25 +0000 (18:46 +0000)]
Adjust cardinality of internal inliner thresholds
Summary:
While compiling openJDK11 (also other workloads), some make files would pass both CFLAGS and LDFLAGS at link step ; resulting in duplicate options on the command line when one is using LTO and trying to influence the inliner. Most of the internal flags are ZeroOrMore, this diff changes the remaining ones.
Reviewers: david2050, twoh, modocache
Reviewed By: twoh
Subscribers: mehdi_amini, dexonsmith, eraman, haicheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57537
Patch by: Abdoul-Kader Keita
llvm-svn: 353071
Craig Topper [Mon, 4 Feb 2019 18:43:55 +0000 (18:43 +0000)]
[X86] Add ST0 as an implicit def/use of x87 load/store instructions during FP stackifying.
These instructions implicitly operate on ST0, but we don't currently add that information to the MachineInstr. We also don't add it the tablegen definitions either.
For the most part this doesn't cause any problems because the stackifying occurs after register allocation. All the instructions are marked as having side effects so the postRA scheduler won't reorder them amongst themselves.
But nothing stops inline assembly using X87 instructions from being reordered around other x87 instructions if that inline assembly wasn't marked volatile.
The two test cases I've identified so far in PR40539 involve loads and stores used to set up the inline assembly or capture the results of the inline assembly ending up in the wrong order.
This patch adds implicit ST0 uses/defs to the load/store instructions to prevent this from happening.
I plan to fix all of the FP instructions, but the binops are bit trickier to get right. So I've chosen fixing the known test cases as a good first step.
I think we also need to update the tablegen descriptions so MS inline assembly infers the right clobbers, but I haven't checked that yet.
Differential Revision: https://reviews.llvm.org/D57644
llvm-svn: 353070
Matt Arsenault [Mon, 4 Feb 2019 18:42:24 +0000 (18:42 +0000)]
GlobalISel: Fix moreElementsToNextPow2
This was completely broken. The condition was inverted, and changed
the element type for vectors of pointers.
Fixes bug 40592.
llvm-svn: 353069
Jordan Rupprecht [Mon, 4 Feb 2019 18:38:00 +0000 (18:38 +0000)]
[llvm-objcopy][NFC] Use StringSaver for --keep-global-symbols
Summary: Use StringSaver/BumpPtrAlloc when parsing lines from --keep-global-symbols files. This allows us to consistently use StringRef for driver options, which avoids copying the full strings for each object copied, as well as simplifies part of D57517.
Reviewers: jhenderson, evgeny777, alexshap
Subscribers: jakehehrlich
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57617
llvm-svn: 353068
Wouter van Oortmerssen [Mon, 4 Feb 2019 18:03:11 +0000 (18:03 +0000)]
[WebAssembly] Make segment/size/type directives optional in asm
Summary:
These were "boilerplate" that repeated information already present
in .functype and end_function, that needed to be repeated to Please
the particular way our object writing works, and missing them would
generate errors.
Instead, we generate the information for these automatically so the
user can concern itself with writing more canonical wasm functions
that always work as expected.
Reviewers: dschuff, sbc100
Subscribers: jgravelle-google, aheejin, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D57546
llvm-svn: 353067
Sam Clegg [Mon, 4 Feb 2019 17:49:33 +0000 (17:49 +0000)]
[WebAssembly] Update relocation naming to match llvm change. NFC.
Differential Revision: https://reviews.llvm.org/D57698
llvm-svn: 353066
Jessica Paquette [Mon, 4 Feb 2019 17:32:47 +0000 (17:32 +0000)]
Revert "[GlobalISel] Introduce a generic floating point floor opcode, G_FFLOOR"
This reverts commit
b05ecba6d687fcb3078509220c67458bf1d77a2e.
Apparently adding floor breaks AMDGPU somehow, so I have to back this out
while I look into it.
llvm-svn: 353065
Jessica Paquette [Mon, 4 Feb 2019 17:32:43 +0000 (17:32 +0000)]
Revert "[GlobalISel] Add IRTranslator support for G_FFLOOR"
This reverts commit
8bbd570fd5205a04d88d2e5513a6e4adbd028039.
Apparently adding ffloor breaks AMDGPU somehow, so I need to back this out
while I look into it.
llvm-svn: 353064
Nico Weber [Mon, 4 Feb 2019 17:32:36 +0000 (17:32 +0000)]
gn build: Merge r352944
llvm-svn: 353063
Sam Clegg [Mon, 4 Feb 2019 17:28:46 +0000 (17:28 +0000)]
[WebAssembly] Rename relocations from R_WEBASSEMBLY_ to R_WASM_
See https://github.com/WebAssembly/tool-conventions/pull/95.
This is less typing and IMHO more readable, and it also fits with
our naming around the binary format which tends to use the short name.
e.g.
include/llvm/BinaryFormat/Wasm.h
tools/llvm-objdump/WasmDump.cpp
etc..
Differential Revision: https://reviews.llvm.org/D57611
llvm-svn: 353062
Craig Topper [Mon, 4 Feb 2019 17:28:18 +0000 (17:28 +0000)]
[X86] Print all register forms of x87 fadd/fsub/fdiv/fmul as having two arguments where on is %st.
All of these instructions consume one encoded register and the other register is %st. They either write the result to %st or the encoded register. Previously we printed both arguments when the encoded register was written. And we printed one argument when the result was written to %st. For the stack popping forms the encoded register is always the destination and we didn't print both operands. This was inconsistent with gcc and objdump and just makes the output assembly code harder to read.
This patch changes things to always print both operands making us consistent with gcc and objdump. The parser should still be able to handle the single register forms just as it did before. This also matches the GNU assembler behavior.
llvm-svn: 353061
Sam Clegg [Mon, 4 Feb 2019 17:26:22 +0000 (17:26 +0000)]
[WebAssembly] Remove redundant namespaces qualifiers. NFC.
Differential Revision: https://reviews.llvm.org/D57610
llvm-svn: 353060
Leonard Chan [Mon, 4 Feb 2019 17:18:11 +0000 (17:18 +0000)]
[Intrinsic] Unsigned Fixed Point Multiplication Intrinsic
Add an intrinsic that takes 2 unsigned integers with the scale of them
provided as the third argument and performs fixed point multiplication on
them.
This is a part of implementing fixed point arithmetic in clang where some of
the more complex operations will be implemented as intrinsics.
Differential Revision: https://reviews.llvm.org/D55625
llvm-svn: 353059
Jessica Paquette [Mon, 4 Feb 2019 17:15:34 +0000 (17:15 +0000)]
[GlobalISel] Add IRTranslator support for G_FFLOOR
Follow-up to https://reviews.llvm.org/D57484
Adds G_FFLOOR to translateKnownIntrinsic and update arm64-irtranslator.ll.
Differential Revision: https://reviews.llvm.org/D57485
llvm-svn: 353058
Jessica Paquette [Mon, 4 Feb 2019 17:10:55 +0000 (17:10 +0000)]
[GlobalISel] Introduce a generic floating point floor opcode, G_FFLOOR
This introduces a generic opcode for floating point floor, working towards
selecting @llvm.floor.
Differential Revision: https://reviews.llvm.org/D57484
llvm-svn: 353057
Sanjay Patel [Mon, 4 Feb 2019 16:30:46 +0000 (16:30 +0000)]
[CGP] use IRBuilder to simplify code
This is no-functional-change-intended although there could
be intermediate variations caused by a difference in the
debug info produced by setting that from the builder's
insertion point.
I'm updating the IR test file associated with this code just
to show that the naming differences from using the builder
are visible.
The motivation for adding a helper function is that we are
likely to extend this code to deal with other overflow ops.
llvm-svn: 353056
Kostya Kortchinsky [Mon, 4 Feb 2019 16:25:40 +0000 (16:25 +0000)]
[scudo] Initial standalone skeleton check-in
Summary:
This is the initial check-in for the Standalone version of Scudo.
The project is initially going to live in scudo/standalone then will
replace scudo. See http://lists.llvm.org/pipermail/llvm-dev/2019-January/129113.html
for details.
This initial CL is meant to lay out the project structure, of both
code & tests, providing a minimal amount of functionalities, namely
various definitions, some atomic helpers and an intrusive list.
(empty.cc is just here to have a compilation unit, but will go away
in the upcoming CLs).
Initial support is restricted to Linux i386 & x86_64 in make files
and will be extended once things land & work.
We will grow organically from here, adding functionalities in limited
amounts.
Reviewers: morehouse, eugenis, vitalybuka, kcc, mcgrathr, flowerhack
Reviewed By: morehouse, vitalybuka
Subscribers: srhines, mgorny, krytarowski, delcypher, jfb, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D57412
llvm-svn: 353055
Kadir Cetinkaya [Mon, 4 Feb 2019 16:19:57 +0000 (16:19 +0000)]
[clangd] Enable include insertion for static index
Summary:
This enables include insertion by adding canonical includes into
preambledata.
Reviewers: ioeric, ilya-biryukov
Subscribers: javed.absar, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D57508
llvm-svn: 353054
James Henderson [Mon, 4 Feb 2019 16:17:57 +0000 (16:17 +0000)]
[CommandLine] Don't print empty sentinel values from EnumValN lists in help text
In order to make an option value truly optional, both the ValueOptional
attribute and an empty-named value are required. Prior to this change,
this empty-named value appears in the command-line help text:
-some-option - some help text
=v1 - description 1
=v2 - description 2
= -
This change improves the help text for these sort of options in a number
of ways:
1) ValueOptional options with an empty-named value now print their help
text twice: both without and then with '=<value>' after the name. The
latter version then lists the allowed values after it.
2) Empty-named values with no help text in ValueOptional options are not
listed in the permitted values.
-some-option - some help text
-some-option=<value> - some help text
=v1 - description 1
=v2 - description 2
3) Otherwise empty-named options are printed as =<empty> rather than
simply '='.
4) Option values without help text do not have the '-' separator
printed.
-some-option=<value> - some help text
=v1 - description 1
=v2
=<empty> - description
It also tweaks the llvm-symbolizer -functions help text to not print a
trailing ':' as that looks bad combined with 1) above.
This is mostly a reland of r353048 which in turn was a reland of
r352750.
Reviewed by: ruiu, thopre, mstorsjo
Differential Revision: https://reviews.llvm.org/D57030
llvm-svn: 353053
Joachim Protze [Mon, 4 Feb 2019 15:59:42 +0000 (15:59 +0000)]
[OMPT] Make sure that OMPT is enabled when accessing internals of the runtime
The three switch fallthrough generate a warning with -Wimplicit-fallthrough.
Two are documented as fallthrough, one is not, but I think the intention is to also fallthrough in kmp_tasking.cpp.
Not sure whether kmp.h is the best place to define the macro.
Reviewers: jlpeyton, AndreyChurbanov, Hahnfeld
Reviewed By: jlpeyton
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D56397
llvm-svn: 353052
Simon Pilgrim [Mon, 4 Feb 2019 15:43:36 +0000 (15:43 +0000)]
[X86][SSE] SimplifyDemandedBitsForTargetNode - PCMPGT(0,X) sign mask
For PCMPGT(0, X) patterns where we only demand the sign bit (e.g. BLENDV or MOVMSK) then we can use X directly.
Differential Revision: https://reviews.llvm.org/D57667
llvm-svn: 353051
James Henderson [Mon, 4 Feb 2019 15:09:58 +0000 (15:09 +0000)]
Revert r353048.
It was causing unexpected unit test failures on build bots.
llvm-svn: 353050
Pavel Labath [Mon, 4 Feb 2019 15:03:06 +0000 (15:03 +0000)]
Fixes for the ProcessLaunchInfo move
llvm-svn: 353049
James Henderson [Mon, 4 Feb 2019 14:48:33 +0000 (14:48 +0000)]
[CommandLine] Don't print empty sentinel values from EnumValN lists in help text
In order to make an option value truly optional, both the ValueOptional
attribute and an empty-named value are required. Prior to this change,
this empty-named value appears in the command-line help text:
-some-option - some help text
=v1 - description 1
=v2 - description 2
= -
This change improves the help text for these sort of options in a number
of ways:
1) ValueOptional options with an empty-named value now print their help
text twice: both without and then with '=<value>' after the name. The
latter version then lists the allowed values after it.
2) Empty-named values with no help text in ValueOptional options are not
listed in the permitted values.
-some-option - some help text
-some-option=<value> - some help text
=v1 - description 1
=v2 - description 2
3) Otherwise empty-named options are printed as =<empty> rather than
simply '='.
4) Option values without help text do not have the '-' separator
printed.
-some-option=<value> - some help text
=v1 - description 1
=v2
=<empty> - description
It also tweaks the llvm-symbolizer -functions help text to not print a
trailing ':' as that looks bad combined with 1) above.
This is mostly a reland of r352750.
Reviewed by: ruiu, thopre, mstorsjo
Differential Revision: https://reviews.llvm.org/D57030
llvm-svn: 353048
Pavel Labath [Mon, 4 Feb 2019 14:28:08 +0000 (14:28 +0000)]
Move FileAction, ProcessInfo and ProcessLaunchInfo from Target to Host
Summary:
These classes describe the details of the process we are about to
launch, and so they are naturally used by the launching code in the Host
module. Previously they were present in Target because that is the most
important (but by far not the only) user of the launching code.
Since the launching code has other customers, must of which do not care
about Targets, it makes sense to move these classes to the Host layer,
next to the launching code.
This move reduces the number of times that Target is included from host
to 8 (it used to be 14).
Reviewers: zturner, clayborg, jingham, davide, teemperor
Subscribers: emaste, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D56602
llvm-svn: 353047
Matt Arsenault [Mon, 4 Feb 2019 14:05:33 +0000 (14:05 +0000)]
GlobalISel: Fix formatting of debug output
There was a missing space before the instruction name, and the newline
is redundant since MI::print by default adds one.
llvm-svn: 353046
Matt Arsenault [Mon, 4 Feb 2019 14:04:52 +0000 (14:04 +0000)]
AMDGPU/GlobalISel: Legalize select for v4s16
Also add some more select tests to help show future legalization
changes.
llvm-svn: 353045
Simon Pilgrim [Mon, 4 Feb 2019 13:44:49 +0000 (13:44 +0000)]
[DAGCombine] Add ADD(SUB,SUB) combines
Noticed while investigating PR40483, and fixes the basic test case from the bug - but not a more general case.
We're pretty weak at dealing with ADD/SUB combines compared to the SimplifyAssociativeOrCommutative/SimplifyUsingDistributiveLaws abilities that InstCombine can manage.
llvm-svn: 353044
Andrea Di Biagio [Mon, 4 Feb 2019 12:51:26 +0000 (12:51 +0000)]
[AsmPrinter] Remove hidden flag -print-schedule.
This patch removes hidden codegen flag -print-schedule effectively reverting the
logic originally committed as r300311
(https://llvm.org/viewvc/llvm-project?view=revision&revision=300311).
Flag -print-schedule was originally introduced by r300311 to address PR32216
(https://bugs.llvm.org/show_bug.cgi?id=32216). That bug was about adding "Better
testing of schedule model instruction latencies/throughputs".
These days, we can use llvm-mca to test scheduling models. So there is no longer
a need for flag -print-schedule in LLVM. The main use case for PR32216 is
now addressed by llvm-mca.
Flag -print-schedule is mainly used for debugging purposes, and it is only
actually used by x86 specific tests. We already have extensive (latency and
throughput) tests under "test/tools/llvm-mca" for X86 processor models. That
means, most (if not all) existing -print-schedule tests for X86 are redundant.
When flag -print-schedule was first added to LLVM, several files had to be
modified; a few APIs gained new arguments (see for example method
MCAsmStreamer::EmitInstruction), and MCSubtargetInfo/TargetSubtargetInfo gained
a couple of getSchedInfoStr() methods.
Method getSchedInfoStr() had to originally work for both MCInst and
MachineInstr. The original implmentation of getSchedInfoStr() introduced a
subtle layering violation (reported as PR37160 and then fixed/worked-around by
r330615).
In retrospect, that new API could have been designed more optimally. We can
always query MCSchedModel to get the latency and throughput. More importantly,
the "sched-info" string should not have been generated by the subtarget.
Note, r317782 fixed an issue where "print-schedule" didn't work very well in the
presence of inline assembly. That commit is also reverted by this change.
Differential Revision: https://reviews.llvm.org/D57244
llvm-svn: 353043
Simon Pilgrim [Mon, 4 Feb 2019 12:37:38 +0000 (12:37 +0000)]
[X86] Add a couple of missed ADD combine tests
Noticed while investigating PR40483
llvm-svn: 353042
Simon Pilgrim [Mon, 4 Feb 2019 12:32:39 +0000 (12:32 +0000)]
Use auto for dyn_cast case to save a line. NFCI.
llvm-svn: 353041
David Green [Mon, 4 Feb 2019 11:58:48 +0000 (11:58 +0000)]
[ARM] Mark 255 and 65535 as cheap for Thumb1 "And"
This prevents Constant Hoisting from pulling the constant out of the block,
allowing us to still produce LDRH/UXTH nodes. LDRB/UXTB (255) is already cheap
by the default getIntImmCost, but I've added it for clarity.
Differential Revision: https://reviews.llvm.org/D57671
llvm-svn: 353040
David Green [Mon, 4 Feb 2019 11:50:14 +0000 (11:50 +0000)]
[ARM] Add testcases for D57671. NFC
llvm-svn: 353039
Max Kazantsev [Mon, 4 Feb 2019 10:41:17 +0000 (10:41 +0000)]
[NFC] Make a check in GuardWidening more obvious
llvm-svn: 353038
Dmitry Venikov [Mon, 4 Feb 2019 10:32:07 +0000 (10:32 +0000)]
Commit tests for changes in revision D41608
llvm-svn: 353037
Max Kazantsev [Mon, 4 Feb 2019 10:31:18 +0000 (10:31 +0000)]
[NFC] Rename variables to reflect the actual status of GuardWidening
llvm-svn: 353036
Clement Courbet [Mon, 4 Feb 2019 10:24:42 +0000 (10:24 +0000)]
[llvm-objcopy][NFC] Fix trailing semicolon warning.
llvm-svn: 353035
Max Kazantsev [Mon, 4 Feb 2019 10:20:51 +0000 (10:20 +0000)]
[NFC] Remove redundant parameters for better readability
llvm-svn: 353034
Krasimir Georgiev [Mon, 4 Feb 2019 09:56:16 +0000 (09:56 +0000)]
[clang-format] Fix breaking of qualified operator
Summary:
From https://bugs.llvm.org/show_bug.cgi?id=40516
```
$ cat a.cpp
const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::myFunction() {
// do stuff
}
const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::operator++() {
// do stuff
}
$ ~/ll/build/opt/bin/clang-format -style=LLVM a.cpp
const NamespaceName::VeryLongClassName &
NamespaceName::VeryLongClassName::myFunction() {
// do stuff
}
const NamespaceName::VeryLongClassName &NamespaceName::VeryLongClassName::
operator++() {
// do stuff
}
```
What was happening is that the split penalty before `operator` was being set to
a smaller value by a prior if block. Moved checks around to fix this and added a
regression test.
Reviewers: djasper
Reviewed By: djasper
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57604
llvm-svn: 353033
Max Kazantsev [Mon, 4 Feb 2019 09:55:18 +0000 (09:55 +0000)]
[NFC] Replace equivalent condition for better readability
llvm-svn: 353032