Commit Graph

296599 Commits

Author SHA1 Message Date
Shuai Wang 3b2a17bd1d [ASTMatchers] Let hasAnyArgument also support CXXUnresolvedConstructExpr
Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D50605

llvm-svn: 339530
2018-08-12 23:30:05 +00:00
Craig Topper 484b342c68 [X86] Add constant folding for AVX512 versions of scalar floating point to integer conversion intrinsics.
Summary:
We've supported constant folding for sse versions for many years. This patch adds support for the avx512 versions including unsigned with the default rounding mode. We could probably do more with other roundings modes and SAE in the future.

The test cases are largely based on the sse.ll test cases. But I did add some test cases to ensure the unsigned versions don't accept negative values. Also checked the bounds of f64->i32 conversions to make sure unsigned has a larger positive range than signed.

Reviewers: RKSimon, spatel, chandlerc

Reviewed By: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D50553

llvm-svn: 339529
2018-08-12 22:09:54 +00:00
Daniel Sanders f1e8e3b316 [globalisel] Remove dead code from GlobalISelEmitter
Summary: Found by GCC's -Wunused-function.

Patch by Kim Gräsman

Reviewers: ab, dsanders, llvm-commits

Reviewed By: dsanders

Subscribers: rovka, kristof.beyls

Differential Revision: https://reviews.llvm.org/D50611

llvm-svn: 339528
2018-08-12 21:49:42 +00:00
Aaron Ballman 8cd96484d2 Renaming arg_const_range to const_arg_range; NFC.
This form makes more sense (it is a range over constant arguments) and is most consistent with const_arg_iterator (there are zero instances of arg_const_iterator).

llvm-svn: 339527
2018-08-12 21:19:22 +00:00
Matt Arsenault 3763f307bd AMDGPU: Cleanup min/max legacy tests
Also add some more tests in preparation for
a future patch.

llvm-svn: 339526
2018-08-12 19:29:53 +00:00
Matt Arsenault 1201301b94 DAG: Check no-signed-zeros instead of unsafe-fp-math
Addresses fixme, although this should still be checking individual
operand flags.

llvm-svn: 339525
2018-08-12 19:09:12 +00:00
David Bolvansky cd57242587 [NFC] Fixed build, updated tests
llvm-svn: 339524
2018-08-12 18:32:53 +00:00
David Bolvansky ddfe408f9a [NFC] Renamed test file
llvm-svn: 339523
2018-08-12 17:43:27 +00:00
Shuai Wang 72b56ed6b4 [ASTMatchers] Add matchers unresolvedMemberExpr, cxxDependentScopeMemberExpr
Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D50606

llvm-svn: 339522
2018-08-12 17:34:36 +00:00
David Bolvansky a72172f431 [Support][JSON][NFC] Silence GCC warning about broken strict aliasing rules
Summary:
The as<T>() method would trigger the following warning on GCC <7:

   warning: dereferencing type-punned pointer will break
       strict-aliasing rules [-Wstrict-aliasing]

     return *reinterpret_cast<T *>(Union.buffer);
                                               ^

Union.buffer is guaranteed to be aligned to whatever types it contains,
and json::Value maintains the invariant that it only calls as<T>() for a
T it has previously placement-newed into Union.buffer. This should
follow the rules for strict aliasing.

Using two static_cast via void * instead of reinterpret_cast
silences the warning and presumably makes GCC understand that no
strict-aliasing violation is happening.

No functional change intended.

Patch by: kimgr (Kim Gräsman)

Reviewers: sammccall, xiangzhai, HaoLiu, llvm-commits, xbolva00

Reviewed By: sammccall, xbolva00

Subscribers: xbolva00

Differential Revision: https://reviews.llvm.org/D50608

llvm-svn: 339521
2018-08-12 17:31:46 +00:00
David Bolvansky 01d98cc03f [InstCombine] Fold Select with binary op - non-commutative opcodes
Summary:
Basic version was merged - https://reviews.llvm.org/D49954

This adds support for FP & non-commutative opcodes

Precommited tests: https://reviews.llvm.org/rL338727

Reviewers: spatel, lebedev.ri

Reviewed By: spatel

Subscribers: jfb

Differential Revision: https://reviews.llvm.org/D50190

