Commit Graph

230604 Commits

Author SHA1 Message Date
Etienne Bergeron c87599f480 [clang-tidy] Improve misc-redundant-expression and decrease false-positive
Summary:
This patch is adding support for conditional expression and overloaded operators.

To decrease false-positive, this patch is adding a list of banned macro names that
has multiple variant with same integer value.

Also fixed support for template instantiation and added an unittest.

Reviewers: alexfh

Subscribers: klimek, Sarcasm, cfe-commits

Differential Revision: http://reviews.llvm.org/D19703

llvm-svn: 269275
2016-05-12 04:32:47 +00:00
Etienne Bergeron 3588be7fa1 Add an AST matcher for string-literal length
Summary:
This patch is adding support for a matcher to check string literal length.

This matcher is used in clang-tidy checkers and is part of this refactoring:
  see: http://reviews.llvm.org/D19841

Reviewers: sbenza, klimek, aaron.ballman

Subscribers: alexfh, klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D19876

llvm-svn: 269274
2016-05-12 04:20:04 +00:00
Dan Gohman 33e694a807 [WebAssembly] Fast-isel support for calls, arguments, and selects.
llvm-svn: 269273
2016-05-12 04:19:09 +00:00
Hal Finkel 1fb10e846a [PowerPC] Fix a DAG replacement bug in PPCTargetLowering::DAGCombineExtBoolTrunc
While promoting nodes in PPCTargetLowering::DAGCombineExtBoolTrunc, it is
possible for one of the nodes to be replaced by another. To make sure we do not
visit the deleted nodes, and to make sure we visit the replacement nodes, use a
list of HandleSDNodes to track the to-be-promoted nodes during the promotion
process.

The same fix has been applied to the analogous code in
PPCTargetLowering::DAGCombineTruncBoolExt.

Fixes PR26985.

llvm-svn: 269272
2016-05-12 04:00:56 +00:00
David Majnemer 7f980d842c [MS ABI] Don't crash when zero-initializing a vbase which contains a vbase
Bases can be zero-initialized: the storage is zero-initialized before
the base constructor is run.
The MS ABI has a quirk where base VBPtrs are not installed by the
base constructor but by the most derived class.  In particular, they are
installed before the base constructor is run.
The derived constructor must be careful to zero-initialize only the bits
of the class which haven't already been populated by virtual base
pointers.

While we correctly avoided this scenario, we didn't handle the case
where the base class has virtual bases which have virtual bases.

llvm-svn: 269271
2016-05-12 03:51:52 +00:00
Bruno Cardoso Lopes ab83dc646d [VFS] Reapply r269100: Reconstruct the VFS overlay tree for more accurate lookup
The way we currently build the internal VFS overlay representation leads
to inefficient path search and might yield wrong answers when asked for
recursive or regular directory iteration.

