Commit Graph

295492 Commits

Author SHA1 Message Date
Jatin Bhateja
36432a70c1 [X86] Adding more test patterns for lea-opt (PR37939)
Subscribers: llvm-commits

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

llvm-svn: 338483
2018-08-01 03:53:27 +00:00
Petr Hosek
78c20a8563 [OpenEmbedded] Explicitly specify -rtlib in tests
Tests added in r338294 implicitly assume that libgcc is the runtime library,
but that's not the case when the user configures Clang to use compiler-rt in
which case these tests will break. Explicitly request libgcc when invoking
clang in these tests to avoid that.

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

llvm-svn: 338482
2018-08-01 03:30:06 +00:00
Chandler Carruth
2ce191e220 [x86] Fix a really subtle miscompile due to a somewhat glaring bug in
EFLAGS copy lowering.

If you have a branch of LLVM, you may want to cherrypick this. It is
extremely unlikely to hit this case empirically, but it will likely
manifest as an "impossible" branch being taken somewhere, and will be
... very hard to debug.

Hitting this requires complex conditions living across complex control
flow combined with some interesting memory (non-stack) initialized with
the results of a comparison. Also, because you have to arrange for an
EFLAGS copy to be in *just* the right place, almost anything you do to
the code will hide the bug. I was unable to reduce anything remotely
resembling a "good" test case from the place where I hit it, and so
instead I have constructed synthetic MIR testing that directly exercises
the bug in question (as well as the good behavior for completeness).

The issue is that we would mistakenly assume any SETcc with a valid
condition and an initial operand that was a register and a virtual
register at that to be a register *defining* SETcc...

It isn't though....

This would in turn cause us to test some other bizarre register,
typically the base pointer of some memory. Now, testing this register
and using that to branch on doesn't make any sense. It even fails the
machine verifier (if you are running it) due to the wrong register
class. But it will make it through LLVM, assemble, and it *looks*
fine... But wow do you get a very unsual and surprising branch taken in
your actual code.

The fix is to actually check what kind of SETcc instruction we're
dealing with. Because there are a bunch of them, I just test the
may-store bit in the instruction. I've also added an assert for sanity
that ensure we are, in fact, *defining* the register operand. =D

llvm-svn: 338481
2018-08-01 03:01:58 +00:00
Chandler Carruth
014047a99a [x86/slh] Add unwind info to several tests to make it more obvious that
we aren't incorrectly generating any of it when doing SLH.

There was a bug that only occured with SLH that very much looked like it
could be caused by bad unwind info, and so this was a prime suspect.
Turns out that everything is fine, but this way we'll *see* if we end
up, for example, putting things we shouldn't inside the prolog.

llvm-svn: 338480
2018-08-01 03:01:10 +00:00
Zhihao Yuan
d27489645b [libc++][C++17] Elementary string conversions for integral types
Summary:
Major QoI considerations:

- The facility is backported to C++14, same as libstdc++.
- Efforts have been made to minimize the header dependencies.
- The design is friendly to the uses of MSVC intrinsics (`__emulu`, `_umul128`, `_BitScanForward`, `_BitScanForward64`) but not implemented; future contributions are welcome.

Thanks to Milo Yip for contributing the implementation of `__u64toa` and `__u32toa`.

References:
 https://wg21.link/p0067r5
 https://wg21.link/p0682r1

Reviewers: mclow.lists, EricWF

Reviewed By: mclow.lists

Subscribers: ldionne, Quuxplusone, christof, mgorny, cfe-commits

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

llvm-svn: 338479
2018-08-01 02:38:30 +00:00
Richard Smith
1dd9501b3a Work around GCC miscompile exposed by r338464.
See gcc.gnu.org/PR86769 for details of the bug.

llvm-svn: 338478
2018-08-01 02:27:18 +00:00
Hsiangkai Wang
5c63af0d04 [DebugInfo] Generate fixups as emitting DWARF .debug_line.
It is necessary to generate fixups in .debug_line as relaxation is
enabled due to the address delta may be changed after relaxation.

DWARF will record the mappings of lines and addresses in
.debug_line section. It will encode the information using special
opcodes, standard opcodes and extended opcodes in Line Number
Program. I use DW_LNS_fixed_advance_pc to encode fixed length
address delta and DW_LNE_set_address to encode absolute address
to make it possible to generate fixups in .debug_line section.

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

llvm-svn: 338477
2018-08-01 02:18:06 +00:00
Amara Emerson
6cdfe29d8e [GlobalISel][IRTranslator] Use RPO traversal when visiting blocks to translate.
Previously we were just visiting the blocks in the function in IR order, which
is rather arbitrary. Therefore we wouldn't always visit defs before uses, but
the translation code relies on this assumption in some places.

Only codegen change seen in tests is an elision of a redundant copy.

