Sanjay Patel [Sun, 12 Aug 2018 15:48:26 +0000 (15:48 +0000)]
[InstCombine] fix/enhance fadd/fsub factorization
(X * Z) + (Y * Z) --> (X + Y) * Z
(X * Z) - (Y * Z) --> (X - Y) * Z
(X / Z) + (Y / Z) --> (X + Y) / Z
(X / Z) - (Y / Z) --> (X - Y) / Z
The existing code that implemented these folds failed to
optimize vectors, and it transformed code with multiple
uses when it should not have.
llvm-svn: 339519
Sanjay Patel [Sun, 12 Aug 2018 15:06:15 +0000 (15:06 +0000)]
[InstCombine] move/add tests for fadd/fsub factorization; NFC
llvm-svn: 339518
Aaron Ballman [Sun, 12 Aug 2018 14:47:16 +0000 (14:47 +0000)]
Adding the readability module to the list of dependencies for the C++ Core Guidelines module. Amends r339516 for a failing bot.
llvm-svn: 339517
Aaron Ballman [Sun, 12 Aug 2018 14:35:13 +0000 (14:35 +0000)]
Add a new check to the readability module that flags uses of "magic numbers" (both floating-point and integral).
Patch by Florin Iucha <florin@signbit.net>
llvm-svn: 339516
Benjamin Kramer [Sun, 12 Aug 2018 11:43:03 +0000 (11:43 +0000)]
[InstSimplify] Guard against large shift amounts.
These are always UB, but can happen for large integer inputs. Testing it
is very fragile as -simplifycfg will nuke the UB top-down.
llvm-svn: 339515
George Rimar [Sun, 12 Aug 2018 09:16:22 +0000 (09:16 +0000)]
[LLD][ELF] - Add one more test case for CallGraphSort.
This adds a coverage for the following early continue:
https://github.com/llvm-mirror/lld/blob/master/ELF/CallGraphSort.cpp#L200
llvm-svn: 339514
Matt Arsenault [Sun, 12 Aug 2018 08:44:25 +0000 (08:44 +0000)]
AMDGPU: Check NSZ MI flag when folding omod
I'm not sure the exact nsz flag combination that
is OK. I think as long as it's on either, this is OK.
For now just check it on the omod multiply.
llvm-svn: 339513
Matt Arsenault [Sun, 12 Aug 2018 08:42:54 +0000 (08:42 +0000)]
AMDGPU: Use splat vectors for undefs when folding canonicalize
If one of the elements is undef, use the canonicalized constant
from the other element instead of 0.
Splat vectors are more useful for other optimizations, such
as matching vector clamps. This was breaking on clamps
of half3 from the undef 4th component.
llvm-svn: 339512
Matt Arsenault [Sun, 12 Aug 2018 08:42:46 +0000 (08:42 +0000)]
AMDGPU: Fix packing undef parts of build_vector
llvm-svn: 339511
George Rimar [Sun, 12 Aug 2018 07:52:24 +0000 (07:52 +0000)]
[LLF][ELF] - Simplify. NFC.
llvm-svn: 339510
Craig Topper [Sun, 12 Aug 2018 06:52:03 +0000 (06:52 +0000)]
[TargetLowering] Simplify one of the special cases in SimplifyDemandedBits for XOR. NFCI
We were checking for all bits being Known by checking Known.Zero|Known.One, but if all the bits are known then the value should be a Constant and we can just check for that instead.
llvm-svn: 339509
Craig Topper [Sun, 12 Aug 2018 05:34:15 +0000 (05:34 +0000)]
[TargetLowering] Use APInt::isSubsetOf to simplify some code. NFC
llvm-svn: 339508
Craig Topper [Sun, 12 Aug 2018 03:22:18 +0000 (03:22 +0000)]
[X86] Remove unnecessary AddedComplexity line. NFC
The use of the or_is_add predicate already gives enough of a complexity boost to get the patterns ordered properly.
llvm-svn: 339507
Raphael Isemann [Sat, 11 Aug 2018 23:43:46 +0000 (23:43 +0000)]
[ASTImporter] Added test case for opaque enums
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D50550
llvm-svn: 339506
Raphael Isemann [Sat, 11 Aug 2018 23:43:02 +0000 (23:43 +0000)]
[ASTImporter] Added test case for CXXConversionDecl importing
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D50552
llvm-svn: 339505
Raphael Isemann [Sat, 11 Aug 2018 23:40:27 +0000 (23:40 +0000)]
Use a DenseMap for looking up functions by UID in CompileUnit::FindFunctionByUID
Summary:
Instead of iterating over our vector of functions, we might as well use a map here to
directly get the function we need.
Thanks to Vedant for pointing this out.
Reviewers: vsk
Reviewed By: vsk
Subscribers: mgrang, lldb-commits
Differential Revision: https://reviews.llvm.org/D50225
llvm-svn: 339504
Martin Storsjo [Sat, 11 Aug 2018 19:36:06 +0000 (19:36 +0000)]
Add missing _LIBCXXABI_FUNC_VIS to __gxx_personality_seh0
This was missed in SVN r337754.
llvm-svn: 339503
Chijun Sima [Sat, 11 Aug 2018 08:12:07 +0000 (08:12 +0000)]
[Dominators] Remove the DeferredDominance class
Summary: After converting all existing passes to use the new DomTreeUpdater interface, there isn't any usage of the original DeferredDominance class. Thus, we can safely remove it from the codebase.
Reviewers: kuhar, brzycki, dmgreen, davide, grosser
Reviewed By: kuhar, brzycki
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D49747
llvm-svn: 339502
David Green [Sat, 11 Aug 2018 07:37:31 +0000 (07:37 +0000)]
[UnJ] Improve explicit loop count checks
Try to improve the computed counts when it has been explicitly set by a pragma
or command line option. This moves the code around, so that first call to
computeUnrollCount to get a sensible count and override that if explicit unroll
and jam counts are specified.
Also added some extra debug messages for when unroll and jamming is disabled.
Differential Revision: https://reviews.llvm.org/D50075
llvm-svn: 339501
David Green [Sat, 11 Aug 2018 06:57:28 +0000 (06:57 +0000)]
[UnJ] Create a hasInvariantIterationCount function. NFC
Pulled out a separate function for some code that calculates
if an inner loop iteration count is invariant to it's outer
loop.
Differential Revision: https://reviews.llvm.org/D50063
llvm-svn: 339500
Craig Topper [Sat, 11 Aug 2018 06:42:51 +0000 (06:42 +0000)]
[X86] Remove the AL/AX/EAX/RAX short immediate forms from the macro fusion shouldScheduleAdjacent. NFC
These instructions are only created by the backend during MCInst lowering.
llvm-svn: 339499
Craig Topper [Sat, 11 Aug 2018 06:42:50 +0000 (06:42 +0000)]
[X86] Add the mem-reg form of CMP to the macro fusion shouldScheduleAdjacent.
Unlike the other arithmetic instructions the mem-reg form of compare is just a load and not a RMW operation. According to the Intel optimization manual, this form is also supported by macro fusion.
llvm-svn: 339498
Craig Topper [Sat, 11 Aug 2018 06:42:49 +0000 (06:42 +0000)]
[X86] Remove ADD8mi and ADDmr from the macro fusion shouldScheduleAdjacent.
The are RMW of memory operations. They aren't eligible for macro fusion.
llvm-svn: 339497
Craig Topper [Sat, 11 Aug 2018 05:33:00 +0000 (05:33 +0000)]
[X86] Change the MOV32ri64 pseudo instruction to def a GR64 directly instead of wrapping it in a SUBREG_TO_REG.
Now we switch to the subregister in expandPostRAPseudos where we already switched the opcode.
This simplifies a few isel patterns that used the pseudo directly. And magically seems to have improved our ability to CSE it in the undef-label.ll test.
llvm-svn: 339496
Richard Trieu [Sat, 11 Aug 2018 04:18:05 +0000 (04:18 +0000)]
Fix WebAssembly instruction printer after r339474
Treat the stack variants of control instructions the same as regular
instructions. Otherwise, the vector ControlFlowStack will be the wrong
size and have out-of-bounds access. This was detected by MemorySanitizer.
llvm-svn: 339495
Douglas Yung [Sat, 11 Aug 2018 02:46:47 +0000 (02:46 +0000)]
Make the section boundary checks on Windows not depend on the order as they are emitted in reverse when the compiler is built by Visual C++.
llvm-svn: 339494
George Karpenkov [Sat, 11 Aug 2018 01:47:41 +0000 (01:47 +0000)]
[analyzer] Fix keyboard navigation for .msgNote events
Does not go to msgNote's.
Differential Revision: https://reviews.llvm.org/D50595
llvm-svn: 339493
Tom Stellard [Sat, 11 Aug 2018 01:08:34 +0000 (01:08 +0000)]
[gold] Fix Tests cases on i686
Reviewers: tejohnson
Reviewed By: tejohnson
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D50583
llvm-svn: 339492
Tom Stellard [Sat, 11 Aug 2018 00:51:54 +0000 (00:51 +0000)]
AMDGPU/GlobalISel: Define instruction mapping for G_INSERT
Reviewers: arsenm
Reviewed By: arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D49625
llvm-svn: 339491
Richard Trieu [Fri, 10 Aug 2018 23:58:11 +0000 (23:58 +0000)]
Fix WebAssembly tests after r339474
Add flags to llc RUN lines to keep tests passing.
llvm-svn: 339490
Reka Kovacs [Fri, 10 Aug 2018 23:56:57 +0000 (23:56 +0000)]
[analyzer] InnerPointerChecker: improve warning messages and notes.
Differential Revision: https://reviews.llvm.org/D49570
llvm-svn: 339489
George Karpenkov [Fri, 10 Aug 2018 23:51:43 +0000 (23:51 +0000)]
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck - II
Some files were missed by https://reviews.llvm.org/D50545
Differential Revision: https://reviews.llvm.org/D50590
llvm-svn: 339488
Sid Manning [Fri, 10 Aug 2018 23:46:11 +0000 (23:46 +0000)]
[ELF][HEXAGON] Put test back in.
The registers are tied.
llvm-svn: 339487
Sid Manning [Fri, 10 Aug 2018 22:54:54 +0000 (22:54 +0000)]
[ELF][HEXAGON] Remove test that breaks assembler.
Remove testcase the breaks the assembler parser. Will fix llvm-mc
and put this back afterward.
llvm-svn: 339486
JF Bastien [Fri, 10 Aug 2018 22:41:09 +0000 (22:41 +0000)]
Re-commit "[NFC] More ConstantMerge refactoring"
My previous change moved some code upwards which caused an assert in debug mode
because the global value didn't necessarily have an initializer. Don't do that.
llvm-svn: 339485
Michael Kruse [Fri, 10 Aug 2018 22:33:27 +0000 (22:33 +0000)]
[DepInfo] Use isl++ in Dependences::isValidSchedule. NFC.
Also change StatementToIslMapTy to hold isl::map, because it is used as a
parameter.
llvm-svn: 339484
Simon Marchi [Fri, 10 Aug 2018 22:27:53 +0000 (22:27 +0000)]
[clangd] Avoid duplicates in findDefinitions response
Summary:
When compile_commands.json contains some source files expressed as
relative paths, we can get duplicate responses to findDefinitions. The
responses only differ by the URI, which are different versions of the
same file:
"result": [
{
...
"uri": "file:///home/emaisin/src/ls-interact/cpp-test/build/../src/first.h"
},
{
...
"uri": "file:///home/emaisin/src/ls-interact/cpp-test/src/first.h"
}
]
In getAbsoluteFilePath, we try to obtain the realpath of the FileEntry
by calling tryGetRealPathName. However, this can fail and return an
empty string. It may be bug a bug in clang, but in any case we should
fall back to computing it ourselves if it happens.
I changed getAbsoluteFilePath so that if tryGetRealPathName succeeds, we
return right away (a real path is always absolute). Otherwise, we try
to build an absolute path, as we did before, but we also call
VFS->getRealPath to make sure to get the canonical path (e.g. without
any ".." in it).
Reviewers: malaperle
Subscribers: hokein, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D48687
llvm-svn: 339483
George Karpenkov [Fri, 10 Aug 2018 22:27:04 +0000 (22:27 +0000)]
[analyzer] Record nullability implications on getting items from NSDictionary
If we get an item from a dictionary, we know that the item is non-null
if and only if the key is non-null.
This patch is a rather hacky way to record this implication, because
some logic needs to be duplicated from the solver.
And yet, it's pretty simple, performant, and works.
Other possible approaches:
- Record the implication, in future rely on Z3 to pick it up.
- Generalize the current code and move it to the constraint manager.
rdar://
34990742
Differential Revision: https://reviews.llvm.org/D50124
llvm-svn: 339482
Philip Reames [Fri, 10 Aug 2018 22:21:56 +0000 (22:21 +0000)]
[LICM] Hoist assumes out of loops
If we have an assume which is known to execute and whose operand is invariant, we can lift that into the pre-header. So long as we don't change which paths the assume executes on, this is a legal transformation. It's likely to be a useful canonicalization as other transforms only look for dominating assumes.
Differential Revision: https://reviews.llvm.org/D50364
llvm-svn: 339481
JF Bastien [Fri, 10 Aug 2018 22:10:20 +0000 (22:10 +0000)]
Revert "[NFC] More ConstantMerge refactoring"
Sanitizers seem unhappy.
llvm-svn: 339480
Eli Friedman [Fri, 10 Aug 2018 22:03:25 +0000 (22:03 +0000)]
Fix unused lambda capture warning from r339472.
llvm-svn: 339479
JF Bastien [Fri, 10 Aug 2018 21:58:00 +0000 (21:58 +0000)]
[NFC] More ConstantMerge refactoring
This makes my upcoming patch much easier to read.
llvm-svn: 339478
Sid Manning [Fri, 10 Aug 2018 21:48:40 +0000 (21:48 +0000)]
[ELF][HEXAGON] Add R_HEX_8_X relocation
Differential Revision: https://reviews.llvm.org/D50577
llvm-svn: 339477
George Karpenkov [Fri, 10 Aug 2018 21:42:19 +0000 (21:42 +0000)]
[analyzer] Fix tracking expressions through negation operator
Differential Revision: https://reviews.llvm.org/D50537
llvm-svn: 339476
George Karpenkov [Fri, 10 Aug 2018 21:36:45 +0000 (21:36 +0000)]
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck
Some of the analyzer tests check the exact plist output, in order to
verify that the diagnostics produced is correct.
Current testing setup has many issues:
plist output clobbers tests, making them harder to read
it is impossible to debug test failures given error messages from FileCheck.
The only recourse is manually creating the files and using the diff
again, it is impossible to update the tests given the error message:
the only process is a tedious manual one,
going from a separate plist file to CHECK directives.
This patch offers a much better approach of using "diff" directly in place of FileCheck,
and moving tests to separate files.
Generated using the following script:
```
import os
import glob
import re
import subprocess
diagnostics_key = "// CHECK: <key>diagnostics</key>"
def process_file(f, data):
idx = data.index(diagnostics_key)
plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f
plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f))
plist_data = data[idx:]
plist_data = plist_data.replace('// CHECK: ', '')
plist_data = plist_data.replace('// CHECK-NEXT: ', '')
plist_data += "</dict>\n</plist>\n"
data = data[:idx]
ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s")
if not ptn.findall(data):
print "none found =/ skipping..."
return
data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data)
with open(f, 'w') as out_f:
out_f.write(data)
subprocess.check_call(["mkdir", "-p", plist_out_folder])
with open(plist_out_f, 'w') as out_f:
out_f.write(plist_data)
def main():
files = glob.glob("**/*.*")
for f in files:
with open(f) as f_handler:
data = f_handler.read()
if diagnostics_key in data:
print "Converting %s" %f
process_file(f, data)
if __name__ == "__main__":
main()
```
Differential Revision: https://reviews.llvm.org/D50545
llvm-svn: 339475
Wouter van Oortmerssen [Fri, 10 Aug 2018 21:32:47 +0000 (21:32 +0000)]
[WebAssembly] Added default stack-only instruction mode for MC.
Summary:
Moved Explicit Locals pass to last.
Made that pass obligatory.
Made it convert from register to stack based instructions, and removed the registers.
Fixes to related code that was expecting register based instructions.
Added the correct testing flag to all tests, depending on what the
format they were expecting so far.
Translated one test to stack format as example: reg-stackify-stack.ll
tested:
llvm-lit -v `find test -name WebAssembly`
unittests/MC/*
Reviewers: dschuff, sunfish
Subscribers: jfb, llvm-commits, aheejin, eraman, jgravelle-google, sbc100
Differential Revision: https://reviews.llvm.org/D50568
llvm-svn: 339474
Raphael Isemann [Fri, 10 Aug 2018 21:31:44 +0000 (21:31 +0000)]
Remove copy-pasted and unrelated comment [NFC]
That comment was copied from the
CombineConsecutiveEntriesWithEqualData() implementation below,
and doesn't actually describe what's happening in the current
function.
llvm-svn: 339473
Eli Friedman [Fri, 10 Aug 2018 21:21:53 +0000 (21:21 +0000)]
[ARM] Adjust AND immediates to make them cheaper to select.
LLVM normally prefers to minimize the number of bits set in an AND
immediate, but that doesn't always match the available ARM instructions.
In Thumb1 mode, prefer uxtb or uxth where possible; otherwise, prefer
a two-instruction sequence movs+ands or movs+bics.
Some potential improvements outlined in
ARMTargetLowering::targetShrinkDemandedConstant, but seems to work
pretty well already.
The ARMISelDAGToDAG fix ensures we don't generate an invalid UBFX
instruction due to a larger-than-expected mask. (It's orthogonal, in
some sense, but as far as I can tell it's either impossible or nearly
impossible to reproduce the bug without this change.)
According to my testing, this seems to consistently improve codesize by
a small amount by forming bic more often for ISD::AND with an immediate.
Differential Revision: https://reviews.llvm.org/D50030
llvm-svn: 339472
Zachary Turner [Fri, 10 Aug 2018 21:09:05 +0000 (21:09 +0000)]
[MS Demangler] Support extern "C" functions.
There are two cases we need to support with extern "C"
functions. The first is the case of a '9' indicating that
the function has no prototype. This occurs when we mangle
a symbol inside of an extern "C" function, but not the
function itself.
The second case is when we have an overloaded extern "C"
functions. In this case we emit $$J0 to indicate this.
This patch adds support for both of these cases.
llvm-svn: 339471
Sanjay Patel [Fri, 10 Aug 2018 21:00:27 +0000 (21:00 +0000)]
[InstCombine] add tests for fsub factorization; NFC
The tests show that;
1. The fold doesn't fire for vectors, but it should.
2. The fold fires regardless of uses, but it shouldn't.
llvm-svn: 339470
Sanjay Patel [Fri, 10 Aug 2018 20:30:35 +0000 (20:30 +0000)]
[InstCombine] rearrange code for foldSelectBinOpIdentity; NFCI
This is a retry of rL339439 with a fix for the problem that
caused the original commit to be reverted at rL339446.
That problem was that the compare can be integer while
the binop is FP or vice-versa, so we need to use the binop
type when we ask for the identity constant.
A test to guard against the problem was added at rL339453.
llvm-svn: 339469
Matt Davis [Fri, 10 Aug 2018 20:24:27 +0000 (20:24 +0000)]
[llvm-mca] Make InstrBuilder::getOrCreateInstrDesc private. NFC.
llvm-svn: 339468
Sanjay Patel [Fri, 10 Aug 2018 20:12:36 +0000 (20:12 +0000)]
[InstCombine] add tests to show disabling of libcall/intrinsic shrinking; NFC
llvm-svn: 339467
Zachary Turner [Fri, 10 Aug 2018 20:08:46 +0000 (20:08 +0000)]
Resubmit r339450 - [MS Demangler] Add conversion operator tests
This was broken because of a malformed check line. Incidentally,
this exposed a case where we crash when we should just be returning
an error, so we should fix that. The demangler shouldn't crash due
to user input.
llvm-svn: 339466
Zachary Turner [Fri, 10 Aug 2018 19:57:36 +0000 (19:57 +0000)]
[MS Demangler] Demangle cv qualifiers on template args.
Before we wouldn't properly demangle something like
Foo<const int>. Template args have a special escape sequence
'$$C' that is optional, but if it is present contains
qualifiers. So we need to check for this and only if it
present, demangle qualifiers before demangling the type.
With this fix, we re-enable some tests that were previously
marked FIXME.
llvm-svn: 339465
Matt Arsenault [Fri, 10 Aug 2018 19:20:17 +0000 (19:20 +0000)]
AMDGPU: More canonicalized operations
llvm-svn: 339464
Sanjay Patel [Fri, 10 Aug 2018 19:20:16 +0000 (19:20 +0000)]
revert r339450 - [MS Demangler] Add conversion operator tests
Something here causes an assertion failure that killed a bunch of bots.
Example:
http://lab.llvm.org:8011/builders/reverse-iteration/builds/7021/steps/check_all/logs/stdio
llvm-svn: 339463
Matt Arsenault [Fri, 10 Aug 2018 18:58:56 +0000 (18:58 +0000)]
AMDGPU: Combine and of seto/setuo and fp_class
Clear the nan (or non-nan) test bits from the mask.
llvm-svn: 339462
Matt Arsenault [Fri, 10 Aug 2018 18:58:49 +0000 (18:58 +0000)]
AMDGPU: Turn class x, p_zero|n_zero into fcmp oeq x, 0
The library does use this for some reason.
llvm-svn: 339461
Matt Arsenault [Fri, 10 Aug 2018 18:58:41 +0000 (18:58 +0000)]
AMDGPU: Match isfinite pattern to class instructions
llvm-svn: 339460
George Karpenkov [Fri, 10 Aug 2018 18:28:04 +0000 (18:28 +0000)]
Invalidate static locals when escaping lambdas
Lambdas can affect static locals even without an explicit capture.
rdar://
39537031
Differential Revision: https://reviews.llvm.org/D50368
llvm-svn: 339459
Matt Arsenault [Fri, 10 Aug 2018 17:57:12 +0000 (17:57 +0000)]
AMDGPU: Add LLVM_FALLTHROUGH
llvm-svn: 339458
Stella Stamenova [Fri, 10 Aug 2018 17:52:45 +0000 (17:52 +0000)]
[tests, libstdcxx] Add missing test category on the TestDataFormatterStdUniquePtr tests
Each test needs to be marked with the add_test_categories decorator individually.
llvm-svn: 339457
Aaron Ballman [Fri, 10 Aug 2018 17:33:47 +0000 (17:33 +0000)]
Allow relockable scopes with thread safety attributes.
Patch by Aaron Puchert
llvm-svn: 339456
Aaron Ballman [Fri, 10 Aug 2018 17:26:07 +0000 (17:26 +0000)]
Update the coding standards and developer policy documentation surrounding whitespace.
Clarify that you should not introduce trailing whitespace when making a commit and that you should not remove trailing whitespace that's unrelated to code you are changing or are about to change. Then clarified the developer policy around what is considered an obvious whitespace commit.
llvm-svn: 339455
Alex Lorenz [Fri, 10 Aug 2018 17:25:07 +0000 (17:25 +0000)]
[clangd] extend the publishDiagnostics response to send back fixits to the
client if the client supports this extension
This commit extends the 'textDocument/publishDiagnostics' notification sent from
Clangd to the client. When it's enabled, Clangd sends out the fixits associated
with the appropriate diagnostic in the body of the 'publishDiagnostics'
notification. The client can enable this extension by setting 'clangdFixSupport'
to true in the textDocument capabilities during initialization.
Differential Revision: https://reviews.llvm.org/D50415
llvm-svn: 339454
Sanjay Patel [Fri, 10 Aug 2018 17:20:24 +0000 (17:20 +0000)]
[InstCombine] add/update tests for selectBinOpIdentity; NFC
This includes a test that would have exposed the bug in rL339439
which was reverted at rL339446. The compare can be integer while
the binop is FP or vice-versa, so we need to use the binop type
when we ask for the identity constant.
llvm-svn: 339453
Akira Hatanaka [Fri, 10 Aug 2018 17:07:27 +0000 (17:07 +0000)]
Make changes to the check strings so that the test I modified in r339438
passes on 32-bit targets.
llvm-svn: 339452
Volodymyr Sapsai [Fri, 10 Aug 2018 17:03:47 +0000 (17:03 +0000)]
[libcxx] Mark charconv tests as failing for previous libcxx versions.
<charconv> was added in r338479. Previous libcxx versions don't have
this functionality and corresponding tests should be failing.
Reviewers: mclow.lists, ldionne, EricWF
Reviewed By: ldionne
Subscribers: christof, dexonsmith, lichray, EricWF, cfe-commits
Differential Revision: https://reviews.llvm.org/D50543
llvm-svn: 339451
Zachary Turner [Fri, 10 Aug 2018 16:55:59 +0000 (16:55 +0000)]
[MS Demangler] Add conversion operator tests.
The mangled names were added in the original commit, but
the demangled equivalents weren't, so nothing was actually
being checked.
llvm-svn: 339450
Evgeniy Stepanov [Fri, 10 Aug 2018 16:38:57 +0000 (16:38 +0000)]
[hwasan] Remove liblog dependency.
HWASan will not run on older Android releases where we use
__android_log_write for logging.
This dependency is also harmful in the case when libc itself depends
on hwasan, because it creates a loop of
libc -> hwasan -> liblog -> libc
which makes liblog vs libc initialization order undetermined.
Without liblog the loop is just
libc -> hwasan -> libc
and any init order issues can be solved in hwasan.
llvm-svn: 339449
Jordan Rupprecht [Fri, 10 Aug 2018 16:25:58 +0000 (16:25 +0000)]
[llvm-objcopy] NFC: consistently use typename ELFT::<X> definitions in headers
llvm-svn: 339448
Evgeniy Stepanov [Fri, 10 Aug 2018 16:21:37 +0000 (16:21 +0000)]
[hwasan] Add -hwasan-with-ifunc flag.
Summary: Similar to asan's flag, it can be used to disable the use of ifunc to access hwasan shadow address.
Reviewers: vitalybuka, kcc
Subscribers: srhines, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D50544
llvm-svn: 339447
Sanjay Patel [Fri, 10 Aug 2018 16:12:19 +0000 (16:12 +0000)]
[InstCombine] revert r339439 - rearrange code for foldSelectBinOpIdentity
That was supposed to be NFC, but it exposed a logic hole somewhere that
caused bots to fail.
llvm-svn: 339446
David Bolvansky [Fri, 10 Aug 2018 15:29:09 +0000 (15:29 +0000)]
[InstCombine][NFC] Added tests for select with binop fold
llvm-svn: 339441
Stefan Granitz [Fri, 10 Aug 2018 15:21:33 +0000 (15:21 +0000)]
RichManglingContext: Make m_ipd_str_len a local variable and simplify processIPDStrResult + polishing in test and Mangled
llvm-svn: 339440
Sanjay Patel [Fri, 10 Aug 2018 15:11:26 +0000 (15:11 +0000)]
[InstCombine] rearrange code for foldSelectBinOpIdentity; NFCI
This should make it easier to folow and to add the planned enhancements
such as D50190.
llvm-svn: 339439
Akira Hatanaka [Fri, 10 Aug 2018 15:09:24 +0000 (15:09 +0000)]
[CodeGen] Merge equivalent block copy/helper functions.
Clang generates copy and dispose helper functions for each block literal
on the stack. Often these functions are equivalent for different blocks.
This commit makes changes to merge equivalent copy and dispose helper
functions and reduce code size.
To enable merging equivalent copy/dispose functions, the captured object
infomation is encoded into the helper function name. This allows IRGen
to check whether an equivalent helper function has already been emitted
and reuse the function instead of generating a new helper function
whenever a block is defined. In addition, the helper functions are
marked as linkonce_odr to enable merging helper functions that have the
same name across translation units and marked as unnamed_addr to enable
the linker's deduplication pass to merge functions that have different
names but the same content.
rdar://problem/
42640608
Differential Revision: https://reviews.llvm.org/D50152
llvm-svn: 339438
Roman Lebedev [Fri, 10 Aug 2018 15:05:46 +0000 (15:05 +0000)]
[clang-tidy] check_clang_tidy.py: support CHECK-NOTES prefix
Summary:
Currently, there is two configured prefixes: `CHECK-FIXES` and `CHECK-MESSAGES`
`CHECK-MESSAGES` checks that there are no test output lines with `warning:|error:`, which are not explicitly handled in lit tests.
However there does not seem to be a nice way to enforce for all the `note:` to be checked.
This was useful for me when developing D36836.
Reviewers: alexfh, klimek, aaron.ballman, hokein
Reviewed By: alexfh, aaron.ballman
Subscribers: JonasToth, JDevlieghere, xazax.hun, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D36892
llvm-svn: 339437
Zachary Turner [Fri, 10 Aug 2018 15:04:56 +0000 (15:04 +0000)]
[MS Demangler] Properly demangle conversion operators.
These were completely broken before. We need to handle
the 'B' operator tag.
llvm-svn: 339436
Zachary Turner [Fri, 10 Aug 2018 14:53:33 +0000 (14:53 +0000)]
[MS Demangler] Disable a couple of tests.
The check lines are marked FIXME but not the mangled names.
This is causing an error.
llvm-svn: 339435
Zachary Turner [Fri, 10 Aug 2018 14:31:04 +0000 (14:31 +0000)]
[MS Demangler] Fix several issues related to templates.
These were uncovered when porting the mangling tests in
ms-templates.cpp from clang/CodeGenCXX over to demangling
tests. The main issues fixed here are surrounding integer
literal signed and unsignedness, empty array dimensions,
and pointer and reference non-type template parameters.
Differential Revision: https://reviews.llvm.org/D50512
llvm-svn: 339434
Alexander Kornienko [Fri, 10 Aug 2018 13:59:33 +0000 (13:59 +0000)]
[clang-tidy: modernize] modernize-redundant-void-arg crashes when a function body is in a macro
Fixes https://bugs.llvm.org/show_bug.cgi?id=28406
Patch by IdrissRio.
Differential revision: https://reviews.llvm.org/D49800
llvm-svn: 339433
Sam Parker [Fri, 10 Aug 2018 13:57:13 +0000 (13:57 +0000)]
[ARM] Disallow zexts in ARMCodeGenPrepare
Enabling ARMCodeGenPrepare by default caused a whole load of
failures. This is due to zexts and truncs not being handled properly.
ZExts are messy so it's just easier to disable for now and truncs
are allowed only as 'sinks'. I still need to figure out why allowing
them as 'sources' causes so many failures. The other main changes are
that we are explicit in the types that we converting to, it's now
always 'TypeSize'. Type support is also now performed while checking
for valid opcodes as it unnecessarily complicated having the checks
are different stages.
I've moved the tests around too, so we have the zext and truncs in
their own file as well as the overflowing opcode tests.
Differential Revision: https://reviews.llvm.org/D50518
llvm-svn: 339432
Louis Dionne [Fri, 10 Aug 2018 13:24:56 +0000 (13:24 +0000)]
[libc++] Enable aligned allocation based on feature test macro, irrespective of standard
Summary:
The current code enables aligned allocation functions when compiling in C++17
and later. This is a problem because aligned allocation functions might not
be supported on the target platform, which leads to an error at link time.
Since r338934, Clang knows not to define __cpp_aligned_new when it's not
available on the target platform -- this commit takes advantage of that to
only use aligned allocation functions when they are available.
Reviewers: vsapsai, EricWF
Subscribers: christof, dexonsmith, cfe-commits, EricWF, mclow.lists
Differential Revision: https://reviews.llvm.org/D50344
llvm-svn: 339431
Tatyana Krasnukha [Fri, 10 Aug 2018 13:01:26 +0000 (13:01 +0000)]
Amend "Remove unused type Either from Utility library".
llvm-svn: 339430
David Chisnall [Fri, 10 Aug 2018 12:53:18 +0000 (12:53 +0000)]
Fix a deprecated warning in the last commit.
Done as a separate commit to make it easier to cherry pick the changes
to the release branch.
llvm-svn: 339429
David Chisnall [Fri, 10 Aug 2018 12:53:13 +0000 (12:53 +0000)]
Add Windows support for the GNUstep Objective-C ABI V2.
Summary:
Introduces funclet-based unwinding for Objective-C and fixes an issue
where global blocks can't have their isa pointers initialised on
Windows.
After discussion with Dustin, this changes the name mangling of
Objective-C types to prevent a C++ catch statement of type struct X*
from catching an Objective-C object of type X*.
Reviewers: rjmccall, DHowett-MSFT
Reviewed By: rjmccall, DHowett-MSFT
Subscribers: mgrang, mstorsjo, smeenai, cfe-commits
Differential Revision: https://reviews.llvm.org/D50144
llvm-svn: 339428
Andi-Bogdan Postelnicu [Fri, 10 Aug 2018 11:50:47 +0000 (11:50 +0000)]
[clang-tidy] run-clang-tidy.py - add synchronisation to the output
Differential Revision: https://reviews.llvm.org/D49851
llvm-svn: 339427
Kirill Bobyrev [Fri, 10 Aug 2018 11:50:44 +0000 (11:50 +0000)]
[clangd] Allow consuming limited number of items
This patch modifies `consume` function to allow retrieval of limited
number of symbols. This is the "cheap" implementation of top-level
limiting iterator. In the future we would like to have a complete limit
iterator implementation to insert it into the query subtrees, but in the
meantime this version would be enough for a fully-functional
proof-of-concept Dex implementation.
Reviewers: ioeric, ilya-biryukov
Reviewed by: ioeric
Differential Revision: https://reviews.llvm.org/D50500
llvm-svn: 339426
Simon Pilgrim [Fri, 10 Aug 2018 11:42:42 +0000 (11:42 +0000)]
[X86][SSE] Pull out repeated shift getOpcode() calls. NFCI.
llvm-svn: 339425
Hans Wennborg [Fri, 10 Aug 2018 11:40:50 +0000 (11:40 +0000)]
clang-cl: accept -fcrash-diagnostics-dir=
llvm-svn: 339424
Bruno Ricci [Fri, 10 Aug 2018 11:20:20 +0000 (11:20 +0000)]
Fix a wrong type bug in ParsedAttr::TypeTagForDatatypeData
This patch fixes a wrong type bug inside ParsedAttr::TypeTagForDatatypeData.
The details to the best of my knowledge are as follow. The incredible thing
is that everything works out just fine by chance due to a sequence of lucky
coincidences in the layout of various types.
The struct ParsedAttr::TypeTagForDatatypeData contains among other things
a ParsedType *MatchingCType, where ParsedType is just OpaquePtr<QualType>.
However the member MatchingCType is initialized in the constructor for
type_tag_for_datatype attribute as follows:
new (&ExtraData.MatchingCType) ParsedType(matchingCType);
This results in the ParsedType being constructed in the location of the
ParsedType * Later ParsedAttr::getMatchingCType do return
*getTypeTagForDatatypeDataSlot().MatchingCType; which instead of
dereferencing the ParsedType * will dereference the QualType inside
the ParsedType. Now this QualType in this case contains no qualifiers
and therefore is a valid Type *. Therefore getMatchingCType returns a
Type or at least the stuff that is in the first sizeof(void*) bytes of it,
But it turns out that Type inherits from ExtQualsCommonBase and that the
first member of ExtQualsCommonBase is a const Type *const BaseType. This
Type * in this case points to the original Type pointed to by the
QualType and so everything works fine even though all the types were wrong.
This bug was only found because I changed the layout of Type,
which obviously broke all of this long chain of improbable events.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D50532
llvm-svn: 339423
Simon Pilgrim [Fri, 10 Aug 2018 11:02:44 +0000 (11:02 +0000)]
Fix -Wimplicit-fallthrough warning introduced in rL339397.
llvm-svn: 339422
Andrea Di Biagio [Fri, 10 Aug 2018 10:43:43 +0000 (10:43 +0000)]
[Tablegen][SubtargetEmitter] refactor method `emitSchedModelHelpersImpl()`. NFCI
Part of the logic has been moved to helper functions to (hopefully) improve
readability.
Added a few code comments to better describe how the algorithm works.
No functional change intended.
llvm-svn: 339421
Hans Wennborg [Fri, 10 Aug 2018 09:49:21 +0000 (09:49 +0000)]
clang-cl: Support /guard:cf,nochecks
This extension emits the guard cf table without inserting the
instrumentation. Currently that's what clang-cl does with /guard:cf
anyway, but this allows a user to request that explicitly.
Differential Revision: https://reviews.llvm.org/D50513
llvm-svn: 339420
Hans Wennborg [Fri, 10 Aug 2018 09:48:53 +0000 (09:48 +0000)]
Rename the cfguard module flag to cfguardtable
The previous name sounds like it inserts cfguard implementation, but it
really just emits the table of address-taken functions. Change the name
to better reflect that.
Clang will be updated in the next commit.
llvm-svn: 339419
Max Kazantsev [Fri, 10 Aug 2018 09:20:46 +0000 (09:20 +0000)]
[NFC] Add tests that demonstrate that MustExecute is fundamentally broken
llvm-svn: 339417
Haojian Wu [Fri, 10 Aug 2018 08:34:16 +0000 (08:34 +0000)]
[clangd] Fix a "-Wdangling-else" compiler warning in the test.
llvm-svn: 339416
Haojian Wu [Fri, 10 Aug 2018 08:25:51 +0000 (08:25 +0000)]
[clang-tidy] Omit cases where loop variable is not used in loop body in
performance-for-range-copy check.
Summary:
The upstream change r336737 make the check too smart to fix the case
where loop variable could be used as `const auto&`.
But for the case below, changing to `const auto _` will introduce
an unused complier warning.
```
for (auto _ : state) {
// no references for _.
}
```
This patch omit this case, and it is safe to do it as the case is very rare.
Reviewers: ilya-biryukov, alexfh
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D50447
llvm-svn: 339415