Craig Topper [Wed, 22 Aug 2018 23:27:50 +0000 (23:27 +0000)]
[ValueTracking] Teach computeNumSignBits to understand min/max clamp patterns with constant/splat values
If we have a min/max pair we can do a better job of counting sign bits if we look at them together. This is similar to what is done in the SelectionDAG version of computeNumSignBits for ISD::SMAX/SMIN.
Differential Revision: https://reviews.llvm.org/D51112
llvm-svn: 340480
George Karpenkov [Wed, 22 Aug 2018 23:23:17 +0000 (23:23 +0000)]
[NFC] Add tags file to .gitignore
Differential Revision: https://reviews.llvm.org/D50109
llvm-svn: 340479
Craig Topper [Wed, 22 Aug 2018 23:19:01 +0000 (23:19 +0000)]
[X86] Teach combineLoopSADPattern to handle cases where there is no loop and the add has two absolute difference inputs
Previously we asumed a vector reduction add is part of a loop and one of the input is a phi. But the code in SelectionDAGBuilder that sets vector reduction flag handles more cases than that. It just requires that the use chain ends in a horizontal reduction. And there are no other uses. This means it can handle unrolled reduction loops.
If the initial value of the reduction was 0, an unrolled loop would begin with a vector reduction add that has two sad inputs. Previously we would only transform one side of the add, but for this case we need to transform both sides.
I've created a lambda to reuse some of the code for both sides. And fixed the variables names to remove reference to "phi".
Differential Revision: https://reviews.llvm.org/D50817
llvm-svn: 340478
Craig Topper [Wed, 22 Aug 2018 23:18:58 +0000 (23:18 +0000)]
[X86] Add test cases for D50817. NFC
llvm-svn: 340477
Evandro Menezes [Wed, 22 Aug 2018 23:18:02 +0000 (23:18 +0000)]
[NFC] Refactor simplification of pow()
llvm-svn: 340476
George Karpenkov [Wed, 22 Aug 2018 23:17:25 +0000 (23:17 +0000)]
[analyzer] Track non-zero values in ReturnVisitor
Tracking those can help to provide much better diagnostics in many cases.
In general, most of the visitor machinery should be refactored to allow
tracking the origin of arbitrary values.
rdar://
36039765
Differential Revision: https://reviews.llvm.org/D51131
llvm-svn: 340475
George Karpenkov [Wed, 22 Aug 2018 23:17:02 +0000 (23:17 +0000)]
[analyzer] Track the problematic subexpression in UndefResultChecker
This is tested in a subsequent commit, which allows tracking those values.
Differential Revision: https://reviews.llvm.org/D51139
llvm-svn: 340474
George Karpenkov [Wed, 22 Aug 2018 23:16:44 +0000 (23:16 +0000)]
[analyzer] [NFC] Minor refactoring of BugReporterVisitors
Differential Revision: https://reviews.llvm.org/D51130
llvm-svn: 340473
Thomas Lively [Wed, 22 Aug 2018 23:06:27 +0000 (23:06 +0000)]
[WebAssembly] Arbitrary BUILD_VECTOR and remove i64x2.mul
Summary:
This CL adds support for arbitrary BUILD_VECTORS, i.e. not splats and
not consts. This is the last feature needed to properly lower v2i64
multiplies without a i64x2.mul instruction (which is not in the spec),
so i64x2.mul is removed as well.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51082
Remove unnecessary condition and fix whitespace
llvm-svn: 340472
Petr Hosek [Wed, 22 Aug 2018 22:56:46 +0000 (22:56 +0000)]
[Driver] Check normalized triples for multiarch runtime path
Previously we only used target triple as provided which matches the
GCC behavior, but it also means that all clients have to be consistent
in their spelling of target triples since e.g. x86_64-linux-gnu and
x86_64-unknown-linux-gnu will result in Clang driver looking at two
different paths when searching for runtime libraries.
Unfortunatelly, as it turned out many clients aren't consistent in
their spelling of target triples, e.g. many Linux distributions use
the shorter spelling but config.guess and rustc insist on using the
normalized variant which is causing issues. To avoid having to ship
multiple copies of runtimes for different triple spelling or rely on
symlinks which are not portable, we should also check the normalized
triple when constructing paths for multiarch runtimes.
Differential Revision: https://reviews.llvm.org/D50547
llvm-svn: 340471
Kostya Serebryany [Wed, 22 Aug 2018 22:55:16 +0000 (22:55 +0000)]
[hwasan] make error reporting look more like in asan, print the memory tag around the buggy access, simplify one test
llvm-svn: 340470
Sanjay Patel [Wed, 22 Aug 2018 22:52:05 +0000 (22:52 +0000)]
[SelectionDAG] unroll unsupported vector FP ops earlier to avoid libcalls on undef elements (PR38527)
This solves the motivating case from:
https://bugs.llvm.org/show_bug.cgi?id=38527
If we are legalizing an FP vector op that maps to 1 of the LLVM intrinsics that mimic libm calls,
but we're going to end up with scalar libcalls for that vector type anyway, then we should unroll
the vector op into scalars before widening. This avoids libcalls because we've lost the knowledge
that some of the scalar elements are undef.
Differential Revision: https://reviews.llvm.org/D50791
llvm-svn: 340469
Raphael Isemann [Wed, 22 Aug 2018 22:51:37 +0000 (22:51 +0000)]
[ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51121
llvm-svn: 340468
Raphael Isemann [Wed, 22 Aug 2018 22:50:45 +0000 (22:50 +0000)]
[ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test.
Summary:
The `array-init-loop-expr` test is currently not testing the importing of ArrayInitLoopExprs.
This is because we import the `S` struct into the `test.cpp` context
and only do a copy-assignment in `test.cpp`, so the actual ArrayInitLoopExpr we wanted to
import is generated by clang directly in the target context. This means we actually
never test the importing of ArrayInitLoopExpr with this test, which becomes obvious
when looking at the missing test coverage for the respective VisitArrayInitLoopExpr method.
This patch moves the copy-assignment of our struct to the `S.cpp` context, which means
that `test.cpp` now actually has to import the ArrayInitLoopExpr.
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51115
llvm-svn: 340467
Raphael Isemann [Wed, 22 Aug 2018 22:49:32 +0000 (22:49 +0000)]
[ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code.
Summary:
`CXXNamedCastExpr` importing is already handled in the respective `VisitCXXNamedCastExpr` method.
So this code here can never be reached under normal circumstances and we might as well remove it.
This patch shouldn't change any observable behavior of the ASTImporter.
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51110
llvm-svn: 340466
Raphael Isemann [Wed, 22 Aug 2018 22:48:40 +0000 (22:48 +0000)]
[ASTImporter] Add test for ObjCTypeParamDecl
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51059
llvm-svn: 340465
Raphael Isemann [Wed, 22 Aug 2018 22:47:10 +0000 (22:47 +0000)]
[ASTImporter] Add test for SwitchStmt
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51056
llvm-svn: 340464
Raphael Isemann [Wed, 22 Aug 2018 22:45:04 +0000 (22:45 +0000)]
[ASTImporter] Add test for ObjCAutoreleasePoolStmt
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51123
llvm-svn: 340463
Evandro Menezes [Wed, 22 Aug 2018 22:44:06 +0000 (22:44 +0000)]
[NFC] Expand test cases for simplifying pow()
llvm-svn: 340462
George Burgess IV [Wed, 22 Aug 2018 22:34:38 +0000 (22:34 +0000)]
[MemorySSA] Invalidate optimized Defs upon moving them; NFC
We're currently getting this behavior implicitly, since we determine if
a Def's optimization is valid based on the ID of its defining access.
This is incorrect, though I wouldn't be surprised if this was masked in
part by that we're using a WeakVH to track what Defs are optimized to.
(Not to mention that we don't move Defs super often, AFAICT). I'll
submit a patch to fix this shortly.
This also includes a minor refactor to reduce duplication a bit.
No test is included, since like said, this already happens to be our
behavior. I'll add a test for this with my fix to the other bug
mentioned above.
llvm-svn: 340461
Stephane Sezer [Wed, 22 Aug 2018 22:25:45 +0000 (22:25 +0000)]
Add include directory for libxml on macOS
Summary:
Builds fail because libxml/xmlreader.h isn't found. Adding the include
directory to the include list fixes the issue. This is what we already do on
non-macOS platforms in the same file.
Reviewers: clayborg, xiaobai, lanza
Reviewed By: clayborg, lanza
Subscribers: mgorny
Differential Revision: https://reviews.llvm.org/D50918
llvm-svn: 340460
Aaron Puchert [Wed, 22 Aug 2018 22:14:53 +0000 (22:14 +0000)]
Thread safety analysis: Allow relockable scopes
Summary:
It's already allowed to prematurely release a scoped lock, now we also
allow relocking it again, possibly even in another mode.
This is the second attempt, the first had been merged as r339456 and
reverted in r339558 because it caused a crash.
Reviewers: delesley, aaron.ballman
Reviewed By: delesley, aaron.ballman
Subscribers: hokein, cfe-commits
Differential Revision: https://reviews.llvm.org/D49885
llvm-svn: 340459
Eli Friedman [Wed, 22 Aug 2018 21:47:14 +0000 (21:47 +0000)]
[ARM] Lower llvm.ctlz.i32 to a libcall when clz is not available.
The inline sequence is very long (about 70 bytes on Thumb1), so it's
not really a good idea to inline it, especially when optimizing for
size.
Differential Revision: https://reviews.llvm.org/D47917
llvm-svn: 340458
Scott Linder [Wed, 22 Aug 2018 21:42:50 +0000 (21:42 +0000)]
[BinaryFormat] Add MessagePack reader/writer
Add support for reading and writing MessagePack, a binary object serialization
format which aims to be more compact than text formats like JSON or YAML.
The specification can be found at
https://github.com/msgpack/msgpack/blob/master/spec.md
Will be used for encoding metadata in AMDGPU code objects.
Differential Revision: https://reviews.llvm.org/D44429
llvm-svn: 340457
Eli Friedman [Wed, 22 Aug 2018 21:38:57 +0000 (21:38 +0000)]
[SafeStack] Handle unreachable code with safe stack coloring.
Instead of asserting that the function doesn't have any unreachable
code, just ignore it for the purpose of computing liveness.
Differential Revision: https://reviews.llvm.org/D51070
llvm-svn: 340456
Yonghong Song [Wed, 22 Aug 2018 21:21:03 +0000 (21:21 +0000)]
bpf: fix an assertion in BPFAsmBackend applyFixup()
Fix bug https://bugs.llvm.org/show_bug.cgi?id=38643
In BPFAsmBackend applyFixup(), there is an assertion for FixedValue to be 0.
This may not be true, esp. for optimiation level 0.
For example, in the above bug, for the following two
static variables:
@bpf_map_lookup_elem = internal global i8* (i8*, i8*)*
inttoptr (i64 1 to i8* (i8*, i8*)*), align 8
@bpf_map_update_elem = internal global i32 (i8*, i8*, i8*, i64)*
inttoptr (i64 2 to i32 (i8*, i8*, i8*, i64)*), align 8
The static variable @bpf_map_update_elem will have a symbol
offset of 8 and a FK_SecRel_8 with FixupValue 8 will cause
the assertion if llvm is built with -DLLVM_ENABLE_ASSERTIONS=ON.
The above relocations will not exist if the program is compiled
with optimization level -O1 and above as the compiler optimizes
those static variables away. In the below error message, -O2
is suggested as this is the common practice.
Note that FixedValue = 0 in applyFixup() does exist and is valid,
e.g., for the global variable my_map in the above bug. The bpf
loader will process them properly for map_id's before loading
the program into the kernel.
The static variables, which are not optimized away by compiler,
may have FK_SecRel_8 relocation with non-zero FixedValue.
The patch removed the offending assertion and will issue
a hard error as below if the FixedValue in applyFixup()
is not 0.
$ llc -march=bpf -filetype=obj fixup.ll
LLVM ERROR: Unsupported relocation: try to compile with -O2 or above,
or check your static variable usage
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 340455
Heejin Ahn [Wed, 22 Aug 2018 21:13:49 +0000 (21:13 +0000)]
[WebAssembly] Don't write SP back when prolog is generated only for EH
Summary:
When we don't actually have stack-allocated variables but need SP only
to support EH, we don't need to write SP back in the epilog, because we
don't bump down the stack pointer.
Reviewers: dschuff
Subscribers: jgravelle-google, sbc100, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51114
llvm-svn: 340454
Philip Reames [Wed, 22 Aug 2018 21:10:56 +0000 (21:10 +0000)]
[AST] Add a test for attribute intersection
Already works, but I initially convinced myself it doesn't, so add a test which shows it does. :)
llvm-svn: 340453
Aaron Puchert [Wed, 22 Aug 2018 21:06:04 +0000 (21:06 +0000)]
[NFC] Test commit
llvm-svn: 340452
Martin Storsjo [Wed, 22 Aug 2018 20:34:12 +0000 (20:34 +0000)]
[ARM] Avoid injecting constant islands in movw+movt pairs on Windows
On Windows, movw+movt pairs with relocations are handled with a single
relocation that covers them both. Therefore we can't inject anything
between these instructions, otherwise the relocation (which in LLVM
only is treated as the movw instruction's relocation, while the movt
instruction's relocation is dropped) will end up bogus.
These instructions are bundled up until right before the constant
islands pass, making this effectively the only place that can split
them apart.
Differential Revision: https://reviews.llvm.org/D51032
llvm-svn: 340451
Martin Storsjo [Wed, 22 Aug 2018 20:34:06 +0000 (20:34 +0000)]
[ARM] Move machine operand target flags to ARMBaseInstrInfo
This makes sure the flags are available for use for thumb MIR as well.
A test that requires this will be added in the next commit.
llvm-svn: 340450
Alex Lorenz [Wed, 22 Aug 2018 20:30:06 +0000 (20:30 +0000)]
[clangd] send diagnostic categories only when 'categorySupport'
capability was given by the client
After r339738 Clangd started sending categories with each diagnostic, but that
broke the eglot client. This commit puts the categories behind a capability to
fix that breakage.
Differential Revision: https://reviews.llvm.org/D51077
llvm-svn: 340449
Raphael Isemann [Wed, 22 Aug 2018 20:22:34 +0000 (20:22 +0000)]
Add unit test for StringLexer
Reviewers: labath, #lldb
Reviewed By: labath
Subscribers: jloser, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D50298
llvm-svn: 340448
Krzysztof Parzyszek [Wed, 22 Aug 2018 20:15:04 +0000 (20:15 +0000)]
[Hexagon] Enable interleaving in loop vectorizer
llvm-svn: 340447
Eli Friedman [Wed, 22 Aug 2018 20:13:45 +0000 (20:13 +0000)]
[ARM] Handle all-ones mask explicitly in targetShrinkDemandedConstant.
This avoids a potential infinite loop setting and unsetting bits in the
mask.
Reduced from a failure on the polly-aosp bot.
Differential Revision: https://reviews.llvm.org/D51066
llvm-svn: 340446
Alina Sbirlea [Wed, 22 Aug 2018 20:10:21 +0000 (20:10 +0000)]
Update MemorySSA in LoopSimplifyCFG.
Summary:
Add MemorySSA as a dependency to LoopSimplifyCFG and preserve it.
Disabled by default until all passes preserve MemorySSA.
Reviewers: bogner, chandlerc
Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits
Differential Revision: https://reviews.llvm.org/D50911
llvm-svn: 340445
Alina Sbirlea [Wed, 22 Aug 2018 20:05:21 +0000 (20:05 +0000)]
Update MemorySSA in LoopInstSimplify.
Summary:
Add MemorySSA as a depency to LoopInstInstSimplify and preserve it.
Disabled by default until all passes preserve MemorySSA.
Reviewers: chandlerc
Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits
Differential Revision: https://reviews.llvm.org/D50906
llvm-svn: 340444
Philip Reames [Wed, 22 Aug 2018 19:50:45 +0000 (19:50 +0000)]
[AA] Remove a needless variable [NFC]
There's no need to track a seperate variable for argmemonly aliasing. This falls out naturally of the modinfo union. Note that we may return earlier than we would have earlier if all arguments are explicitly readnone. The overall result doesn't change, just how we get there.
llvm-svn: 340443
Kostya Serebryany [Wed, 22 Aug 2018 19:47:19 +0000 (19:47 +0000)]
[hwasan] remove stale data field
llvm-svn: 340442
Craig Topper [Wed, 22 Aug 2018 19:39:09 +0000 (19:39 +0000)]
[X86] Replace (32/64 - n) shift amounts with (neg n) since the shift amount is masked in hardware
Inspired by what AArch64 does for shifts, this patch attempts to replace shift amounts with neg if we can.
This is done directly as part of isel so its as late as possible to avoid breaking some BZHI patterns since those patterns need an unmasked (32-n) to be correct.
To avoid manual load folding and custom instruction selection for the negate. I've inserted new nodes in the DAG above the shift node in topological order.
Differential Revision: https://reviews.llvm.org/D48789
llvm-svn: 340441
Philip Reames [Wed, 22 Aug 2018 19:30:46 +0000 (19:30 +0000)]
[AST] Minor whitespace cleanup [NFC]
llvm-svn: 340440
Elizabeth Andrews [Wed, 22 Aug 2018 19:05:19 +0000 (19:05 +0000)]
Currently clang does not emit unused static constants. GCC emits these
constants by default when there is no optimization.
GCC's option -fno-keep-static-consts can be used to not emit
unused static constants.
In Clang, since default behavior does not keep unused static constants,
-fkeep-static-consts can be used to emit these if required. This could be
useful for producing identification strings like SVN identifiers
inside the object file even though the string isn't used by the program.
Differential Revision: https://reviews.llvm.org/D40925
llvm-svn: 340439
Heejin Ahn [Wed, 22 Aug 2018 18:53:48 +0000 (18:53 +0000)]
[WebAssembly] Remove MachineFrameInfo arg from checking functions (NFC)
Summary:
There are several functions in the form of `has***` or `needs***` in
`WebAssemblyFrameLowering` and its `MachineFrameInfo` argument can be
obtained from `MachineFunction` so it is not necessarily has to be
passed from a caller. Also, it is more in line with other overriden
fuctions like `hasBP` or `hasReservedCallFrame`, which also take only
`MachineFunction` argument.
Reviewers: dschuff
Subscribers: sbc100, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51116
llvm-svn: 340438
Chris Bieneman [Wed, 22 Aug 2018 18:41:14 +0000 (18:41 +0000)]
[CMake] Remove unneeded and outdated policy
This was needed way back because we didn't properly handle that the SOURCES property of a target could have things that weren't source files to compile. Almost 2 years ago Takumi fixed that, and now CMake is throwing warnings that we should get off the old behavior.
llvm-svn: 340436
Chris Bieneman [Wed, 22 Aug 2018 18:40:24 +0000 (18:40 +0000)]
[CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPES
There are several places where we use CMAKE_CONFIGURATION_TYPES to determine if we are using an IDE generator and in turn decide not to generate some of the convenience targets (like all the install-* and check-llvm-* targets). This decision is made because IDEs don't always deal well with the thousands of targets LLVM can generate.
This approach does not work for Visual Studio 15's new CMake integration. Because VS15 uses a Ninja generator, it isn't a multi-configuration build, and generating all these extra targets mucks up the UI and adds little value.
With this change we still don't generate these targets by default for Visual Studio and Xcode generators, and LLVM_ENABLE_IDE becomes a switch that can be enabled on the VS15 CMake builds, to improve the IDE experience.
llvm-svn: 340435
Craig Topper [Wed, 22 Aug 2018 18:24:13 +0000 (18:24 +0000)]
[X86] In OptimizeLEAs pass, check that the key is in the LEAs map before accessing
When the key is not already in the map, the access operator[] creates an empty value and grows the map.
Resizing a map is very slow, so this needs to be avoided.
Found with csmith + asserts.
May help with
https://bugs.llvm.org/show_bug.cgi?id=25843
Patch by Tom Rix.
Differential Revision: https://reviews.llvm.org/D50780
llvm-svn: 340434
Heejin Ahn [Wed, 22 Aug 2018 18:22:45 +0000 (18:22 +0000)]
[WebAssembly] Add hasSideEffects flag to catch instructions
Summary:
`catch` instruction certainly has rather huge side effects and the flag
was missing. At the moment this does not change any unit tests we
currently have.
Reviewers: dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D50919
llvm-svn: 340433
Vedant Kumar [Wed, 22 Aug 2018 18:15:03 +0000 (18:15 +0000)]
[CodeGenPrepare] Set debug locs when folding a comparison into a uadd.with.overflow
CGP can replace a branch + select with a uadd.with.overflow. Teach it to
set debug locations as it does this.
llvm-svn: 340432
Matt Davis [Wed, 22 Aug 2018 18:03:58 +0000 (18:03 +0000)]
[llvm-mca] Clean up a comment about the Context class. NFC.
llvm-svn: 340431
George Burgess IV [Wed, 22 Aug 2018 18:02:46 +0000 (18:02 +0000)]
[MemorySSA] Move two simple getters; NFC
We're calling these functions quite a bit from outside of MemorySSA.cpp
now. Given that they're relatively simple one-liners, I think the style
preference is to have them inline.
llvm-svn: 340430
Aditya Nandakumar [Wed, 22 Aug 2018 17:59:18 +0000 (17:59 +0000)]
[GISel]: Add legalization support for widening bit counting operations
https://reviews.llvm.org/D51053
Added legalization for WidenScalar of various bitcounting opcodes.
Reviewed by arsenm.
llvm-svn: 340429
Sam Clegg [Wed, 22 Aug 2018 17:50:51 +0000 (17:50 +0000)]
[WebAssembly] Optimise relocation processing. NFC.
This is a rebased version https://reviews.llvm.org/D42176 which is patch
by Nicolas Wilson.
Addresses issue:
https://github.com/WebAssembly/tool-conventions/issues/32, and
https://bugs.llvm.org/show_bug.cgi?id=38650
Previously, for each function/segment we iterated over every relocation
to find the relevant ones, which is an n^2 operation. Now, we just make
a single pass.
Differential Revision: https://reviews.llvm.org/D51063
llvm-svn: 340428
Reid Kleckner [Wed, 22 Aug 2018 17:47:41 +0000 (17:47 +0000)]
Disable the aligned allocation test on old mac versions instead of XFAILing it
It looks like this test XPASSes when the deployment target is older than
the OS of the system the test is running on. It looks like we run the
tests with -mmacosx-version-min=10.12, and that makes the test expect to
fail, but it passes.
llvm-svn: 340427
Eric Fiselier [Wed, 22 Aug 2018 17:47:13 +0000 (17:47 +0000)]
Add diagnostics for min/max algorithms when a InputIterator is used.
These algorithms require a ForwardIterator or better. Ensure
we diagnose the contract violation at compile time instead of
of silently doing the wrong thing.
Further algorithms will be audited in upcoming patches.
llvm-svn: 340426
Sanjay Patel [Wed, 22 Aug 2018 17:46:28 +0000 (17:46 +0000)]
[x86] add tests for load scalar + insertelement; NFC
llvm-svn: 340425
Pirama Arumuga Nainar [Wed, 22 Aug 2018 17:43:05 +0000 (17:43 +0000)]
[Android] Default to -fno-math-errno
Summary: Android's libm does not set errno.
Reviewers: srhines, enh
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51068
llvm-svn: 340424
Sam Clegg [Wed, 22 Aug 2018 17:27:31 +0000 (17:27 +0000)]
[WebAssembly] Ensure relocation entries are ordered by offset
wasm-lld expects relocation entries to be sorted by offset. In most
cases llvm produces them in order, but the CODE section (which combines
many MCSections) is an exception because we order the functions in
Symbol order, not in section order. What is more, its not clear weather
`recordRelocation` is guaranteed to be called in offset order so this
sort of most likely needed in the general case too.
Differential Revision: https://reviews.llvm.org/D51065
llvm-svn: 340423
Matt Davis [Wed, 22 Aug 2018 17:15:25 +0000 (17:15 +0000)]
[llvm-mca] Remove unused decl. NFC.
llvm-svn: 340422
Chih-Hung Hsieh [Wed, 22 Aug 2018 17:13:40 +0000 (17:13 +0000)]
[Tooling] Allow -flto flags and filter out -Wa, flags
This change fixes the problem in https://bugs.llvm.org/show_bug.cgi?id=38332
by allowing driver::Action::BackendJobClass to run with the analyzer.
Otherwise, such jobs will look up the non-existing compilation database
and then run without flags.
Also filter out the -Wa,* flags that could be passed to and ignored
by the clang compiler. Clang-tidy gives warnings about unused -Wa,* flags.
Differential Revision: http://reviews.llvm.org/D51002
llvm-svn: 340421
Nico Weber [Wed, 22 Aug 2018 16:47:16 +0000 (16:47 +0000)]
lld-link: Emit warning if one each of {main,wmain} and {WinMain,wWinMain} exist and no /subsystem: flag is passed.
Similar to link.exe's LNK4031.
https://reviews.llvm.org/D51076
llvm-svn: 340420
Samuel Pitoiset [Wed, 22 Aug 2018 16:08:48 +0000 (16:08 +0000)]
AMDGPU: bump AS.MAX_COMMON_ADDRESS to 6 since 32-bit addr space
32-bit constant address space is declared as 6, so the
maximum number of address spaces is 6, not 5.
Fixes "LLVM ERROR: Pointer address space out of range".
v5: rename MAX_COMMON_ADDRESS to MAX_AMDGPU_ADDRESS
v4: - fix compilation issues
- fix out of bounds access
v3: use static_assert()
v2: add a very simple test for 32-bit addr space
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106630
llvm-svn: 340417
Samuel Pitoiset [Wed, 22 Aug 2018 16:08:43 +0000 (16:08 +0000)]
AMDGPU: fix existing alias rules for constant and global
Constant and global may alias, also one rules table wasn't
ordered correctly.
Pinpointed by Matt.
v2: add a test with swapped parameters
llvm-svn: 340416
Simon Pilgrim [Wed, 22 Aug 2018 15:37:11 +0000 (15:37 +0000)]
[X86][SSE] LowerMULH vXi8 - use SSE shifts directly.
We know these vXi16 extended cases are legal constant splat shifts.
llvm-svn: 340414
Sid Manning [Wed, 22 Aug 2018 15:25:15 +0000 (15:25 +0000)]
[ELF][HEXAGON] Add R_HEX_16_X relocation
This relocation has only 6-bits the remaining are in the extender.
Differential Revision: https://reviews.llvm.org/D50603
llvm-svn: 340413
Haojian Wu [Wed, 22 Aug 2018 14:03:30 +0000 (14:03 +0000)]
[clang-tidy] Add Abseil prefix to documentation
Summary: Adds the Abseil prefix to the list of prefixes in the documentation
Patch by Deanna Garcia!
Reviewers: aaron.ballman, hokein
Reviewed By: hokein
Subscribers: xazax.hun, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D51100
llvm-svn: 340412
Haojian Wu [Wed, 22 Aug 2018 13:58:25 +0000 (13:58 +0000)]
[clang-tidy] Abseil: faster strsplit delimiter check
This check is an abseil specific check that checks for code using single character string literals as delimiters and transforms the code into characters.
The check was developed internally and has been running at google, this is just
a move to open source the check. It was originally written by @sbenza.
Patch by Deanna Garcia!
llvm-svn: 340411
Ilya Biryukov [Wed, 22 Aug 2018 13:51:19 +0000 (13:51 +0000)]
[clangd] Get rid of regexes in CanonicalIncludes
Summary: Replace them with suffix mappings.
Reviewers: ioeric, kbobyrev
Reviewed By: ioeric
Subscribers: MaskRay, jkorous, arphaman, jfb, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D51088
llvm-svn: 340410
Kirill Bobyrev [Wed, 22 Aug 2018 13:44:15 +0000 (13:44 +0000)]
[clangd] Implement BOOST iterator
This patch introduces BOOST iterator - a substantial block for efficient
and high-quality symbol retrieval. The concept of boosting allows
performing computationally inexpensive scoring on the query side so that
the final (expensive) scoring can only be applied on the items with the
highest preliminary score while eliminating the need to score too many
items.
Reviewed by: ilya-biryukov
Differential Revision: https://reviews.llvm.org/D50970
llvm-svn: 340409
Akira Hatanaka [Wed, 22 Aug 2018 13:41:19 +0000 (13:41 +0000)]
[CodeGen] Look at the type of a block capture field rather than the type
of the captured variable when determining whether the capture needs
special handing when the block is copied or disposed.
This fixes bugs in the handling of variables captured by a block that is
nested inside a lambda that captures the variables by reference.
rdar://problem/
43540889
Differential Revision: https://reviews.llvm.org/D51025
llvm-svn: 340408
Henry Wong [Wed, 22 Aug 2018 13:30:46 +0000 (13:30 +0000)]
[analyzer] Improve `CallDescription` to handle c++ method.
Summary:
`CallDecription` can only handle function for the time being. If we want to match c++ method, we can only use method name to match and can't improve the matching accuracy through the qualifiers.
This patch add the support for `QualifiedName` matching to improve the matching accuracy.
Reviewers: xazax.hun, NoQ, george.karpenkov, rnkovacs
Reviewed By: xazax.hun, NoQ, rnkovacs
Subscribers: Szelethus, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits, MTC
Differential Revision: https://reviews.llvm.org/D48027
llvm-svn: 340407
Eric Fiselier [Wed, 22 Aug 2018 13:29:52 +0000 (13:29 +0000)]
Attempt to unbreak filesystem tests on certain linux distros.
On some platforms clock_gettime is in librt, which we don't
link by default when building the tests. However it is required
by the filesystem tests.
This patch introduces a workaround which links librt whenever
the filesystem tests are enabled. The workaround should later
be replaced with a patch that selectively links both libc++fs
and librt only when building filesystem specific tests. However,
the way the test configuration is set up right now, this is
non-trivial.
llvm-svn: 340406
Sam Parker [Wed, 22 Aug 2018 12:58:36 +0000 (12:58 +0000)]
[ARM] Rotated operand patterns for *xtb16
Add intrinsic isel patterns for sxtb16, sxtab16, uxtb16 and uxtab16
so that they can perform a ror.
Differential Revision: https://reviews.llvm.org/D51034
llvm-svn: 340405
Ilya Biryukov [Wed, 22 Aug 2018 12:43:17 +0000 (12:43 +0000)]
[clangd] Make FileIndex aware of the main file
Summary:
It was previously only indexing the preamble decls. The new
implementation will index both the preamble and the main AST and
report both sets of symbols, preferring the ones from the main AST
whenever the symbol is present in both.
The symbols in the main AST slab always store all information
available in the preamble symbols, possibly adding more,
e.g. definition locations.
Reviewers: hokein, ioeric
Reviewed By: ioeric
Subscribers: kadircet, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D50889
llvm-svn: 340404
Haojian Wu [Wed, 22 Aug 2018 12:34:04 +0000 (12:34 +0000)]
[Preamble] Fix an undefined behavior when checking an empty preamble can be reused.
Summary: Passing nullptr to memcmp is UB.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50967
llvm-svn: 340403
Gabor Marton [Wed, 22 Aug 2018 11:52:14 +0000 (11:52 +0000)]
Fix import of class templates partial specialization
Summary:
Currently there are several issues with the import of class template
specializations. (1) Different TUs may have class template specializations
with the same template arguments, but with different set of instantiated
MethodDecls and FieldDecls. In this patch we provide a fix to merge these
methods and fields. (2) Currently, we search the partial template
specializations in the set of simple specializations and we add partial
specializations as simple specializations. This is bad, this patch fixes it.
Reviewers: a_sidorin, xazax.hun, r.stahl
Subscribers: rnkovacs, dkrupp, cfe-commits
Differential Revision: https://reviews.llvm.org/D50451
llvm-svn: 340402
Ilya Biryukov [Wed, 22 Aug 2018 11:39:16 +0000 (11:39 +0000)]
[clangd] Add callbacks on parsed AST in addition to parsed preambles
Summary:
Will be used for updating the dynamic index on updates to the open files.
Currently we collect only information coming from the preamble
AST. This has a bunch of limitations:
- Dynamic index misses important information from the body of the
file, e.g. locations of definitions.
- XRefs cannot be collected at all, since we can only obtain full
information for the current file (preamble is parsed with skipped
function bodies, therefore not reliable).
This patch only adds the new callback, actually updates to the index
will be done in a follow-up patch.
Reviewers: hokein
Reviewed By: hokein
Subscribers: kadircet, javed.absar, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D50847
llvm-svn: 340401
Martin Storsjo [Wed, 22 Aug 2018 11:35:02 +0000 (11:35 +0000)]
[COFF] Move a comment close to the code it refers to. NFC.
llvm-svn: 340400
Martin Storsjo [Wed, 22 Aug 2018 11:34:58 +0000 (11:34 +0000)]
[COFF] Change fatal() into error() when writing chunks to the output
In most of these cases, it's easy to go on despite the error,
printing as many valuable error messages as possible from one run
as possible.
Differential Revision: https://reviews.llvm.org/D51087
llvm-svn: 340399
David Green [Wed, 22 Aug 2018 11:34:28 +0000 (11:34 +0000)]
[AArch64] Add Tiny Code Model for AArch64
Adds a tiny code model to Clang along side rL340397.
Differential Revision: https://reviews.llvm.org/D49674
llvm-svn: 340398
David Green [Wed, 22 Aug 2018 11:31:39 +0000 (11:31 +0000)]
[AArch64] Add Tiny Code Model for AArch64
This adds the plumbing for the Tiny code model for the AArch64 backend. This,
instead of loading addresses through the normal ADRP;ADD pair used in the Small
model, uses a single ADR. The 21 bit range of an ADR means that the code and
its statically defined symbols need to be within 1MB of each other.
This makes it mostly interesting for embedded applications where we want to fit
as much as we can in as small a space as possible.
Differential Revision: https://reviews.llvm.org/D49673
llvm-svn: 340397
Matt Arsenault [Wed, 22 Aug 2018 11:09:45 +0000 (11:09 +0000)]
AMDGPU: Fix not respecting byval alignment in call frame setup
This was hackily adding in the 4-bytes reserved for the callee's
emergency stack slot. Treat it like a normal stack allocation
so we get the correct alignment padding behavior. This fixes
an inconsistency between the caller and callee.
llvm-svn: 340396
Andrea Di Biagio [Wed, 22 Aug 2018 10:23:28 +0000 (10:23 +0000)]
[llvm-mca] Improved code comments and moved some method definitions from Scheduler.h to Scheduler.cpp. NFC
llvm-svn: 340395
Simon Pilgrim [Wed, 22 Aug 2018 10:08:53 +0000 (10:08 +0000)]
Fix Wdocumentation warnings. NFCI.
llvm-svn: 340394
Simon Pilgrim [Wed, 22 Aug 2018 09:47:12 +0000 (09:47 +0000)]
[X86][SSE] Add sdiv test case from PR38658
llvm-svn: 340393
Stefan Maksimovic [Wed, 22 Aug 2018 09:34:44 +0000 (09:34 +0000)]
[mips] Handle missing CondCodes
Add patterns for unhandled CondCode enumerables:
SETEQ, SETGE, SETGT, SETLE, SETLT, SETNE.
Stated at the ISD::CondCode enum declaration:
`All of these (except for the 'always folded ops')
should be handled for floating point.`
Add patterns which use these nodes, same as corresponding
'ordered' CondCode nodes.
Referring to 'Ordered means that neither operand is a QNAN'
we assume it is safe to match ex. SETLT node to the same
instruction as SETOLT.
Differential Revision: https://reviews.llvm.org/D50757
llvm-svn: 340392
Stefan Maksimovic [Wed, 22 Aug 2018 09:26:25 +0000 (09:26 +0000)]
[clang][mips] Set __mips_fpr correctly for -mfpxx
Set __mips_fpr to 0 if o32 ABI is used with either -mfpxx
or none of -mfp32, -mfpxx, -mfp64 being specified.
Introduce additional checks:
-mfpxx is only to be used in conjunction with the o32 ABI.
report an error when incompatible options are provided.
Formerly no errors were raised when combining n32/n64 ABIs
with -mfp32 and -mfpxx.
There are other cases when __mips_fpr should be set to 0
that are not covered, ex. using o32 on a mips64 cpu
which is valid but not supported in the backend as of yet.
Differential Revision: https://reviews.llvm.org/D50557
llvm-svn: 340391
Simon Tatham [Wed, 22 Aug 2018 09:20:39 +0000 (09:20 +0000)]
[clang-tblgen] Add -print-records and -dump-json modes.
Currently, if clang-tblgen is run without a mode option, it defaults
to the first mode in its 'enum Action', which happens to be
-gen-clang-attr-classes. I think it makes more sense for it to behave
the same way as llvm-tblgen, i.e. print a diagnostic dump if it's not
given any more specific instructions.
I've also added the same -dump-json that llvm-tblgen supports. This
means any tblgen command line (whether llvm- or clang-) can be
mechanically turned into one that processes the same input into JSON.
Reviewers: nhaehnle
Reviewed By: nhaehnle
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D50771
llvm-svn: 340390
Dean Michael Berris [Wed, 22 Aug 2018 07:37:55 +0000 (07:37 +0000)]
[XRay] Refactor file header reading (NFC)
Summary:
This patch moves out the definition of the XRay log file header from
binary logs into its own header and implementation file.
This is one part of the refactoring being done in D50441.
Reviewers: eizan
Subscribers: mgorny, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D51086
llvm-svn: 340389
Kirill Bobyrev [Wed, 22 Aug 2018 07:17:59 +0000 (07:17 +0000)]
[clangd] Cleanup after D50897
The wrong diff that was uploaded to Phabricator was building the wrong
index.
llvm-svn: 340388
Rui Ueyama [Wed, 22 Aug 2018 07:02:26 +0000 (07:02 +0000)]
Change how we handle -wrap.
We have an issue with -wrap that the option doesn't work well when
renamed symbols get PLT entries. I'll explain what is the issue and
how this patch solves it.
For one -wrap option, we have three symbols: foo, wrap_foo and real_foo.
Currently, we use memcpy to overwrite wrapped symbols so that they get
the same contents. This works in most cases but doesn't when the relocation
processor sets some flags in the symbol. memcpy'ed symbols are just
aliases, so they always have to have the same contents, but the
relocation processor breaks that assumption.
r336609 is an attempt to fix the issue by memcpy'ing again after
processing relocations, so that symbols that are out of sync get the
same contents again. That works in most cases as well, but it breaks
ASan build in a mysterious way.
We could probably fix the issue by choosing symbol attributes that need
to be copied after they are updated. But it feels too complicated to me.
So, in this patch, I fixed it once and for all. With this patch, we no
longer memcpy symbols. All references to renamed symbols point to new
symbols after wrapSymbols() is done.
Differential Revision: https://reviews.llvm.org/D50569
llvm-svn: 340387
Hiroshi Inoue [Wed, 22 Aug 2018 05:43:27 +0000 (05:43 +0000)]
[AST] correct the behavior of -fvisibility-inlines-hidden option (don't make static local variables hidden)
The command line option -fvisibility-inlines-hidden makes inlined method hidden, but it is expected not to affect the visibility of static local variables in the function.
However, Clang makes the static local variables in the function also hidden as reported in PR37595. This problem causes LLVM bootstarp failure on Fedora 28 if configured with -DBUILD_SHARED_LIBS=ON.
This patch makes the behavior of -fvisibility-inlines-hidden option to be consistent with that of gcc; the option does not change the visibility of the static local variables if the containing function does not associated with explicit visibility attribute and becomes hidden due to this option.
Differential Revision: https://reviews.llvm.org/D50968
llvm-svn: 340386
Marshall Clow [Wed, 22 Aug 2018 04:28:43 +0000 (04:28 +0000)]
Fix Bug 38644: multimap::clear() missing exception specifier. Add noexcept tests for all the containers that have clear().
llvm-svn: 340385
Philip Reames [Wed, 22 Aug 2018 03:36:42 +0000 (03:36 +0000)]
[AST] Fix a whitespace typo [NFC]
llvm-svn: 340384
Philip Reames [Wed, 22 Aug 2018 03:33:55 +0000 (03:33 +0000)]
[AST] Reorder code to reduce a future patch diff [NFC]
llvm-svn: 340383
Philip Reames [Wed, 22 Aug 2018 03:32:52 +0000 (03:32 +0000)]
[AST] Move a function definition into the cpp [NFC]
llvm-svn: 340382
Max Kazantsev [Wed, 22 Aug 2018 02:40:49 +0000 (02:40 +0000)]
[GuardWidening] Ignore guards with trivial conditions
Guard widening should not spend efforts on dealing with guards with trivial true/false conditions.
Such guards can easily be eliminated by any further cleanup pass like instcombine. However we
should not unconditionally delete them because it may be profitable to widen other conditions
into such guards.
Differential Revision: https://reviews.llvm.org/D50247
Reviewed By: fedor.sergeev
llvm-svn: 340381
Fangrui Song [Wed, 22 Aug 2018 02:11:36 +0000 (02:11 +0000)]
[gold] -thinlto-object-suffix-replace: don't append new suffix if path does not end with old suffix
Summary: This is to be consistent with lld behavior since rLLD340364.
Reviewers: tejohnson
Reviewed By: tejohnson
Subscribers: steven_wu, eraman, mehdi_amini, inglorion, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D51060
llvm-svn: 340380
Vedant Kumar [Wed, 22 Aug 2018 01:23:31 +0000 (01:23 +0000)]
[CodeGenPrepare] Set debug loc when widening a switch condition
Set a debug location on the cast instruction used to widen a switch
condition.
llvm-svn: 340379
George Karpenkov [Wed, 22 Aug 2018 01:17:09 +0000 (01:17 +0000)]
[analyzer] [NFC] Fix minor formatting issues in RetainCountChecker
Differential Revision: https://reviews.llvm.org/D51072
llvm-svn: 340378
George Karpenkov [Wed, 22 Aug 2018 01:16:49 +0000 (01:16 +0000)]
[analyzer] [NFC] Extract a method for creating RefVal from RetEffect in RetainCountChecker
Differential Revision: https://reviews.llvm.org/D51071
llvm-svn: 340377