Fixes PR38396

llvm-svn: 338476
2018-08-01 02:17:42 +00:00
Louis Dionne
c8e84ff251 [libc++] Remove _LIBCPP_BUILDING_XXX macros, which are redundant since _LIBCPP_BUILDING_LIBRARY
Summary: As suggested by Marshall in https://reviews.llvm.org/D49914

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

llvm-svn: 338475
2018-08-01 02:08:59 +00:00
Artem Dergachev
b21b479653 [analyzer] CallEvent: Add helper methods for obtaining the callee stack frame.
Newly added methods allow reasoning about the stack frame of the call (as
opposed to the stack frame on which the call was made, which was always
available) - obtain the stack frame context, obtain parameter regions - even if
the call is not going to be (or was not) inlined, i.e. even if the analysis
has never actually entered the stack frame.

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

llvm-svn: 338474
2018-08-01 01:58:15 +00:00
Richard Smith
c4581f4e92 Speculative fix for buildbot failures after r338464.
llvm-svn: 338473
2018-08-01 01:57:49 +00:00
Erik Pilkington
b0386a515b First half of C++17's splicing maps and sets
This commit adds a node handle type, (located in __node_handle), and adds
extract() and insert() members to all map and set types, as well as their
implementations in __tree and __hash_table.

The second half of this feature is adding merge() members, which splice nodes
in bulk from one container into another. This will be committed in a follow-up.

Differential revision: https://reviews.llvm.org/D46845

llvm-svn: 338472
2018-08-01 01:33:38 +00:00
Konstantin Zhuravlyov
9057546c5b AMDGPU: Add clamp bit to dot builtins
Differential Revision: https://reviews.llvm.org/D50011

llvm-svn: 338471
2018-08-01 01:32:21 +00:00
Konstantin Zhuravlyov
bb30ef7af4 AMDGPU: Add clamp bit to dot intrinsics
Differential Revision: https://reviews.llvm.org/D49874

llvm-svn: 338470
2018-08-01 01:31:30 +00:00
Eric Christopher
7a70be6865 Simplify selectELFSectionForGlobal by pulling out the entry size
determination for mergeable sections into a small static function.

llvm-svn: 338469
2018-08-01 01:29:30 +00:00
Eric Christopher
ad36c74562 Tidy up logic around unique section name creation and remove a
mostly unused variable.

llvm-svn: 338468
2018-08-01 01:03:34 +00:00
Richard Smith
ad5bbcceb7 Avoid exposing name for range-based for '__range' variables in lifetime warnings.
llvm-svn: 338467
2018-08-01 01:03:33 +00:00
Michael Kruse
37b3c1775b [JSONExporter] Try to appease buildbot. NFC.
The compiler does not seem to able move a local variable in the
function's return statement.

llvm-svn: 338466
2018-08-01 00:48:01 +00:00
Eli Friedman
da08078fb2 [MachineOutliner] Clean up subtarget handling.
Call shouldOutlineFromFunctionByDefault, isFunctionSafeToOutlineFrom,
getOutliningType, and getMachineOutlinerMBBFlags using the correct
TargetInstrInfo. And don't create a MachineFunction for a function
declaration.

The call to getOutliningCandidateInfo is still a little weird, but at
least the weirdness is explicitly called out.

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

llvm-svn: 338465
2018-08-01 00:37:20 +00:00
Richard Smith
f4e248c23e [P0936R0] add [[clang::lifetimebound]] attribute
This patch adds support for a new attribute, [[clang::lifetimebound]], that
indicates that the lifetime of a function result is related to one of the
function arguments. When walking an initializer to make sure that the lifetime
of the initial value is at least as long as the lifetime of the initialized
object, we step through parameters (including the implicit object parameter of
a non-static member function) that are marked with this attribute.

There's nowhere to write an attribute on the implicit object parameter, so in
lieu of that, it may be applied to a function type (where it appears
immediately after the cv-qualifiers and ref-qualifier, which is as close to a
declaration of the implicit object parameter as we have). I'm currently
modeling this in the AST as the attribute appertaining to the function type.

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

llvm-svn: 338464
2018-08-01 00:33:25 +00:00
Evandro Menezes
eb159e56a6 [PATCH] [SLC] Test simplification of pow() for vector types (NFC)
Add test case for the simplification of `pow()` for vector types that D50035
enables.

llvm-svn: 338463
2018-08-01 00:30:43 +00:00
Michael Kruse
42ad818265 [Polly-ACC] Fix compilation after r338450. NFC.
llvm-svn: 338462
2018-08-01 00:27:29 +00:00
Michael Kruse
23655020a2 [JSONExporter] Replace bundled Jsoncpp with llvm/Support/JSON.h. NFC.
Differential Revision: https://reviews.llvm.org/D49950

