Max Kazantsev [Tue, 7 Aug 2018 01:47:20 +0000 (01:47 +0000)]
[NFC] Factor out implicit control flow logic from GVN
Logic for tracking implicit control flow instructions was added to GVN to
perform PRE optimizations correctly. It appears that GVN is not the only
optimization that sometimes does PRE, so this logic is required in other
places (such as Jump Threading).
This is an NFC patch that encapsulates all ICF-related logic in a dedicated
utility class separated from GVN.
Differential Revision: https://reviews.llvm.org/D40293
llvm-svn: 339086
Balaji V. Iyer [Tue, 7 Aug 2018 00:31:44 +0000 (00:31 +0000)]
Performing a test commmit as requested by Chris Lattner.
-This line, and those below, will be ignored--
M TemplateBase.h
llvm-svn: 339085
Heejin Ahn [Tue, 7 Aug 2018 00:22:22 +0000 (00:22 +0000)]
[WebAssembly] Enable atomic expansion for unsupported atomicrmws
Summary:
Wasm does not have direct counterparts to some of LLVM IR's atomicrmw
instructions (min, max, umin, umax, and nand). This enables atomic
expansion using cmpxchg instruction within a loop for those atomicrmw
instructions.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D49440
llvm-svn: 339084
Fangrui Song [Mon, 6 Aug 2018 23:50:26 +0000 (23:50 +0000)]
[ELF] Use MathExtras.h llvm::SignExtend64
Summary: To be consistent with other files where only SignExtend64 is used.
Reviewers: ruiu, espindola
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D50366
llvm-svn: 339083
Derek Schuff [Mon, 6 Aug 2018 23:16:50 +0000 (23:16 +0000)]
[WebAssembly] Replace SIMD expression types with V128
Summary:
The spec only defines a SIMD expression type of V128 and
leaves interpretation of different vector types to the instructions.
Differential Revision: https://reviews.llvm.org/D50367
Patch by Thomas Lively
llvm-svn: 339082
Max Moroz [Mon, 6 Aug 2018 23:14:13 +0000 (23:14 +0000)]
[libFuzzer] Add unstable function printing to print_unstable_stats flag
Summary:
There may be cases in which a user wants to know which part of their code is unstable.
We use ObservedFuncs and UnstableCounters to print at exit which of the ObservedFunctions
are unstable under the -print_unstable_stats flag.
Patch by Kyungtak Woo (@kevinwkt).
Reviewers: Dor1s, metzman, morehouse
Reviewed By: Dor1s, metzman, morehouse
Subscribers: delcypher, #sanitizers, llvm-commits, kcc
Differential Revision: https://reviews.llvm.org/D50264
llvm-svn: 339081
Emmett Neyman [Mon, 6 Aug 2018 23:11:38 +0000 (23:11 +0000)]
Changed how LLVM IR was generated to increase vectorization
Summary: Changed the structure of the generated IR to make it easier to vectorize
Reviewers: morehouse, kcc
Reviewed By: morehouse
Subscribers: cfe-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D50342
llvm-svn: 339080
George Karpenkov [Mon, 6 Aug 2018 23:09:07 +0000 (23:09 +0000)]
[analyzer] Add ASTContext to CheckerManager
Some checkers require ASTContext. Having it in the constructor saves a
lot of boilerplate of having to pass it around.
Differential Revision: https://reviews.llvm.org/D50111
llvm-svn: 339079
Matt Arsenault [Mon, 6 Aug 2018 23:01:31 +0000 (23:01 +0000)]
AMDGPU: cvt_pk_rtz_f16 canonicalizes
llvm-svn: 339078
Matt Arsenault [Mon, 6 Aug 2018 22:45:51 +0000 (22:45 +0000)]
AMDGPU: Handle some vector operations in isCanonicalized
llvm-svn: 339077
Stella Stamenova [Mon, 6 Aug 2018 22:37:53 +0000 (22:37 +0000)]
[lit, python] Always add quotes around the python path in lit
Summary:
The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes.
This is a companion change to: https://reviews.llvm.org/D50206
Reviewers: asmith, zturner
Differential Revision: https://reviews.llvm.org/D50280
llvm-svn: 339076
Stella Stamenova [Mon, 6 Aug 2018 22:37:49 +0000 (22:37 +0000)]
[lit, python] Always add quotes around the python path in lit
Summary:
The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes.
This is a companion change to: https://reviews.llvm.org/D50206
Reviewers: asmith, zturner, espindola
Subscribers: emaste, sbc100, arichardson, aheejin, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D50282
llvm-svn: 339075
Stella Stamenova [Mon, 6 Aug 2018 22:37:45 +0000 (22:37 +0000)]
[lit, python] Always add quotes around the python path in lit
Summary:
The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes.
This is a companion change to: https://reviews.llvm.org/D50206
Reviewers: asmith, zturner
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50281
llvm-svn: 339074
Stella Stamenova [Mon, 6 Aug 2018 22:37:44 +0000 (22:37 +0000)]
[lit, python] Always add quotes around the python path in lit
Summary:
The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes.
This change updates several configuration files which specify the path to python as a substitution and also remove quotes from existing tests.
Reviewers: asmith, zturner, alexshap, jakehehrlich
Reviewed By: zturner, alexshap, jakehehrlich
Subscribers: mehdi_amini, nemanjai, eraman, kbarton, jakehehrlich, steven_wu, dexonsmith, stella.stamenova, delcypher, llvm-commits
Differential Revision: https://reviews.llvm.org/D50206
llvm-svn: 339073
Matt Arsenault [Mon, 6 Aug 2018 22:30:44 +0000 (22:30 +0000)]
AMDGPU: Push fcanonicalize through partially constant build_vector
This usually avoids some re-packing code, and may
help find canonical sources.
llvm-svn: 339072
Stephane Sezer [Mon, 6 Aug 2018 22:21:28 +0000 (22:21 +0000)]
Revert "Add a relocation for R_AARCH64_ABS32 in ObjectFileELF"
This reverts commit
f055ce7eb893cd0d17ebcfd4125018f46f983aff.
llvm-svn: 339071
Matt Arsenault [Mon, 6 Aug 2018 22:10:26 +0000 (22:10 +0000)]
AMDGPU: Refactor fcanonicalize combine
This will make more complex combines easier.
llvm-svn: 339070
Philip Reames [Mon, 6 Aug 2018 22:07:37 +0000 (22:07 +0000)]
[LICM] Extract a helper function for readability [NFC]
llvm-svn: 339069
Stephane Sezer [Mon, 6 Aug 2018 22:04:08 +0000 (22:04 +0000)]
Add a relocation for R_AARCH64_ABS32 in ObjectFileELF
Summary:
.rela.debug_info relocations are being done via
ObjectFileELF::ApplyRelocations for aarch64. Currently, the switch case
that iterates over the relocation type is only implemented for a few
different types and `assert(false)`es over the rest.
Implement the relocation for R_AARCH64_ABS32 in ApplyRelocations
Reviewers: sas, xiaobai, peter.smith, clayborg, javed.absar, espindola
Differential Revision: https://reviews.llvm.org/D49407
Change by Nathan Lanza <lanza@fb.com>
llvm-svn: 339068
Reka Kovacs [Mon, 6 Aug 2018 22:03:42 +0000 (22:03 +0000)]
[analyzer] InnerPointerChecker: fix displayed checker name.
For InnerPointerChecker to function properly, both the checker itself
and parts of MallocChecker that handle relevant use-after-free problems
need to be turned on. So far, the latter part has been developed within
MallocChecker's NewDelete sub-checker, often causing warnings to appear
under that name. This patch defines a new CheckKind within MallocChecker
for the inner pointer checking functionality, so that the correct name
is displayed in warnings and in the ExplodedGraph.
Tested on clang-tidy.
Differential Review: https://reviews.llvm.org/D50211
llvm-svn: 339067
Peter Collingbourne [Mon, 6 Aug 2018 21:59:58 +0000 (21:59 +0000)]
MC: Redirect .addrsig directives referring to private (.L) symbols to the section symbol.
This matches our behaviour for regular (i.e. relocated) references to
private symbols and therefore avoids needing to unnecessarily write
address-significant .L symbols to the object file's symbol table,
which can interfere with stack traces.
Fixes check-cfi after r339050.
llvm-svn: 339066
Matt Arsenault [Mon, 6 Aug 2018 21:58:11 +0000 (21:58 +0000)]
AMDGPU: Treat more custom operations as canonicalizing
Everything should quiet, and I think everything should
flush.
I assume the min3/med3/max3 follow the same rules
as regular min/max for flushing, which should at
least be conservatively correct.
There are still more operations that need to
be handled.
llvm-svn: 339065
Matt Arsenault [Mon, 6 Aug 2018 21:51:52 +0000 (21:51 +0000)]
AMDGPU: Conversions always produce canonical results
Not sure why this was checking for denormals for f16.
My interpretation of the IEEE standard is conversions
should produce a canonical result, and the ISA manual
says denormals are created when appropriate.
llvm-svn: 339064
Simon Marchi [Mon, 6 Aug 2018 21:48:20 +0000 (21:48 +0000)]
[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name
Summary:
InMemoryFileSystem::status behaves differently than
RealFileSystem::status. The Name contained in the Status returned by
RealFileSystem::status will be the path as requested by the caller,
whereas InMemoryFileSystem::status returns the normalized path.
For example, when requested the status for "../src/first.h",
RealFileSystem returns a Status with "../src/first.h" as the Name.
InMemoryFileSystem returns "/absolute/path/to/src/first.h".
The reason for this change is that I want to make a unit test in the
clangd testsuite (where we use an InMemoryFileSystem) to reproduce a
bug I get with the clangd program (where a RealFileSystem is used).
This difference in behavior "hides" the bug in the unit test version.
An indirect impact of this change is that a -Wnonportable-include-path
warning is now emitted in test PCH/case-insensitive-include.c. This is
because the real path of the included file (with the wrong case) was not
available previously, whereas it is now.
Reviewers: malaperle, ilya-biryukov, bkramer
Reviewed By: ilya-biryukov
Subscribers: eric_niebler, malaperle, omtcyfz, hokein, bkramer, ilya-biryukov, ioeric, cfe-commits
Differential Revision: https://reviews.llvm.org/D48903
llvm-svn: 339063
Philip Reames [Mon, 6 Aug 2018 21:39:43 +0000 (21:39 +0000)]
[LICM] Further strengthen tests for hoisting guards and invariant.starts [NFC]
llvm-svn: 339062
Matt Arsenault [Mon, 6 Aug 2018 21:38:27 +0000 (21:38 +0000)]
AMDGPU: Fix implementation of isCanonicalized
If denormals are enabled, denormals are canonical.
Also fix a few other issues. minnum/maxnum are supposed
to canonicalize. Temporarily improve workaround for the
instruction behavior change in gfx9.
Handle selects and fcopysign.
The tests were also largely broken, since they were
checking for a flush used on some targets after the
store of the result.
llvm-svn: 339061
Rui Ueyama [Mon, 6 Aug 2018 21:29:41 +0000 (21:29 +0000)]
Add TARGET(foo) linker script directive.
GNU ld's manual says that TARGET(foo) is basically an alias for
`--format foo` where foo is a BFD target name such as elf64-x86-64.
Unlike GNU linkers, lld doesn't allow arbitrary BFD target name for
--format. We accept only "default", "elf" or "binary". This makes
situation a bit tricky because we can't simply make TARGET an alias for
--target.
A quick code search revealed that the usage number of TARGET is very
small, and the only meaningful usage is to switch to the binary mode.
Thus, in this patch, we handle only TARGET(elf.*) and TARGET(binary).
Differential Revision: https://reviews.llvm.org/D48153
llvm-svn: 339060
Reid Kleckner [Mon, 6 Aug 2018 21:26:47 +0000 (21:26 +0000)]
Fix a -Wsign-compare
llvm-svn: 339059
Martin Storsjo [Mon, 6 Aug 2018 21:26:09 +0000 (21:26 +0000)]
[COFF] Treat .xdata/.pdata$<sym> as implicitly associative to <sym> for MinGW
MinGW configurations don't use associative comdats, as GNU ld doesn't
support that. Instead they produce normal comdats named .text$sym,
.xdata$sym and .pdata$sym.
GNU ld doesn't discard any comdats starting with .xdata or .pdata,
even if --gc-sections is used (while it does discard other unreferenced
comdats), regardless of what symbol name is used after the $ separator.
For LLD, treat any such comdat as implicitly associative to the base
symbol. This requires maintaining a map from symbol name to section
number, but that is only maintained when the MinGW flag has been
enabled.
Differential Revision: https://reviews.llvm.org/D49700
llvm-svn: 339058
Philip Reames [Mon, 6 Aug 2018 21:18:34 +0000 (21:18 +0000)]
[LICM] Strengthen invariant.start hoisting tests [NFC]
llvm-svn: 339057
Reid Kleckner [Mon, 6 Aug 2018 21:16:16 +0000 (21:16 +0000)]
[X86] Fix assertion in subreg extraction
This assert fires when attempting to extract a subregister from the
global PIC base register. This virtual register SD node is not in the
VRBaseMap, so we shouldn't call getVR to look it up there. If this is a
RegisterSDNode, we should be able to use the virtual register directly.
Fixes PR38385
llvm-svn: 339056
Philip Reames [Mon, 6 Aug 2018 21:06:15 +0000 (21:06 +0000)]
[LICM] Add tests highlighting missing hoists for intrinsics [NFC]
llvm-svn: 339054
Vedant Kumar [Mon, 6 Aug 2018 20:13:52 +0000 (20:13 +0000)]
[IRMemoryMap] Avoid redundant zero-init in the Allocation constructor (NFC)
In the lldb-bench/arithmetic benchmark, 1.7% of the total running time
is spent zero-initializing a std::vector that has already been zeroed.
llvm-svn: 339051
Peter Collingbourne [Mon, 6 Aug 2018 20:12:12 +0000 (20:12 +0000)]
ELF: Enable address-significance tables during LTO.
This allows safe ICF to work when linking with LTO.
Differential Revision: https://reviews.llvm.org/D50221
llvm-svn: 339050
Martin Storsjo [Mon, 6 Aug 2018 19:49:18 +0000 (19:49 +0000)]
[COFF] Remove a superfluous warning about aligncomm for non-common symbols
It's not an error if a common symbol (uninitialized data, with alignment
specified via the aligncomm directive) is replaced with a regular
one with initialized data (with alignment specified via the section
chunk).
Differential Revision: https://reviews.llvm.org/D50268
llvm-svn: 339049
Martin Storsjo [Mon, 6 Aug 2018 19:48:44 +0000 (19:48 +0000)]
[MinGW] Predefine UNICODE if -municode is specified during compilation
Differential Revision: https://reviews.llvm.org/D50199
llvm-svn: 339048
Sam Clegg [Mon, 6 Aug 2018 19:45:12 +0000 (19:45 +0000)]
[WebAssembly] --export should fetch lazy symbols
--export now implies --undefined
This is really a requirement from emscripten but I think it
makes sense in general too.
Differential Revision: https://reviews.llvm.org/D50287
llvm-svn: 339047
Evandro Menezes [Mon, 6 Aug 2018 19:40:17 +0000 (19:40 +0000)]
[SLC] Fix shrinking of pow()
Properly shrink `pow()` to `powf()` as a binary function and, when no other
simplification applies, do not discard it.
Differential revision: https://reviews.llvm.org/D50113
llvm-svn: 339046
Alexandre Ganea [Mon, 6 Aug 2018 19:35:00 +0000 (19:35 +0000)]
[llvm-pdbutil] Support PDBs without a DBI stream
Differential Revision: https://reviews.llvm.org/D50258
llvm-svn: 339045
Leonard Chan [Mon, 6 Aug 2018 19:31:00 +0000 (19:31 +0000)]
Fix for broken build on clang-hexagon-elf for ambiguous call to
std::abs.
llvm-svn: 339044
Easwaran Raman [Mon, 6 Aug 2018 19:23:38 +0000 (19:23 +0000)]
[X86] Recognize a splat of negate in isFNEG
Summary:
Expand isFNEG so that we generate the appropriate F(N)M(ADD|SUB)
instructions in more cases. For example, the following sequence
a = _mm256_broadcast_ss(f)
d = _mm256_fnmadd_ps(a, b, c)
generates an fsub and fma without this patch and an fnma with this
change.
Reviewers: craig.topper
Subscribers: llvm-commits, davidxl, wmi
Differential Revision: https://reviews.llvm.org/D48467
llvm-svn: 339043
Fangrui Song [Mon, 6 Aug 2018 19:09:40 +0000 (19:09 +0000)]
[ELF] Don't copy STT_TLS in copy relocation
During copy relocation of a variable defined in a DSO, if a TLS variable in that DSO happens to have the same st_value, it would also be copied. This was unnecessary because the addresses of TLS variables are relative to TLS segment. They don't interfere with non-TLS variables.
This copying behavior can be harmful in the following scenario:
For function-scope thread-local variables with non-trivial constructors,
they have guard variables. In the case of x86_64 general-dynamic model:
template <int N>
void foo() {
thread_local std::string a;
}
GOT[n] R_X86_64_DTPMOD64 guard variable for a
GOT[n+1] R_X86_64_DTPOFF64 guard variable for a
GOT[n+2] R_X86_64_DTPMOD64 a
GOT[n+3] R_X86_64_DTPOFF64 a
a and its guard variable are both represented as TLS variables, which
should be within the same module. If one is copy relocated to the main
module while the other is not, their module ID will mismatch and can
cause access without prior construction.
Reviewers: ruiu, espindola
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D50289
llvm-svn: 339042
Craig Topper [Mon, 6 Aug 2018 18:44:26 +0000 (18:44 +0000)]
[X86] When using "and $0" and "orl $-1" to store 0 and -1 for minsize, make sure the store isn't volatile
If the store is volatile this might be a memory mapped IO access. In that case we shouldn't generate a load that didn't exist in the source
Differential Revision: https://reviews.llvm.org/D50270
llvm-svn: 339041
Craig Topper [Mon, 6 Aug 2018 18:44:21 +0000 (18:44 +0000)]
[X86] Add test cases to show bad use of "and $0" and "orl $-1" for minsize when the store is volatile
If the store is volatile we shouldn't be adding a little that didn't exist in the source.
llvm-svn: 339040
Erich Keane [Mon, 6 Aug 2018 18:11:48 +0000 (18:11 +0000)]
[NFC] Remove TODO comment that no longer applies (ParsedAttr)
llvm-svn: 339039
Leonard Chan [Mon, 6 Aug 2018 18:02:16 +0000 (18:02 +0000)]
Removed the OverflowConversionsToFract tests for now. Will add them back
in once I figure out why this doesn't work on windows.
llvm-svn: 339038
Leonard Chan [Mon, 6 Aug 2018 17:55:38 +0000 (17:55 +0000)]
Fix for failing test from sanitizer-x86_64-linux-fast where there was a
left shift on a negative value.
llvm-svn: 339037
David Greene [Mon, 6 Aug 2018 17:35:44 +0000 (17:35 +0000)]
Force test/Driver/fuchsia.c(pp) to use lld
The Fuchsia driver relies on lld so invoke clang with
-fuse-ld=lld. This gets the test passing when the clang default linker
is something other than lld.
Differential Revision: https://reviews.llvm.org/D49899
llvm-svn: 339036
Wei Mi [Mon, 6 Aug 2018 17:30:45 +0000 (17:30 +0000)]
[RegisterCoalescer] Delay live interval update work until the rematerialization
for all the uses from the same def is done.
We run into a compile time problem with flex generated code combined with
`-fno-jump-tables`. The cause is that machineLICM hoists a lot of invariants
outside of a big loop, and drastically increases the compile time in global
register splitting and copy coalescing. https://reviews.llvm.org/D49353
relieves the problem in global splitting. This patch is to handle the problem
in copy coalescing.
About the situation where the problem in copy coalescing happens. After
machineLICM, we have several defs outside of a big loop with hundreds or
thousands of uses inside the loop. Rematerialization in copy coalescing
happens for each use and everytime rematerialization is done, shrinkToUses
will be called to update the huge live interval. Because we have 'n' uses
for a def, and each live interval update will have at least 'n' complexity,
the total update work is n^2.
To fix the problem, we try to do the live interval update work in a collective
way. If a def has many copylike uses larger than a threshold, each time
rematerialization is done for one of those uses, we won't do the live interval
update in time but delay that work until rematerialization for all those uses
are completed, so we only have to do the live interval update work once.
Delaying the live interval update could potentially change the copy coalescing
result, so we hope to limit that change to those defs with many
(like above a hundred) copylike uses, and the cutoff can be adjusted by the
option -mllvm -late-remat-update-threshold=xxx.
Differential Revision: https://reviews.llvm.org/D49519
llvm-svn: 339035
Greg Clayton [Mon, 6 Aug 2018 17:26:53 +0000 (17:26 +0000)]
Fix more offsetof issues.
llvm-svn: 339034
Greg Clayton [Mon, 6 Aug 2018 17:07:50 +0000 (17:07 +0000)]
Fix offsetof usage that got lost when passing patches between linux and mac.
llvm-svn: 339033
Greg Clayton [Mon, 6 Aug 2018 16:56:10 +0000 (16:56 +0000)]
Add support for ARM and ARM64 breakpad generated minidump files (version 2).
In this patch I add support for ARM and ARM64 break pad files. There are two flavors of ARM: Apple where FP is R7, and non Apple where FP is R11. Added minimal tests that load up ARM64 and the two flavors or ARM core files with a single thread and known register values in each register. Each register is checked for the exact value.
This is a fixed version of: https://reviews.llvm.org/D49750
The changes from D49750 are:
Don't init the m_arch in the Initialize call as a system info isn't required. This keeps the thread list, module list and other tests from failing
Added -Wextended-offsetof to Xcode project so we catch use extended usages of offsetof before submission
Fixed any extended offset of warnings
Differential Revision: https://reviews.llvm.org/D50336
llvm-svn: 339032
Benjamin Kramer [Mon, 6 Aug 2018 16:53:21 +0000 (16:53 +0000)]
[Fixed Point Arithmetic] Remove unused include.
lib/Basic cannot depend on lib/AST.
llvm-svn: 339031
Bruno Ricci [Mon, 6 Aug 2018 16:47:31 +0000 (16:47 +0000)]
[AST] Remove unnecessary indirections in DeclarationNameTable
DeclarationNameTable currently hold 3 "void *" to
FoldingSet<CXXSpecialName>, FoldingSet<CXXLiteralOperatorIdName>
and FoldingSet<CXXDeductionGuideNameExtra>.
CXXSpecialName, CXXLiteralOperatorIdName and
CXXDeductionGuideNameExtra are private classes holding extra
information about a "special" declaration name and are in
AST/DeclarationName.cpp. The original intent seems to have
been to keep these classes private and only expose
DeclarationNameExtra and DeclarationName (the code dates from
2008 and has not been significantly changed since).
However this make the code less straightforward than necessary
because of the need to have "void *" in DeclarationNameTable
(with 1 of 3 comments wrong) and to manually allocate/deallocate
the FoldingSets.
Moreover removing the extra indirections reduce the run-time of
an fsyntax-only on all of Boost by 2.3% which is not totally
unexpected given how frequently this data structure is used
(especially for C++).
A concern raised by erichkeane during the review was that
including Type.h would increase the compile time unreasonably.
However test builds (both clean and incremental) showed that
this patch did not result in any compile time increase.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D50261
llvm-svn: 339030
Daniil Fukalov [Mon, 6 Aug 2018 16:47:24 +0000 (16:47 +0000)]
Fix typo in the MSVC Visualizer for SmallVector class
llvm-svn: 339029
Leonard Chan [Mon, 6 Aug 2018 16:42:37 +0000 (16:42 +0000)]
[Fixed Point Arithmetic] Fixed Point Constant
This patch proposes an abstract type that represents fixed point numbers, similar to APInt or APSInt that was discussed in https://reviews.llvm.org/D48456#inline-425585. This type holds a value, scale, and saturation and is meant to perform intermediate calculations on constant fixed point values.
Currently this class is used as a way for handling the conversions between fixed point numbers with different sizes and radixes. For example, if I'm casting from a signed _Accum to a saturated unsigned short _Accum, I will need to check the value of the signed _Accum to see if it fits into the short _Accum which involves getting and comparing against the max/min values of the short _Accum. The FixedPointNumber class currently handles the radix shifting and extension when converting to a signed _Accum.
Differential Revision: https://reviews.llvm.org/D48661
llvm-svn: 339028
Owen Reynolds [Mon, 6 Aug 2018 16:21:41 +0000 (16:21 +0000)]
Fix raw_fd_ostream::write_impl hang due to an infinite loop with large output
On windows when raw_fd_ostream::write_impl calls write, a 32 bit input is required for character count. As a variable with size_t is used for this argument, on x64 integral demotion occurs. In the case of large files an infinite loop follows.
See: https://bugs.llvm.org/show_bug.cgi?id=37926
This fix allows the output of files larger than the previous int32 limit.
Differential Revision: https://reviews.llvm.org/D48948
llvm-svn: 339027
Leonard Chan [Mon, 6 Aug 2018 16:05:08 +0000 (16:05 +0000)]
[Fixed Point Arithmetic] Fix for FixedPointValueToString
- Print negative numbers correctly
- Handle APInts of different sizes
- Add formal unit tests for FixedPointValueToString
- Add tests for checking correct printing when padding is set
- Restrict to printing in radix 10 since that's all we need for now
Differential Revision: https://reviews.llvm.org/D49945
llvm-svn: 339026
Matt Arsenault [Mon, 6 Aug 2018 15:40:20 +0000 (15:40 +0000)]
AMDGPU: Fold v_lshl_or_b32 with 0 src0
Appears from expansion of some packed cases.
llvm-svn: 339025
Bruno Ricci [Mon, 6 Aug 2018 15:17:32 +0000 (15:17 +0000)]
[AST] Add individual size info for Types in -print-stats
This mirrors what is done for Decls and Stmts in the -print-stats
output, ie instead of printing "57426 LValueReference types"
we print "57426 LValueReference types, 40 each (
2297040 bytes)".
llvm-svn: 339024
Matt Arsenault [Mon, 6 Aug 2018 15:16:26 +0000 (15:16 +0000)]
ValueTracking: Handle canonicalize in CannotBeNegativeZero
Also fix apparently missing test coverage for any of the
handling here.
llvm-svn: 339023
Matt Arsenault [Mon, 6 Aug 2018 15:16:12 +0000 (15:16 +0000)]
AMDGPU: Rename check prefixes in test
Will avoid noisy diff in future change.
llvm-svn: 339022
David Bolvansky [Mon, 6 Aug 2018 15:09:15 +0000 (15:09 +0000)]
[NFC] Fixed unused function warnings
llvm-svn: 339021
David Bolvansky [Mon, 6 Aug 2018 15:05:51 +0000 (15:05 +0000)]
Revert unused function fix
llvm-svn: 339020
David Bolvansky [Mon, 6 Aug 2018 14:42:07 +0000 (14:42 +0000)]
[NFC] Fixed unused function warning
llvm-svn: 339019
Gabor Marton [Mon, 6 Aug 2018 14:38:37 +0000 (14:38 +0000)]
[ASTmporter] SourceRange-free function parameter checking for declarations
Summary: The previous code which avoided infinite recursion (because of reparsing declarations in function parameter lists) contained SourceRange dependent code which had some problems when parameter types were coming from macros. The new solution is not using macros and therefore much safer. A couple of importer problems are fixed in redis and tmux by this fix. Various unittests are included.
Reviewers: a.sidorin, r.stahl, a_sidorin
Reviewed By: a_sidorin
Subscribers: cfe-commits, dkrupp, balazske, martong
Differential Revision: https://reviews.llvm.org/D49792
Patch by Zoltan Gera!
llvm-svn: 339018
Bruno Ricci [Mon, 6 Aug 2018 14:33:45 +0000 (14:33 +0000)]
[AST] Move the enum in ObjCMethodDeclBitfields
Move the enum { ObjCMethodFamilyBitWidth = 4 } to the top of
the class. For some dark reason having the enum between the
bitfields breaks the packing with gcc version 7.3-win32
20180312.
Reported by: Abramo Bagnara (by email)
llvm-svn: 339017
Louis Dionne [Mon, 6 Aug 2018 14:29:47 +0000 (14:29 +0000)]
[clang] Fix broken include_next in float.h
Summary:
The code defines __FLOAT_H and then includes the next <float.h>, which is
guarded on __FLOAT_H so it gets skipped entirely. This commit uses the header
guard __CLANG_FLOAT_H, like other headers (such as limits.h) do.
Reviewers: jfb
Subscribers: dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D50276
llvm-svn: 339016
Stefan Granitz [Mon, 6 Aug 2018 14:15:21 +0000 (14:15 +0000)]
Fix Mangled::Compare()
llvm-svn: 339015
Stefan Granitz [Mon, 6 Aug 2018 14:15:17 +0000 (14:15 +0000)]
Add ConstString::IsNull() to tell between null vs. empty strings and fix usage in Mangled::GetDemangledName()
Summary: `IsEmpty()` and `operator bool() == false` have equal semantics. Usage in Mangled::GetDemangledName() was incorrect. What it actually wants is a check for null-string. Split this off of D50071 and added a test to clarify usage.
Reviewers: labath, jingham
Subscribers: erik.pilkington, lldb-commits
Differential Revision: https://reviews.llvm.org/D50327
llvm-svn: 339014
Bryan Chan [Mon, 6 Aug 2018 14:14:41 +0000 (14:14 +0000)]
[AArch64] Fix assertion failure on widened f16 BUILD_VECTOR
Summary:
Ensure that NormalizedBuildVector returns a BUILD_VECTOR with operands of the
same type. This fixes an assertion failure in VerifySDNode.
Reviewers: SjoerdMeijer, t.p.northover, javed.absar
Reviewed By: SjoerdMeijer
Subscribers: kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D50202
llvm-svn: 339013
Louis Dionne [Mon, 6 Aug 2018 14:11:50 +0000 (14:11 +0000)]
[libc++] Add the _LIBCPP_HIDE_FROM_ABI_AFTER_V1 macro
Summary:
This macro allows hiding symbols from the ABI when the library is built
with an ABI version after ABI v1, which is currently the only stable ABI.
This commit defines `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` to be
`_LIBCPP_HIDE_FROM_ABI_AFTER_V1`, meaning that symbols that were only
exported by the library for historical reasons are not exported anymore
in the unstable ABI.
Because of that, this commit is an ABI break for ABI v2. This ABI version
is not stable, however, so this should not be a problem.
Reviewers: EricWF, mclow.lists
Subscribers: christof, dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D49914
llvm-svn: 339012
Haojian Wu [Mon, 6 Aug 2018 13:14:32 +0000 (13:14 +0000)]
[clangd] Index Interfaces for Xrefs
Summary:
This is the first step of implementing Xrefs in clangd:
- add index interfaces, and related data structures.
Reviewers: sammccall
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D49658
llvm-svn: 339011
Tim Northover [Mon, 6 Aug 2018 11:43:11 +0000 (11:43 +0000)]
Fix modules build with different technique to suppress Knuth debugging
Currently we use #pragma push_macro(LLVM_DEBUG) to fiddle with the LLVM_DEBUG
macro so that we can silence debugging the Knuth division algorithm unless it's
actually desired. Unfortunately this is incompatible with enabling modules
while building LLVM (via LLVM_ENABLE_MODULES=ON), probably due to a bug being
fixed by D33004.
llvm-svn: 339009
Hans Wennborg [Mon, 6 Aug 2018 11:34:46 +0000 (11:34 +0000)]
clang-cl: Parse the new /JMC flag
llvm-svn: 339008
Tim Northover [Mon, 6 Aug 2018 11:32:44 +0000 (11:32 +0000)]
ARM-MachO: don't add Thumb bit for addend to non-external relocation.
ld64 supplies its own Thumb bit for Thumb functions, and intentionally zeroes
out that part of any addend in an object file. But it only does that for
symbols marked N_EXT -- i.e. external symbols. So LLVM should avoid setting
that extra bit in other cases.
llvm-svn: 339007
Max Kazantsev [Mon, 6 Aug 2018 11:14:18 +0000 (11:14 +0000)]
Re-enable "[ValueTracking] Teach isKnownNonNullFromDominatingCondition about AND"
The patch was reverted because of bug detected by sanitizer. The bug is fixed,
respective tests added.
Differential Revision: https://reviews.llvm.org/D50172
llvm-svn: 339005
George Rimar [Mon, 6 Aug 2018 10:44:17 +0000 (10:44 +0000)]
[ELF] - Remove dead code from LinkerScript::assignOffsets(). NFC-ihope.
Some parts of the code changed are a bit old. I found traces in 2016.
Initiall commits has test cases and perhaps reasonable comments.
For example, we had segfaults earlier and had the code to fix them.
Now, in 2018, I think it is excessive to have these parts, because
we do not have segfaults and our code was changed a lot (softly saying).
I reviewed the current sources and I think that at this point of the
execution flow, we should never face with
the conditions checked and so I removing them in this patch.
This helps to cleanup the code.
llvm-svn: 339003
Chandler Carruth [Mon, 6 Aug 2018 10:20:05 +0000 (10:20 +0000)]
[docs] Continue working around broken Sphinx parsing of LLVM code blocks
by switching to `text` in another place.
llvm-svn: 339001
Peter Smith [Mon, 6 Aug 2018 10:06:24 +0000 (10:06 +0000)]
[ELF] Test undefined weak symbol for Thumb narrow branch
Add a test for the R_ARM_THM_JUMP11 relocation to an undefined symbol. We
have to use yaml2obj as llvm-mc relaxes the narrow branch to a b.w which
uses the R_ARM_THM_JUMP24 relocation instead.
Differential Revision: https://reviews.llvm.org/D50234
llvm-svn: 338999
Chandler Carruth [Mon, 6 Aug 2018 10:03:25 +0000 (10:03 +0000)]
[docs] Remove the `dso_local` tag from these functions.
The sphinx build bot is erroring on these examples for some unknown
reason, and really the dso_local doesn't seem to be relevant to the
example in any way so its cleaner to omit it. And now they will look
a bit more like other (successful) IR examples.
llvm-svn: 338998
Chandler Carruth [Mon, 6 Aug 2018 09:46:59 +0000 (09:46 +0000)]
[docs] Stop trying to parse the ThinLTO summary IR fragments with the
`llvm` syntax in Sphinx. This appears to just fail and create errors on
the docs buildbot.
llvm-svn: 338997
Jonas Toth [Mon, 6 Aug 2018 09:08:06 +0000 (09:08 +0000)]
[clang-rename] make clang-rename.py vim integration python3 compatible
Summary:
This patch makes the clang-rename.py script useable for vim with only python3
support. It uses the print-function and adjust the doc slightly to mention
the correct python3 command for the letter mapping in vim.
Reviewers: arphaman, klimek, aaron.ballman, hokein
Reviewed By: hokein
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50307
llvm-svn: 338996
Pavel Labath [Mon, 6 Aug 2018 08:27:59 +0000 (08:27 +0000)]
Change ConstString::SetCStringWithMangledCounterpart to use StringRef
This should simplify the upcoming demangling patch (D50071). While I was
in there, I also added a quick test for the function.
llvm-svn: 338995
Max Kazantsev [Mon, 6 Aug 2018 08:10:28 +0000 (08:10 +0000)]
Revert rL338990 to see if it causes sanitizer failures
Multiple failues reported by sanitizer-x86_64-linux, seem to be caused by this
patch. Reverting to see if they sustain without it.
Differential Revision: https://reviews.llvm.org/D50172
llvm-svn: 338994
Hsiangkai Wang [Mon, 6 Aug 2018 07:07:18 +0000 (07:07 +0000)]
Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"
Build failed in
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/27258
In lib/CodeGen/LiveDebugVariables.cpp:589, it uses std::prev(MBBI) to
get DebugValue's SlotIndex. however, the previous instruction may be
also a debug instruction.
llvm-svn: 338992
Max Kazantsev [Mon, 6 Aug 2018 06:35:21 +0000 (06:35 +0000)]
Try to fix buildbot
llvm-svn: 338991
Max Kazantsev [Mon, 6 Aug 2018 06:11:36 +0000 (06:11 +0000)]
[ValueTracking] Teach isKnownNonNullFromDominatingCondition about AND
`isKnownNonNullFromDominatingCondition` is able to prove non-null basing on `br` or `guard`
by `%p != null` condition, but is unable to do so basing on `(%p != null) && %other_cond`.
This patch allows it to do so.
Differential Revision: https://reviews.llvm.org/D50172
Reviewed By: reames
llvm-svn: 338990
Hsiangkai Wang [Mon, 6 Aug 2018 05:58:59 +0000 (05:58 +0000)]
[DebugInfo] Generate debug information for labels. (Fix PR37395)
Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.
After fixing PR37395.
Differential Revision: https://reviews.llvm.org/D45045
llvm-svn: 338989
Max Kazantsev [Mon, 6 Aug 2018 05:49:19 +0000 (05:49 +0000)]
[GuardWidening] Widen guards with conditions of frequently taken dominated branches
If there is a frequently taken branch dominated by a guard, and its condition is available
at the point of the guard, we can widen guard with condition of this branch and convert
the branch into unconditional:
guard(cond1)
if (cond2) {
// taken in 99.9% cases
// do something
} else {
// do something else
}
Converts to
guard(cond1 && cond2)
// do something
Differential Revision: https://reviews.llvm.org/D49974
Reviewed By: reames
llvm-svn: 338988
Xin Tong [Mon, 6 Aug 2018 05:03:21 +0000 (05:03 +0000)]
[NFC] Fix typo
llvm-svn: 338987
David Bolvansky [Mon, 6 Aug 2018 04:45:46 +0000 (04:45 +0000)]
[NFC] Fixed unused function warning
llvm-svn: 338986
Hsiangkai Wang [Mon, 6 Aug 2018 04:00:08 +0000 (04:00 +0000)]
[DebugInfo] Use DbgVariableIntrinsic as the base class of variables.
After refactoring DbgInfoIntrinsic class hierarchy, we use
DbgVariableIntrinsic as the base class of variable debug info.
In resolveTopLevelMetadata() in CGVTables.cpp, we only care about
dbg.value, so we try to cast the instructions to DbgVariableIntrinsic
before resolving variables.
Differential Revision: https://reviews.llvm.org/D50226
llvm-svn: 338985
Hsiangkai Wang [Mon, 6 Aug 2018 03:59:47 +0000 (03:59 +0000)]
[DebugInfo] Refactor DbgInfoIntrinsic class hierarchy.
In the past, DbgInfoIntrinsic has a strong assumption that these
intrinsics all have variables and expressions attached to them.
However, it is too strong to derive the class for other debug entities.
Now, it has problems for debug labels.
In order to make DbgInfoIntrinsic as a base class for 'debug info', I
create a class for 'variable debug info', DbgVariableIntrinsic.
DbgDeclareInst, DbgAddrIntrinsic, and DbgValueInst will be derived from it.
Differential Revision: https://reviews.llvm.org/D50220
llvm-svn: 338984
Chandler Carruth [Mon, 6 Aug 2018 03:35:36 +0000 (03:35 +0000)]
[docs] Switch debug info metadata blocks to use `text` instead of `llvm`
highlighting syntax.
Most of them already were like this, and the Sphinx runs on the docs
build bot seems to be substantially more picky and/or not have support
for a bunch of the syntax here. Hopefully this will let it progress past
this.
My previous attempt to fix the syntax made the `opt` tool happy, but no
idea what the Sphinx stuff is really looking for, and the fact that
other blocks already just use `text` led me to this solution.
llvm-svn: 338983
Chandler Carruth [Mon, 6 Aug 2018 02:30:01 +0000 (02:30 +0000)]
[docs] Correct the basic syntax structure of the DISubrange example.
Notably, just close two of the debug info metadata nodes early rather
than leaving them open with `...` which won't ever lex correctly. And
add the missing `:` on the count labels.
Slowly progressing through all of the warnings on the documentation
build bot. Sorry to do this one commit at a time, but despite my best
efforts I can't trigger these errors locally.
llvm-svn: 338982
Chandler Carruth [Mon, 6 Aug 2018 02:02:09 +0000 (02:02 +0000)]
[docs] Remove an example that isn't well formed LLVM IR and trips up the
Sphinx syntax highlighter.
This example also doesn't really make sense. There is no control flow or
clarification of what the `Safe:` block exists to do... If we want
examples here, we should make them much more clear in addition to making
them well formed IR sequences.
llvm-svn: 338981
Chandler Carruth [Mon, 6 Aug 2018 01:41:25 +0000 (01:41 +0000)]
[docs] Fix an LLVM-syntax code block to actually be valid LLVM synatx.
Hopefully fixes an issue on the docs build bot.
llvm-svn: 338980
Chandler Carruth [Mon, 6 Aug 2018 01:28:42 +0000 (01:28 +0000)]
[docs] Don't use the `asm` syntax highlighting (which our docs builder
errors on) and clean up the formattting.
This isn't actualy assembly anyways, so dropping the highlighting is
probably for the best.
llvm-svn: 338979
Chandler Carruth [Mon, 6 Aug 2018 01:19:43 +0000 (01:19 +0000)]
[docs] Turn of `nasm` highlighting for a code block.
This appears to produce a warning on the docs build bot. It doesn't
reproduce for me, likely because I have a newer (or more full featured)
pygments install.
llvm-svn: 338978