llvm-svn: 339520
2018-08-12 17:30:07 +00:00
Sanjay Patel dc185ee275 [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
2018-08-12 15:48:26 +00:00
Sanjay Patel ce104b6c16 [InstCombine] move/add tests for fadd/fsub factorization; NFC
llvm-svn: 339518
2018-08-12 15:06:15 +00:00
Aaron Ballman d824f0cbe3 Adding the readability module to the list of dependencies for the C++ Core Guidelines module. Amends r339516 for a failing bot.
llvm-svn: 339517
2018-08-12 14:47:16 +00:00
Aaron Ballman bc8f5ac754 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
2018-08-12 14:35:13 +00:00
Benjamin Kramer bae6aab6fb [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
2018-08-12 11:43:03 +00:00
George Rimar 25cd609a64 [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
2018-08-12 09:16:22 +00:00
Matt Arsenault 13b0db9285 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
2018-08-12 08:44:25 +00:00
Matt Arsenault b5acec1f79 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
2018-08-12 08:42:54 +00:00
Matt Arsenault 3ead7d7389 AMDGPU: Fix packing undef parts of build_vector
llvm-svn: 339511
2018-08-12 08:42:46 +00:00
George Rimar a5cf8da145 [LLF][ELF] - Simplify. NFC.
llvm-svn: 339510
2018-08-12 07:52:24 +00:00
Craig Topper 60177f1aee [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
2018-08-12 06:52:03 +00:00
Craig Topper d112206004 [TargetLowering] Use APInt::isSubsetOf to simplify some code. NFC
llvm-svn: 339508
2018-08-12 05:34:15 +00:00
Craig Topper ed8a114c86 [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
2018-08-12 03:22:18 +00:00
Raphael Isemann 612c524a90 [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
2018-08-11 23:43:46 +00:00
Raphael Isemann 30e0c43c17 [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
2018-08-11 23:43:02 +00:00
Raphael Isemann a7f19e5fda 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
2018-08-11 23:40:27 +00:00
Martin Storsjo 9b60b9289c Add missing _LIBCXXABI_FUNC_VIS to __gxx_personality_seh0
This was missed in SVN r337754.

llvm-svn: 339503
2018-08-11 19:36:06 +00:00
Chijun Sima ce698a5586 [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
2018-08-11 08:12:07 +00:00
David Green f7111d1ece [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
2018-08-11 07:37:31 +00:00
David Green 395b80cd3c [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
2018-08-11 06:57:28 +00:00
Craig Topper b3e3477649 [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
2018-08-11 06:42:51 +00:00
Craig Topper c6cf169940 [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
2018-08-11 06:42:50 +00:00
Craig Topper 616eeb827d [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
2018-08-11 06:42:49 +00:00
Craig Topper 570d47a010 [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
2018-08-11 05:33:00 +00:00
Richard Trieu 01f99f3cd6 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
2018-08-11 04:18:05 +00:00
Douglas Yung 9b6cd711d6 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
2018-08-11 02:46:47 +00:00
George Karpenkov b3fff18638 [analyzer] Fix keyboard navigation for .msgNote events
Does not go to msgNote's.

Differential Revision: https://reviews.llvm.org/D50595

llvm-svn: 339493
2018-08-11 01:47:41 +00:00
Tom Stellard 69bf876b49 [gold] Fix Tests cases on i686
Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D50583

llvm-svn: 339492
2018-08-11 01:08:34 +00:00
Tom Stellard 8adc86a7dc 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
2018-08-11 00:51:54 +00:00
Richard Trieu f1342bb8b8 Fix WebAssembly tests after r339474
Add flags to llc RUN lines to keep tests passing.

llvm-svn: 339490
2018-08-10 23:58:11 +00:00
Reka Kovacs bb2749a594 [analyzer] InnerPointerChecker: improve warning messages and notes.
Differential Revision: https://reviews.llvm.org/D49570

llvm-svn: 339489
2018-08-10 23:56:57 +00:00
George Karpenkov 2537972f25 [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
2018-08-10 23:51:43 +00:00
Sid Manning 2e20df3e9b [ELF][HEXAGON] Put test back in.
The registers are tied.

llvm-svn: 339487
2018-08-10 23:46:11 +00:00
Sid Manning 98b07a615b [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
2018-08-10 22:54:54 +00:00
JF Bastien fe258d9776 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
2018-08-10 22:41:09 +00:00
Michael Kruse 0e4e6e5e87 [DepInfo] Use isl++ in Dependences::isValidSchedule. NFC.
Also change StatementToIslMapTy to hold isl::map, because it is used as a
parameter.

llvm-svn: 339484
2018-08-10 22:33:27 +00:00
Simon Marchi 25f1f7325f [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
2018-08-10 22:27:53 +00:00
George Karpenkov e99ba6e1f9 [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
2018-08-10 22:27:04 +00:00
Philip Reames 85afd1a9a0 [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
2018-08-10 22:21:56 +00:00