llvm-svn: 338461
2018-08-01 00:15:16 +00:00
Eric Christopher
83c49e8ed4 Android is an environment and we were comparing the android triple
against the OS rather than the environment. Also update other
uses of OS when we meant environment in the android local code.

NFC intended.

llvm-svn: 338460
2018-07-31 23:53:24 +00:00
Eric Christopher
852e88ad85 Tidy up comment.
llvm-svn: 338459
2018-07-31 23:53:24 +00:00
Eric Christopher
926b7c71f3 Use UnknownVendor rather than UnknownArch since they're in two different enums
and we're switching on vendor and not arch.

llvm-svn: 338458
2018-07-31 23:53:23 +00:00
Marshall Clow
1f9e03f04d Final bit of P0063 - make sure that aligned_alloc is available when the underlying C library supports it
llvm-svn: 338457
2018-07-31 23:39:12 +00:00
Matt Davis
89e8af6d96 [compiler-rt] Add a routine to specify the mode used when creating profile dirs.
Summary:
This patch introduces `llvm_profile_set_dir_mode` and `llvm_profile_get_dir_mode` to
the compiler-rt profile API. 

Originally, profile data was placed into a directory that was created with a hard-coded
mode value of 0755 (for non-win32 builds).  In certain cases, it can be helpful to create
directories with a different mode other than 0755.  This patch introduces set/get
routines to allow users to specify a desired mode.  The default remains at 0755.

Reviewers: void, probinson

Reviewed By: probinson

Subscribers: probinson, dberris, cfe-commits

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

llvm-svn: 338456
2018-07-31 23:37:24 +00:00
Richard Smith
96beffba15 [constexpr] Support for constant evaluation of __builtin_memcpy and
__builtin_memmove (in non-type-punning cases).

This is intended to permit libc++ to make std::copy etc constexpr
without sacrificing the optimization that uses memcpy on
trivially-copyable types.

__builtin_strcpy and __builtin_wcscpy are not handled by this change.
They'd be straightforward to add, but we haven't encountered a need for
them just yet.

llvm-svn: 338455
2018-07-31 23:35:09 +00:00
Marshall Clow
5802ab265c Test for the presence of a bunch of new macros for c++17. These macros come from C11. Part of P0063
llvm-svn: 338454
2018-07-31 23:29:06 +00:00
Marco Castelluccio
ae43a27f9c [gcov] Add tests using switch, one with break clauses and one with fallthrough
llvm-svn: 338453
2018-07-31 23:26:50 +00:00
Reid Kleckner
b32ff46ff7 Revert r338354 "[ARM] Revert r337821"
Disable ARMCodeGenPrepare by default again. It is causing verifier
failues in V8 that look like:

  Duplicate integer as switch case
  switch i32 %trunc, label %if.end13 [
    i32 0, label %cleanup36
    i32 0, label %if.then8
  ], !dbg !4981
  i32 0
  fatal error: error in backend: Broken function found, compilation aborted!

I will continue reducing the test case and send it along.

llvm-svn: 338452
2018-07-31 23:09:42 +00:00
Michael Kruse
e873673b0c [CodeGen] Convert IslNodeBuilder::getNumberOfIterations to isl++. NFC.
llvm-svn: 338451
2018-07-31 23:01:50 +00:00
Michael Kruse
f16378b080 [CodeGen] Convert IslNodeBuilder::createForSequential to isl++. NFC.
llvm-svn: 338450
2018-07-31 22:43:04 +00:00
Michael Kruse
ade2242e7e [CodeGen] Convert IslNodeBuilder::getUpperBound to isl++. NFC.
llvm-svn: 338449
2018-07-31 22:42:59 +00:00
David L. Jones
9fb2e3ceaa [WebAssembly] Fix debug info tests after r338437.
After r338437, debug_ranges are no longer emitted. Previously, this was only
done for DWARF version 5 and above.

llvm-svn: 338448
2018-07-31 22:24:14 +00:00
Victor Leschuk
58d3399d8a [DWARF] Support for .debug_addr (consumer)
This patch implements basic support for parsing
  and dumping DWARFv5 .debug_addr section.

llvm-svn: 338447
2018-07-31 22:19:19 +00:00
Evandro Menezes
61e4e40750 [SLC] Refactor the simplication of pow() (NFC)
Reword comments and minor code reformatting.

llvm-svn: 338446
2018-07-31 22:11:02 +00:00
Rumeet Dhindsa
9d9113fc13 Allow oformat to accept format starting with elf as acceptable format. isOutputFormatBinary returns false in such case.
Example: --oformat elf64-x86-64

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

llvm-svn: 338445
2018-07-31 21:58:26 +00:00
Reid Kleckner
acbbf4bf78 Revert r337635 "[Driver] Sanitizer support based on runtime library presence"
This change causes issues with distributed build systems, which may only
have compiler binaries without any runtime libraries. See discussion
about this on https://reviews.llvm.org/D15225.