Currently, when reading an YAML file, each YAML root entry is placed
inside a new root in the filesystem overlay. In the crash reproducer, a
simple "@import Foundation" currently maps to 43 roots, and when looking
up paths, we traverse a directory tree for each of these different
roots, until we find a match (or don't). This has two consequences:

- It's slow.
- Directory iteration gives incomplete results since it only return
results within one root - since contents of the same directory can be
declared inside different roots, the result isn't accurate.

This is in part fault of the way we currently write out the YAML file
when emitting the crash reproducer - we could generate only one root and
that would make it fast and correct again. However, we should not rely
on how the client writes the YAML, but provide a good internal
representation regardless.

This patch builds a proper virtual directory tree out of the YAML
representation, allowing faster search and proper iteration. Besides the
crash reproducer, this potentially benefits other VFS clients.

llvm-svn: 269270
2016-05-12 03:23:36 +00:00
David Majnemer 96f0d383a7 [SCCP] Resolve shifts beyond the bitwidth to undef
Shifts beyond the bitwidth are undef but SCCP resolved them to zero.
Instead, DTRT and resolve them to undef.

This reimplements the transform which caused PR27712.

llvm-svn: 269269
2016-05-12 03:07:40 +00:00
Matt Arsenault 8300272823 AMDGPU: Fix getIntegerAttribute type and error message
llvm-svn: 269268
2016-05-12 02:45:18 +00:00
Xinliang David Li a94e383157 [Layout] Add a new test case for optimal rotation
Enabled by -force-precise-rotation-cost option

llvm-svn: 269267
2016-05-12 02:19:16 +00:00
Xinliang David Li f0ab6dfedc [Layout] Add a new option (NFC)
Currently cost based loop rotation algo can only be turned on with
two conditions: the function has real profile data, and -precise-rotation-cost
flag is turned on. This is not convenient for developers to experiment
when profile is not available. Add a new option to force the new
rotation algorithm -force-precise-rotation-cost

llvm-svn: 269266
2016-05-12 02:04:41 +00:00
Matt Arsenault a61cb48dd2 AMDGPU: Fix breaking IR on instructions with multiple pointer operands
The promote alloca pass would attempt to promote an alloca with
a select, icmp, or phi user, even though the other operand was
from a non-promotable source, producing a select on two different
pointer types.

Only do this if we know that both operands derive from the same
alloca. In the future we should be able to relax this to an alloca
which will also be promoted.

llvm-svn: 269265
2016-05-12 01:58:58 +00:00
Chris Bieneman de60ad33b3 [obj2yaml] Adding Error/Expected to macho2yaml
I figure if I'm adding Mach support I may as well use the new fancy Error model.

llvm-svn: 269264
2016-05-12 01:52:33 +00:00
Chad Rosier 9926a5e31d [AArch64] Add support for unscaled narrow stores in getUsefulBitsForUse.
llvm-svn: 269263
2016-05-12 01:42:01 +00:00
Sanjoy Das 8d3b1791ed Appease MSVC with curly braces
llvm-svn: 269262
2016-05-12 01:38:08 +00:00
Sanjoy Das e0aa414acf All llvm.deoptimize declarations must use the same calling convention
This new verifier rule lets us unambigously pick a calling convention
when creating a new declaration for
`@llvm.experimental.deoptimize.<ty>`.  It is also congruent with our
lowering strategy -- since all calls to `@llvm.experimental.deoptimize`
are lowered to calls to `__llvm_deoptimize`, it is reasonable to enforce
a unique calling convention.

Some of the tests that were breaking this verifier rule have had to be
split up into different .ll files.

The inliner was violating this rule as well, and has been fixed to avoid
producing invalid IR.

llvm-svn: 269261
2016-05-12 01:17:38 +00:00
Chad Rosier fe7bba4ee4 [AArch64] Remove floating-point narrow stores from getUsefulBitsForUse.
While not impossible, it's unlikely we'd be performing bitwise operations on FP
values.

llvm-svn: 269260
2016-05-12 01:04:15 +00:00
Hal Finkel 55acbf8877 Restore NULL flag check in __kmp_null_resume_wrapper
This reverts a presumaby-unintentional change in:

  r268640 - [STATS] Use partitioned timer scheme

and fixes segfaults in an x86_64 debug build of the runtime library.

llvm-svn: 269259
2016-05-12 00:54:08 +00:00
Justin Bogner 4557136645 SDAG: Implement Select instead of SelectImpl in ARMDAGToDAGISel
This is a large change, but it's pretty mechanical:
- Where we were returning a node before, call ReplaceNode instead.
- Where we would return null to fall back to another selector, rename
  the method to try* and return a bool for success.
- Where we were calling SelectNodeTo, just return afterwards.

Part of llvm.org/pr26808.

llvm-svn: 269258
2016-05-12 00:31:09 +00:00
Etienne Bergeron 394dfff1ed [tooling] Remove redundant inline keyword
Summary:
The inline keywords are redundant.
Introduce by this commit to try to fix broken build bots:
  http://reviews.llvm.org/D20180

Tested on Debug and Release build [linux].
Tested on Release + Shared (-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON) [linux]
Tested on Release [windows]

Reviewers: alexfh

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D20189

llvm-svn: 269257
2016-05-12 00:22:28 +00:00
Justin Bogner ed4f37850e SDAG: Clean up dangling nodes in ARMISelDAGToDAG::SelectImpl
When we convert to the void Select interface, leaving unreferenced
nodes around won't be allowed anymore.

Part of llvm.org/pr26808.

llvm-svn: 269256
2016-05-12 00:20:19 +00:00
Saleem Abdulrasool f51af6c9cd libc++abi: make __cxa_call_unexpected visible
This may be invoked by the compiler, and needs to be made available so that the
users can reference it.

llvm-svn: 269255
2016-05-11 23:56:37 +00:00
Xinliang David Li 667de6a84e [profile] profile writing cleanup
Do not precompute value counts for all sites. This 
eliminates one more use of dynamic allocation 
in profiler writer.

llvm-svn: 269254
2016-05-11 23:21:22 +00:00
Xinliang David Li eb11799c62 [profile] profile writing cleanup
Do not precompute value counts for all sites. This 
eliminates one more use of dynamic allocation 
in profiler writer.

llvm-svn: 269253
2016-05-11 23:21:12 +00:00
Davide Italiano cd7c84bd8b Revert "[SCCP] Partially propagate informations when the input is not fully defined."
This reverts commit r269105 as it caused PR27712.

llvm-svn: 269252
2016-05-11 23:06:10 +00:00
Teresa Johnson 2e03094d45 [ThinLTO] Don't re-analyze callee at same threshold unnecessarily
This should just be a compile-time change. Correct the check for whether
we have already analyzed the callee when making summary based decisions.
There is no need to reprocess one at the same threshold as when it was
last processed.

llvm-svn: 269251
2016-05-11 22:56:19 +00:00
Ted Woodward 911d57840a Keep original source path and mapped path in LineEntry
Summary:
The "file" variable in a LineEntry was mapped using target.source-map, except when stepping through inlined code. This patch adds a new variable to LineEntry, "original_file", that contains the original file from the debug info. "file" will continue to (possibly) be mapped.

Some code has been changed to use "original_file". This is code dealing with symbols. Code dealing with source files will still use "file". Reviewers, please confirm that these particular changes are correct.

Tests run on Ubuntu 12.04 show no regression.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D20135

llvm-svn: 269250
2016-05-11 22:46:53 +00:00
Wei Mi 8c4136b0d8 Fix a bug when hoist spill to a BB with landingpad successor.
This is to fix the bug in https://llvm.org/bugs/show_bug.cgi?id=27612.

When spill is hoisted to a BB with landingpad successor, and if the VNI
of the spill reg lives into the landingpad successor, the spill should be
inserted before the call which may throw exception. InsertPointAnalysis
is used to compute the safe insert point.

http://reviews.llvm.org/D20027 is a preparing patch for this patch.

Differential Revision: http://reviews.llvm.org/D19884.

llvm-svn: 269249
2016-05-11 22:37:43 +00:00
Wei Mi 35ee9339a8 [NFC] Extract LastSplitPoint computation from SplitAnalysis to a new class
InsertPointAnalysis.

Because both split and spill hoisting want to use LastSplitPoint computation
result, extract the LastSplitPoint computation from SplitAnalysis class which
also contains a bunch of other analysises only related to split.

Differential Revision: http://reviews.llvm.org/D20027.

llvm-svn: 269248
2016-05-11 22:28:29 +00:00
Justin Bogner fde9f2e51d SDAG: Use ReplaceNode here, not ReplaceUses
This was a typo in an earlier commit - there's no point in keeping the
old node around here.

Noticed by Meador Inge. Thanks!

llvm-svn: 269245
2016-05-11 22:21:50 +00:00
Chris Bieneman b83c187195 Initial add for MachO support for yaml2obj
Adding the initial files for adding MachO support to yaml2obj. Passing a MachO file will result in an error.

I will be implementing obj2yaml and yaml2obj for MachO in parallel so that one can be used to test the other.

llvm-svn: 269244
2016-05-11 22:07:48 +00:00
Chris Bieneman 8cb136b8de Initial add for MachO support for obj2yaml
Adding the initial files for adding MachO support to obj2yaml. Passing a MachO file will result in a new not_implemented error.

I will be implementing obj2yaml and yaml2obj for MachO in parallel so that one can be used to test the other.

llvm-svn: 269243
2016-05-11 22:07:45 +00:00
Simon Pilgrim bff9dae3ff Fixed msvc warnings
llvm-svn: 269242
2016-05-11 21:55:37 +00:00
Sanjay Patel 810e329c88 regenerate checks
llvm-svn: 269241
2016-05-11 21:51:28 +00:00
Etienne Bergeron 4bf0e62d5a [clang-tidy] Add missing dependency of libtooling to misc module
Summary:
The new API for fixit is in libtooling and the library misc in clang-tidy
didn't had the appropriate dependency.

This commit was breaking some build bots:
http://reviews.llvm.org/D19547

This commit tried (but failed) to fix it:
http://reviews.llvm.org/D20180

To repro, you can make a build with these flags:
```
cmake -DBUILD_SHARED_LIBS=ON
```

Thanks rnk@ for helping figuring out.

Reviewers: alexfh, rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20182

llvm-svn: 269240
2016-05-11 21:32:29 +00:00
Matthias Braun 30668dd802 MachineVerifier: Fix error reporting.
Do not use getVRegDef() to print "the definition" of a vreg. If there
are multiple or none the function will fail.

llvm-svn: 269239
2016-05-11 21:31:39 +00:00
Xinliang David Li 50f240a424 cleanup: do not recompute size for preallocated buffer
llvm-svn: 269238
2016-05-11 21:17:10 +00:00
Xinliang David Li eb836a3dec cleanup: Enforce caller to set total size to avoid redundant size compute
llvm-svn: 269237
2016-05-11 21:16:11 +00:00
Justin Bogner 31d7da3b5f SDAG: Add a helper to replace and remove a node during ISel
It's very common to want to replace a node and then remove it since
it's dead, especially as we port backends from the SDNode *Select API
to the void Select one. This helper makes this sequence a bit less
verbose.

llvm-svn: 269236
2016-05-11 21:13:17 +00:00
Justin Bogner b3534c494f SDAG: Have SelectNodeTo replace uses if it CSE's instead of morphing a node
It's awkward to force callers of SelectNodeTo to figure out whether
the node was morphed or CSE'd. Update uses here instead of requiring
callers to (sometimes) do it.

llvm-svn: 269235
2016-05-11 21:00:33 +00:00
Bruno Cardoso Lopes 29ebd4979a [VFS][Unittests] Make dir iteration tests depend only on content
Do not rely on any specific order while comparing the results of
directory iteration.

llvm-svn: 269234
2016-05-11 20:58:47 +00:00
Evgeniy Stepanov 556e963e4e [asan] Don't use libcorkscrew on Android L+.
ASan runtime library used libcorkscrew from Android platform for
stack unwinding. Since Android L, this is both unnecessary (the
libgcc unwinder has been fixed) and impossible (the library is not
there any more). Don't even try.

This should have not effect on modern Android devices other than
removing a message about failing to open the library with
ASAN_OPTIONS=verbosity=1.

llvm-svn: 269233
2016-05-11 20:53:43 +00:00
Teresa Johnson e518c800f6 [ThinLTO] Fix Windows debug failure in new iterator
This fixes a debug assert on Windows from the new iterator
implementation added in r269059. The Windows std::vector iterator
operator== checks in debug mode that the containers being iterated over
are the same, which they may not be.

Fixed by checking that we are iterating over the same container before
comparing the container iterators.

llvm-svn: 269232
2016-05-11 20:46:22 +00:00
Richard Smith c2bebe9aca Preserve the FoundDecl when performing overload resolution for constructors.
This is in preparation for C++ P0136R1, which switches the model for inheriting
constructors over from synthesizing a constructor to finding base class
constructors (via using shadow decls) when looking for derived class
constructors.

llvm-svn: 269231
2016-05-11 20:37:46 +00:00
Chris Bieneman 1455de2171 [CMake] Cache check results and avoid duplicate checks
This caches the result of builtin_check_c_compiler_flag, and removes a duplicate check for C99 flag support.

llvm-svn: 269230
2016-05-11 20:37:43 +00:00
Eugene Zelenko 1592d76d73 [Clang-tidy] modernize-use-bool-literals: documentation style.
Fix readability-redundant-control-flow warnings in regression test.

llvm-svn: 269229
2016-05-11 20:31:50 +00:00
Devin Coughlin c1bfafd309 [analyzer] Fix crash in ObjCGenericsChecker
Fix a crash in the generics checker where DynamicTypePropagation tries
to get the superclass of a root class.

This is a spot-fix for a deeper issue where the checker makes assumptions
that may not hold about subtyping between the symbolically-tracked type of
a value and the compile-time types of a cast on that value.

I've added a TODO to address the underlying issue.

rdar://problem/26086914

llvm-svn: 269227
2016-05-11 20:28:41 +00:00
Chad Rosier 23a1a9a66d [AArch64] Improve getUsefulBitsForUse for narrow stores.
For narrow stores (e.g., strb, srth) we know the upper bits of the register are
unused/not useful. In some cases we can use this information to eliminate
unnecessary instructions.

For example, without this patch we generate (from the 2nd test case):

 ldr w8, [x0]
 and w8, w8, #0xfff0
 bfxil w8, w2, #16, #4
 strh w8, [x1]

and after the patch the 'and' is removed:

 ldr w8, [x0]
 bfxil w8, w2, #16, #4
 strh w8, [x1]
 ret

During the lowering of the bitfield insert instruction the 'and' is eliminated
because we know the upper 16-bits that are masked off are unused and the lower
4-bits that are masked off are overwritten by the insert itself. Therefore, the
'and' is unnecessary.

Differential Revision: http://reviews.llvm.org/D20175

llvm-svn: 269226
2016-05-11 20:19:54 +00:00
Sanjay Patel c610da6174 fix documentation comments; NFC
llvm-svn: 269225
2016-05-11 20:10:33 +00:00
Etienne Bergeron 3cb7504d30 [tooling] Fix missing inline keyworkd, breaking build bot.
Summary:
The missing keyword "inline" is causing some buildbot to fail.
The symbol is not available.

see: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/2281/

Reviewers: rnk

Subscribers: cfe-commits, klimek

Differential Revision: http://reviews.llvm.org/D20180

llvm-svn: 269224
2016-05-11 20:09:17 +00:00
Evgeniy Stepanov feb73c8566 [sanitizer] Move *stat to the common interceptors
Adds *stat to the common interceptors.

Removes the now-duplicate *stat interceptor from msan/tsan/esan.
This adds *stat to asan, which previously did not intercept it.

Patch by Qin Zhao.

llvm-svn: 269223
2016-05-11 20:02:15 +00:00