llvm-svn: 338444
2018-07-31 21:57:35 +00:00
Fangrui Song
87b4b8f7b4 [llvm-objcopy] Make --strip-debug strip .gdb_index
Summary:
See binutils-gdb/bfd/elf.c, GNU objcopy also strips .stab* (STABS)
.line* (DWARF 1) .gnu.linkonce.wi.* (linkonce section for .debug_info) but
I'm not sure we need to be compatible with it.

Reviewers: dblaikie, alexshap, jakehehrlich, jhenderson

Reviewed By: alexshap, jakehehrlich

Subscribers: aprantl, JDevlieghere, jakehehrlich, llvm-commits

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

llvm-svn: 338443
2018-07-31 21:26:35 +00:00
George Burgess IV
497e8fad51 Revert r338431: "Add DebugCounters to DivRemPairs"
This reverts r338431; the test it added is making buildbots unhappy.
Locally, I can repro the failure on reverse-iteration builds.

llvm-svn: 338442
2018-07-31 21:18:44 +00:00
Artem Dergachev
67d393f3d1 [analyzer] Fix eliding the same destructor twice due to buggy default arguments.
Because of incomplete support for CXXDefaultArgExpr, we cannot yet commit to
asserting that the same destructor won't be elided twice.

Suppress the assertion failure for now. Proper support is still an open problem.

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

llvm-svn: 338441
2018-07-31 21:17:40 +00:00
David L. Jones
2a895e57af [lld] Fix test RUN commands so they don't fail when run in a read-only filesystem.
Some test setups run tests in a read-only path, which means that opening the
default output path (a.out) for write will fail. This change adds appropriate -o
flags so the tests will not fail spuriously.

llvm-svn: 338440
2018-07-31 21:15:58 +00:00
Artem Dergachev
1f8cb3a65e [CFG] [analyzer] NFC: Enumerate construction context layer kinds.
This is a refactoring patch; no functional change intended.

The common part of ConstructionContextLayer and ConstructedObjectKey is
factored out into a new structure, ConstructionContextItem.

Various sub-kinds of ConstructionContextItem are enumerated in order to
provide richer information about construction contexts.

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

llvm-svn: 338439
2018-07-31 21:12:42 +00:00
Richard Smith
559cc69789 [serialization] PR34728: Don't assume that only a suffix of template
parameters can have default arguments.

At least for function templates and class template partial
specializations, it's possible for a template parameter with a default
argument to be followed by a non-pack template parameter with no default
argument, and this case was not properly handled here.

Testcase by Steve O'Brien!

llvm-svn: 338438
2018-07-31 21:01:53 +00:00
Wolfgang Pieb
baf94f830b [DWARF] Do not create a .debug_ranges section when no ranges are needed.
Reviewers: aprantl

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

llvm-svn: 338437
2018-07-31 20:56:32 +00:00
Artem Dergachev
a657a32cc8 [CFG] [analyzer] Implement function argument construction contexts.
In r330377 and r338425 we have already identified what constitutes function
argument constructors and added stubs in order to prevent confusing them
with other temporary object constructors.

Now we implement a ConstructionContext sub-class to carry all the necessary
information about the construction site, namely call expression and argument
index.

On the analyzer side, the patch interacts with the recently implemented
pre-C++17 copy elision support in an interesting manner. If on the CFG side we
didn't find a construction context for the elidable constructor, we build
the CFG as if the elidable constructor is not elided, and the non-elided
constructor within it is a simple temporary. But the same problem may occur
in the analyzer: if the elidable constructor has a construction context but
the analyzer doesn't implement such context yet, the analyzer should also
try to skip copy elision and still inline the non-elided temporary constructor.
This was implemented by adding a "roll back" mechanism: when elision fails,
roll back the changes and proceed as if it's a simple temporary. The approach
is wonky, but i'm fine with that as long as it's merely a defensive mechanism
that should eventually go away once all construction contexts become supported.

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

llvm-svn: 338436
2018-07-31 20:45:53 +00:00
Matt Arsenault
118c47b6d1 AMDGPU: Split amdgcn/r600 fminnum/fmaxnum tests
R600 breaks on too many things to usefully test changes
with ieee_mode on vs. off.

llvm-svn: 338435
2018-07-31 20:38:42 +00:00
Peter Collingbourne
2da4e52182 ELF: Add libcall symbols to the link when LTO is being used.
If any of our inputs are bitcode files, the LTO code generator may create
references to certain library functions that might not be explicit in the
bitcode file's symbol table. If any of those library functions are defined
in a bitcode file in an archive member, we need to arrange to use LTO to
compile those archive members by adding them to the link beforehand.

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

llvm-svn: 338434
2018-07-31 20:36:17 +00:00