platform/upstream/llvm.git
7 years ago[sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage flag...
Kostya Serebryany [Wed, 3 May 2017 01:27:28 +0000 (01:27 +0000)]
[sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage flag combinations

llvm-svn: 301994

7 years agoFixed a bug where we did not properly use the complete versions of Objective-C classes.
Sean Callanan [Wed, 3 May 2017 00:41:43 +0000 (00:41 +0000)]
Fixed a bug where we did not properly use the complete versions of Objective-C classes.
Also added a test case, thanks to Greg Clayton.

<rdar://problem/18913551>

llvm-svn: 301993

7 years ago[modules] Round-trip -Werror flag through explicit module build.
Richard Smith [Wed, 3 May 2017 00:28:49 +0000 (00:28 +0000)]
[modules] Round-trip -Werror flag through explicit module build.

The intent for an explicit module build is that the diagnostics produced within
the module are those that were configured when the module was built, not those
that are enabled within a user of the module. This includes diagnostics that
don't actually show up until the module is used (for instance, diagnostics
produced during template instantiation and weird cases like -Wpadded).

We serialized and restored the diagnostic state for individual warning groups,
but previously did not track the state for flags like -Werror and -Weverything,
which are implemented as separate bits rather than as part of the diagnostics
mapping information.

llvm-svn: 301992

7 years agoRevert r295861, "[ModuleSummaryAnalysis] Don't crash when referencing unnamed globals."
Peter Collingbourne [Wed, 3 May 2017 00:18:48 +0000 (00:18 +0000)]
Revert r295861, "[ModuleSummaryAnalysis] Don't crash when referencing unnamed globals."

We should always expect values to be named before running the module summary
analysis (see NameAnonGlobals pass), so it's fine if we crash in that case.

llvm-svn: 301991

7 years ago[PowerPC, DAGCombiner] Fold a << (b % (sizeof(a) * 8)) back to a single instruction
Tim Shen [Wed, 3 May 2017 00:07:02 +0000 (00:07 +0000)]
[PowerPC, DAGCombiner] Fold a << (b % (sizeof(a) * 8)) back to a single instruction

Summary:
This is the corresponding llvm change to D28037 to ensure no performance
regression.

Reviewers: bogner, kbarton, hfinkel, iteratee, echristo

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 301990

7 years ago[ODRHash] Add support for array and decayed types, and parameter names and types.
Richard Trieu [Tue, 2 May 2017 23:58:52 +0000 (23:58 +0000)]
[ODRHash] Add support for array and decayed types, and parameter names and types.

llvm-svn: 301989

7 years ago[ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)
Vedant Kumar [Tue, 2 May 2017 23:46:56 +0000 (23:46 +0000)]
[ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)

Currently, ubsan emits overflow checks for arithmetic that is known to
be safe at compile-time, e.g:

  1 + 1 => CheckedAdd(1, 1)

This leads to breakage when using the __builtin_prefetch intrinsic. LLVM
expects the arguments to @llvm.prefetch to be constant integers, and
when ubsan inserts unnecessary checks on the operands to the intrinsic,
this contract is broken, leading to verifier failures (see PR32874).

Instead of special-casing __builtin_prefetch for ubsan, this patch fixes
the underlying problem, i.e that clang currently emits unnecessary
overflow checks.

Testing: I ran the check-clang and check-ubsan targets with a stage2,
ubsan-enabled build of clang. I added a regression test for PR32874, and
some extra checking to make sure we don't regress runtime checking for
unsafe arithmetic. The existing ubsan-promoted-arithmetic.cpp test also
provides coverage for this change.

llvm-svn: 301988

7 years agoFix type conversion error.
Zachary Turner [Tue, 2 May 2017 23:41:51 +0000 (23:41 +0000)]
Fix type conversion error.

llvm-svn: 301987

7 years agoMake codeview::StringTable.
Zachary Turner [Tue, 2 May 2017 23:36:17 +0000 (23:36 +0000)]
Make codeview::StringTable.

Previously we had knowledge of how to serialize and deserialize
a string table inside of DebugInfo/PDB, but the string table
that it serializes contains a piece that is actually considered
CodeView and can appear outside of a PDB.  We already have logic
in llvm-readobj and MCCodeView to read and write this format,
so it doesn't make sense to duplicate the logic in DebugInfoPDB
as well.

This patch makes codeview::StringTable (for writing) and
codeview::StringTableRef (for reading), updates DebugInfoPDB
to use these classes for its own writing, and updates llvm-readobj
to additionally use StringTableRef for reading.

It's a bit more difficult to get MCCodeView to use this for
writing, but it's a logical next step.

llvm-svn: 301986

7 years agoTypo in LangRef.rst. NFC
Xin Tong [Tue, 2 May 2017 23:24:12 +0000 (23:24 +0000)]
Typo in LangRef.rst. NFC

llvm-svn: 301985

7 years agoAdd line table verification to lldb-dwarfdump --verify
Greg Clayton [Tue, 2 May 2017 22:48:52 +0000 (22:48 +0000)]
Add line table verification to lldb-dwarfdump --verify

This patch verifies the .debug_line:
- verify all addresses in a line table sequence have ascending addresses
- verify that all line table file indexes are valid

Unit tests added for both cases.

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

llvm-svn: 301984

7 years agoARM: avoid handing a deleted node back to TableGen during ISel.
Tim Northover [Tue, 2 May 2017 22:45:19 +0000 (22:45 +0000)]
ARM: avoid handing a deleted node back to TableGen during ISel.

When we replaced the multiplicand the destination node might already exist.
When that happens the original gets CSEd and deleted. However, it's actually
used as the offset so nonsense is produced.

Should fix PR32726.

llvm-svn: 301983

7 years agoRemove a dead function declaration.
Rui Ueyama [Tue, 2 May 2017 22:42:24 +0000 (22:42 +0000)]
Remove a dead function declaration.

llvm-svn: 301982

7 years agoRe-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of Attribute...
Reid Kleckner [Tue, 2 May 2017 22:07:37 +0000 (22:07 +0000)]
Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"

This time, I fixed, built, and tested clang.

This reverts r301712.

llvm-svn: 301981

7 years ago[AArch64] ILP32 Backend Relocation Support
Joel Jones [Tue, 2 May 2017 22:01:48 +0000 (22:01 +0000)]
[AArch64] ILP32 Backend Relocation Support

Remove "_NC" suffix and semantics from TLSDESC_LD{64,32}_LO12 and
  TLSDESC_ADD_LO12 relocations
Rearrange ordering in AArch64.def to follow relocation encoding
Fix name:
  R_AARCH64_P32_LD64_GOT_LO12_NC => R_AARCH64_P32_LD32_GOT_LO12_NC
Add support for several "TLS", "TLSGD", and "TLSLD" relocations for
  ILP32
Fix return values from isNonILP32reloc
Add implementations for
  R_AARCH64_ADR_PREL_PG_HI21_NC, R_AARCH64_P32_LD32_GOT_LO12_NC,
  R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC,
  R_AARCH64_P32_TLSDESC_LD32_LO12, R_AARCH64_LD64_GOT_LO12_NC,
  *TLSLD_LDST128_DTPREL_LO12, *TLSLD_LDST128_DTPREL_LO12_NC,
  *TLSLE_LDST128_TPREL_LO12, *TLSLE_LDST128_TPREL_LO12_NC
Modify error messages to give name of equivalent relocation in the
  ABI not being used, along with better checking for non-existent
  requested relocations.
Added assembler support for "pg_hi21_nc"
Relocation definitions added without implementations:
  R_AARCH64_P32_TLSDESC_ADR_PREL21, R_AARCH64_P32_TLSGD_ADR_PREL21,
  R_AARCH64_P32_TLSGD_ADD_LO12_NC, R_AARCH64_P32_TLSLD_ADR_PREL21,
  R_AARCH64_P32_TLSLD_ADR_PAGE21, R_AARCH64_P32_TLSLD_ADD_LO12_NC,
  R_AARCH64_P32_TLSLD_LD_PREL19, R_AARCH64_P32_TLSDESC_LD_PREL19,
  R_AARCH64_P32_TLSGD_ADR_PAGE21, R_AARCH64_P32_TLS_DTPREL,
  R_AARCH64_P32_TLS_DTPMOD, R_AARCH64_P32_TLS_TPREL,
  R_AARCH64_P32_TLSDESC
Fix encoding:
  R_AARCH64_P32_TLSDESC_ADR_PAGE21

Reviewers: Peter Smith

Patch by: Joel Jones (jjones@cavium.com)

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

llvm-svn: 301980

7 years agoRemove _NC suffix from ELF relocations TLSDESC_{LD64,ADD}_LO12
Joel Jones [Tue, 2 May 2017 22:01:30 +0000 (22:01 +0000)]
Remove _NC suffix from ELF relocations TLSDESC_{LD64,ADD}_LO12

llvm-svn: 301979

7 years ago[DWARFv5] Parse new line-table header format.
Paul Robinson [Tue, 2 May 2017 21:40:47 +0000 (21:40 +0000)]
[DWARFv5] Parse new line-table header format.

The directory and file tables now have form-based content descriptors.
Parse these and extract the per-directory/file records based on the
descriptors.  For now we support only DW_FORM_string (inline) for the
path names; follow-up work will add support for indirect forms (i.e.,
DW_FORM_strp, strx<N>, and line_strp).

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

llvm-svn: 301978

7 years agorevert r301766: InstructionSimplify: Canonicalize shuffle operands. NFC-ish
Sanjay Patel [Tue, 2 May 2017 21:37:28 +0000 (21:37 +0000)]
revert r301766: InstructionSimplify: Canonicalize shuffle operands. NFC-ish

Turns out this wasn't NFC-ish at all because there's a bug processing shuffles
that change the size of their input vectors (that case always seems to trip us
up).

This should fix PR32872 while we investigate how it failed and reduce a testcase:
https://bugs.llvm.org/show_bug.cgi?id=32872

llvm-svn: 301977

7 years ago[asan] Mark some more testcases as unsupported on iOS.
Kuba Mracek [Tue, 2 May 2017 21:22:29 +0000 (21:22 +0000)]
[asan] Mark some more testcases as unsupported on iOS.

llvm-svn: 301976

7 years agoFix typo.
Rui Ueyama [Tue, 2 May 2017 21:16:06 +0000 (21:16 +0000)]
Fix typo.

llvm-svn: 301975

7 years ago[NewGVN] Fix typo and format comment. NFCI.
Davide Italiano [Tue, 2 May 2017 21:11:40 +0000 (21:11 +0000)]
[NewGVN] Fix typo and format comment. NFCI.

llvm-svn: 301974

7 years ago[NFC] Add original test that triggered crash post r301735
Faisal Vali [Tue, 2 May 2017 21:02:46 +0000 (21:02 +0000)]
[NFC] Add original test that triggered crash post r301735
- this is added just for completeness sake (though the general case should be represented by the test added in the revision to that patch:  https://reviews.llvm.org/rL301972 )

llvm-svn: 301973

7 years agoFix PR32831 (Try Again): 'this' capture while instantiating generic lambda call opera...
Faisal Vali [Tue, 2 May 2017 20:56:34 +0000 (20:56 +0000)]
Fix PR32831 (Try Again): 'this' capture while instantiating generic lambda call operator specialization

When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda.

https://bugs.llvm.org/show_bug.cgi?id=32831

This patch was initially committed here: https://reviews.llvm.org/rL301735
Then reverted here: https://reviews.llvm.org/rL301916

The issue with the original patch was a failure to check that the closure type has been created within the LambdaScopeInfo before querying its DeclContext - instead of just assuming it has (silly!).  A reduced example such as this highlights the problem:
  struct X {
     int data;
     auto foo() { return [] { return [] -> decltype(data) { return 0; }; }; }
  };

When 'data' within decltype(data) tries to determine the type of 'this', none of the LambdaScopeInfo's have their closure types created at that point.

llvm-svn: 301972

7 years agoVerify that all references point to actual DIEs in "llvm-dwarfdump --verify"
Greg Clayton [Tue, 2 May 2017 20:28:33 +0000 (20:28 +0000)]
Verify that all references point to actual DIEs in "llvm-dwarfdump --verify"

LTO and other fancy linking previously led to DWARF that contained invalid references. We already validate that CU relative references fall into the CU, and the DW_FORM_ref_addr references fall inside the .debug_info section, but we didn't validate that the references pointed to correct DIE offsets. This new verification will ensure that all references refer to actual DIEs and not an offset in between.

This caught a bug in DWARFUnit::getDIEForOffset() where if you gave it any offset, it would match the DIE that mathes the offset _or_ the next DIE. This has been fixed.

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

llvm-svn: 301971

7 years ago[Sema] Update function doc; NFC
George Burgess IV [Tue, 2 May 2017 20:24:56 +0000 (20:24 +0000)]
[Sema] Update function doc; NFC

llvm-svn: 301970

7 years agoRevert "Fix misnamed #include. Remove _NC suffix from ELF relocations TLSDESC_{LD64...
Rafael Espindola [Tue, 2 May 2017 20:19:42 +0000 (20:19 +0000)]
Revert "Fix misnamed #include. Remove _NC suffix from ELF relocations TLSDESC_{LD64,ADD}_LO12"

This reverts commit r301964. It broke the build.

llvm-svn: 301969

7 years agoSimplify some va_start checking logic
Reid Kleckner [Tue, 2 May 2017 20:10:03 +0000 (20:10 +0000)]
Simplify some va_start checking logic

Combine the logic doing the ms_abi/sysv_abi checks into one function so
that each check and its logical opposite are near each other. Now we
don't need two Sema entry points for MS va_start and regular va_start.

Refactor the code that checks if the va_start caller is a function,
block, or obj-c method. We do this in three places, and they are all
buggy for variadic lambdas (PR32737). After this change, I have one
place to apply the functional fix.

NFC

llvm-svn: 301968

7 years ago[asan] Mark atos-symbolizer-dyld-root-path.cc testcase as unsupported on iOS.
Kuba Mracek [Tue, 2 May 2017 20:09:33 +0000 (20:09 +0000)]
[asan] Mark atos-symbolizer-dyld-root-path.cc testcase as unsupported on iOS.

llvm-svn: 301967

7 years ago[asan] Mark a bunch of tests as unsupported on iOS
Kuba Mracek [Tue, 2 May 2017 19:37:28 +0000 (19:37 +0000)]
[asan] Mark a bunch of tests as unsupported on iOS

This patch marks a few ASan tests as unsupported on iOS. These are mostly tests that use files or paths that are invalid/inaccessible on iOS or the simulator. We currently don't have a good way of propagating/copying secondary files that individual tests need. The same problem exists on Android, so I'm just marking the tests as UNSUPPORTED now.

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

llvm-svn: 301966

7 years ago[asan] Disable some Darwin tests that don't work on iOS simulator
Kuba Mracek [Tue, 2 May 2017 19:35:29 +0000 (19:35 +0000)]
[asan] Disable some Darwin tests that don't work on iOS simulator

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

llvm-svn: 301965

7 years agoFix misnamed #include. Remove _NC suffix from ELF relocations TLSDESC_{LD64,ADD}_LO12
Joel Jones [Tue, 2 May 2017 19:31:40 +0000 (19:31 +0000)]
Fix misnamed #include. Remove _NC suffix from ELF relocations TLSDESC_{LD64,ADD}_LO12

llvm-svn: 301964

7 years agoRevert r301822 (and dependent r301825), which tried to improve the
Daniel Jasper [Tue, 2 May 2017 19:21:42 +0000 (19:21 +0000)]
Revert r301822 (and dependent r301825), which tried to improve the
handling of constexprs with unknown bounds.

This triggers a corner case of the language where it's not yet clear
whether this should be an error:

  struct A {
    static void *const a[];
    static void *const b[];
  };
  constexpr void *A::a[] = {&b[0]};
  constexpr void *A::b[] = {&a[0]};

When discovering the initializer for A::a, the bounds of A::b aren't known yet.
It is unclear whether warning about errors should be deferred until the end of
the translation unit, possibly resolving errors that can be resolved. In
practice, the compiler can know the bounds of all arrays in this example.

Credits for reproducers and explanation go to Richard Smith. Richard, please
add more info in case my explanation is wrong.

llvm-svn: 301963

7 years agoARM: add arm1176j-f processor
Tim Northover [Tue, 2 May 2017 19:06:13 +0000 (19:06 +0000)]
ARM: add arm1176j-f processor

I doubt anyone actually uses it, and I'm not even entirely convinced it exists
myself; but it is our default for "clang -arch armv6". Functionally, if it does
exist it's identical to the arm1176jz-f from LLVM's point of view (the
difference is apparently in the "Security Extensions").

llvm-svn: 301962

7 years agoPEI: Skip dead objects when looking at CSRs
Matt Arsenault [Tue, 2 May 2017 18:56:28 +0000 (18:56 +0000)]
PEI: Skip dead objects when looking at CSRs

On AMDGPU if an SGPR is spilled to a VGPR, the frame index
is deleted. If there were any CSR SGPRs, this woudl
assert when setting the offset.

llvm-svn: 301961

7 years agoRevert "[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin"
Vedant Kumar [Tue, 2 May 2017 18:51:41 +0000 (18:51 +0000)]
Revert "[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin"

This reverts commit r300295.

It's no longer true, print_stacktrace=1 is supported on Darwin/Windows
as of r301839.

llvm-svn: 301960

7 years ago[PartialInlining] Add more early filtering
Xinliang David Li [Tue, 2 May 2017 18:43:21 +0000 (18:43 +0000)]
[PartialInlining] Add more early filtering

This is a follow up to the previous
inline cost patch for quicker filtering.

llvm-svn: 301959

7 years agoAMDGPU: Don't promote alloca to LDS for leaf functions
Matt Arsenault [Tue, 2 May 2017 18:33:18 +0000 (18:33 +0000)]
AMDGPU: Don't promote alloca to LDS for leaf functions

LDS use in leaf functions not currently handled.

llvm-svn: 301958

7 years ago[Hexagon] Fix uninitialized value caught with valgrind
Krzysztof Parzyszek [Tue, 2 May 2017 18:29:49 +0000 (18:29 +0000)]
[Hexagon] Fix uninitialized value caught with valgrind

Patch by Colin LeMahieu.

llvm-svn: 301957

7 years ago[Hexagon] Change iconst to emit 27bit relocation
Krzysztof Parzyszek [Tue, 2 May 2017 18:19:11 +0000 (18:19 +0000)]
[Hexagon] Change iconst to emit 27bit relocation

Patch by Colin LeMahieu.

llvm-svn: 301956

7 years ago[Hexagon] Add extenders for GD_PLT_B22_PCREL and LD_PLT_B22_PCREL
Krzysztof Parzyszek [Tue, 2 May 2017 18:15:33 +0000 (18:15 +0000)]
[Hexagon] Add extenders for GD_PLT_B22_PCREL and LD_PLT_B22_PCREL

Patch by Sid Manning.

llvm-svn: 301955

7 years ago[Hexagon] Don't ignore mult-cycle latency information
Krzysztof Parzyszek [Tue, 2 May 2017 18:12:19 +0000 (18:12 +0000)]
[Hexagon] Don't ignore mult-cycle latency information

The compiler was generating code that ends up ignoring a multiple
latency dependence between two instructions by scheduling the
intructions in back-to-back packets.

The packetizer needs to end a packet if the latency of the current
current insruction and the source in the previous packet is
greater than 1 cycle. This case occurs when there is still room in
the current packet, but scheduling the instruction causes a stall.
Instead, the packetizer should start a new packet. Also, if the
current packet already contains a stall, then it is okay to add
another instruction to the packet that also causes a stall. This
occurs when there are no instructions that can be scheduled in
between the producer and consumer instructions.

This patch changes the latency for loads to 2 cycles from 3 cycles.
This change refects that a load only needs to be separated by
one extra packet to eliminate the stall.

Patch by Ikhlas Ajbar.

llvm-svn: 301954

7 years ago[Hexagon] Formatting changes, NFC
Krzysztof Parzyszek [Tue, 2 May 2017 18:09:07 +0000 (18:09 +0000)]
[Hexagon] Formatting changes, NFC

llvm-svn: 301953

7 years ago[Hexagon] Remove unused validSubtarget TSFlags
Krzysztof Parzyszek [Tue, 2 May 2017 18:05:36 +0000 (18:05 +0000)]
[Hexagon] Remove unused validSubtarget TSFlags

Patch by Colin LeMahieu.

llvm-svn: 301952

7 years ago[Hexagon] Make sure duplexed dealloc_returns are checked for double jumps
Krzysztof Parzyszek [Tue, 2 May 2017 18:03:08 +0000 (18:03 +0000)]
[Hexagon] Make sure duplexed dealloc_returns are checked for double jumps

Patch by Colin LeMahieu.

llvm-svn: 301951

7 years agoSpeculativeExecution: Stop using whitelist for costs
Matt Arsenault [Tue, 2 May 2017 18:02:18 +0000 (18:02 +0000)]
SpeculativeExecution: Stop using whitelist for costs

Just let TTI's cost do this instead of arbitrarily restricting
this.

llvm-svn: 301950

7 years ago[Hexagon] Move checking AXOK to checker
Krzysztof Parzyszek [Tue, 2 May 2017 18:00:37 +0000 (18:00 +0000)]
[Hexagon] Move checking AXOK to checker

Patch by Colin LeMahieu.

llvm-svn: 301949

7 years agoRename pdb::StringTable -> pdb::PDBStringTable.
Zachary Turner [Tue, 2 May 2017 18:00:13 +0000 (18:00 +0000)]
Rename pdb::StringTable -> pdb::PDBStringTable.

With the forthcoming codeview::StringTable which a pdb::StringTable
would hold an instance of as one member, this ambiguity becomes
confusing.  Rename to PDBStringTable to avoid this.

llvm-svn: 301948

7 years ago[Hexagon] Remove unneeded code from HexagonShuffler
Krzysztof Parzyszek [Tue, 2 May 2017 17:58:52 +0000 (17:58 +0000)]
[Hexagon] Remove unneeded code from HexagonShuffler

Patch by Colin LeMahieu.

llvm-svn: 301947

7 years ago[Hexagon] Extract function that checks endloops with other branches
Krzysztof Parzyszek [Tue, 2 May 2017 17:56:11 +0000 (17:56 +0000)]
[Hexagon] Extract function that checks endloops with other branches

Change location number to point to conflicting branch instruction.

Patch by Colin LeMahieu.

llvm-svn: 301946

7 years ago[Hexagon] Add new packet iterator which will iterate through duplexes
Krzysztof Parzyszek [Tue, 2 May 2017 17:53:51 +0000 (17:53 +0000)]
[Hexagon] Add new packet iterator which will iterate through duplexes

Patch by Colin LeMahieu.

llvm-svn: 301945

7 years agoRevert "Remove "_NC" suffix and semantics from TLSDESC_LD{64,32}_LO12 and"
Zachary Turner [Tue, 2 May 2017 17:51:27 +0000 (17:51 +0000)]
Revert "Remove "_NC" suffix and semantics from TLSDESC_LD{64,32}_LO12 and"

This reverts commit c08155afc5d3230792da2ad30a046a8617735a73.

This is causing undefined symbol errors with some of the constants.

llvm-svn: 301944

7 years ago[Hexagon] Check for .cur def without use without using a map data structure
Krzysztof Parzyszek [Tue, 2 May 2017 17:51:14 +0000 (17:51 +0000)]
[Hexagon] Check for .cur def without use without using a map data structure

Patch by Colin LeMahieu.

llvm-svn: 301943

7 years agoBitcode: Simplify how we enumerate summaries in the index. NFCI.
Peter Collingbourne [Tue, 2 May 2017 17:48:39 +0000 (17:48 +0000)]
Bitcode: Simplify how we enumerate summaries in the index. NFCI.

Instead of defining a custom iterator class, just use a function with a
callback, which is much easier to understand and less error prone.

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

llvm-svn: 301942

7 years ago[lit] Try to exit more cleanly
Reid Kleckner [Tue, 2 May 2017 17:45:16 +0000 (17:45 +0000)]
[lit] Try to exit more cleanly

If all jobs complete successfully, use pool.close() instead of
pool.terminate() before waiting for the workers. Zach Turner reported
that he was getting "access denied" exceptions from pool.terminate().

Make the workers abort immediately without printing to stderr when they
are interrupted.

Finally, catch exceptions when attempting to remove our temporary
testing directory. On abnormal exit, there can often be open handles
that haven't been cleaned up yet.

llvm-svn: 301941

7 years agoMake DWARFDebugLine use StringRef for directory/file tables. NFC
Paul Robinson [Tue, 2 May 2017 17:37:32 +0000 (17:37 +0000)]
Make DWARFDebugLine use StringRef for directory/file tables. NFC

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

llvm-svn: 301940

7 years agoRemove "_NC" suffix and semantics from TLSDESC_LD{64,32}_LO12 and
Joel Jones [Tue, 2 May 2017 17:14:31 +0000 (17:14 +0000)]
Remove "_NC" suffix and semantics from TLSDESC_LD{64,32}_LO12 and
  TLSDESC_ADD_LO12 relocations
Rearrange ordering in AArch64.def to follow relocation encoding
Fix name:
  R_AARCH64_P32_LD64_GOT_LO12_NC => R_AARCH64_P32_LD32_GOT_LO12_NC
Add support for several "TLS", "TLSGD", and "TLSLD" relocations for
  ILP32
Fix return values from isNonILP32reloc
Add implementations for
  R_AARCH64_ADR_PREL_PG_HI21_NC, R_AARCH64_P32_LD32_GOT_LO12_NC,
  R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC,
  R_AARCH64_P32_TLSDESC_LD32_LO12, R_AARCH64_LD64_GOT_LO12_NC,
  *TLSLD_LDST128_DTPREL_LO12, *TLSLD_LDST128_DTPREL_LO12_NC,
  *TLSLE_LDST128_TPREL_LO12, *TLSLE_LDST128_TPREL_LO12_NC
Modify error messages to give name of equivalent relocation in the
  ABI not being used, along with better checking for non-existent
  requested relocations.
Added assembler support for "pg_hi21_nc"
Relocation definitions added without implementations:
  R_AARCH64_P32_TLSDESC_ADR_PREL21, R_AARCH64_P32_TLSGD_ADR_PREL21,
  R_AARCH64_P32_TLSGD_ADD_LO12_NC, R_AARCH64_P32_TLSLD_ADR_PREL21,
  R_AARCH64_P32_TLSLD_ADR_PAGE21, R_AARCH64_P32_TLSLD_ADD_LO12_NC,
  R_AARCH64_P32_TLSLD_LD_PREL19, R_AARCH64_P32_TLSDESC_LD_PREL19,
  R_AARCH64_P32_TLSGD_ADR_PAGE21, R_AARCH64_P32_TLS_DTPREL,
  R_AARCH64_P32_TLS_DTPMOD, R_AARCH64_P32_TLS_TPREL,
  R_AARCH64_P32_TLSDESC
Fix encoding:
  R_AARCH64_P32_TLSDESC_ADR_PAGE21

Reviewers: Peter Smith

Patch by: Joel Jones (jjones@cavium.com)

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

llvm-svn: 301939

7 years agoAMDGPU: Refactor AsmPrinter
Matt Arsenault [Tue, 2 May 2017 17:14:00 +0000 (17:14 +0000)]
AMDGPU: Refactor AsmPrinter

Avoid analyzing functions multiple times. This allows
asserting that each function is only analyzed once.

llvm-svn: 301938

7 years agoAMDGPU: Make intrinsics speculatable
Matt Arsenault [Tue, 2 May 2017 16:57:44 +0000 (16:57 +0000)]
AMDGPU: Make intrinsics speculatable

llvm-svn: 301937

7 years ago[PDB/CodeView] Read/write codeview inlinee line information.
Zachary Turner [Tue, 2 May 2017 16:56:09 +0000 (16:56 +0000)]
[PDB/CodeView] Read/write codeview inlinee line information.

Previously we wrote line information and file checksum
information, but we did not write information about inlinee
lines and functions.  This patch adds support for that.

llvm-svn: 301936

7 years agoRoll back r301831 to fix broken powerpc64le tests.
Sterling Augustine [Tue, 2 May 2017 16:43:39 +0000 (16:43 +0000)]
Roll back r301831 to fix broken powerpc64le tests.

http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/5941

llvm-svn: 301935

7 years agoCMake: Silence more stderr when running git.
Tim Northover [Tue, 2 May 2017 16:37:37 +0000 (16:37 +0000)]
CMake: Silence more stderr when running git.

It can confuse bots collecting errors.

llvm-svn: 301934

7 years agoAdd new test case for addcarry. NFC.
Amaury Sechet [Tue, 2 May 2017 16:07:32 +0000 (16:07 +0000)]
Add new test case for addcarry. NFC.

llvm-svn: 301932

7 years agoAvoid empty .eh_frame sections.
Rafael Espindola [Tue, 2 May 2017 15:45:31 +0000 (15:45 +0000)]
Avoid empty .eh_frame sections.

Strip on OpenBSD does not correctly handle an empty .eh_frame section
and produces broken binaries in that case. Currently lld creates such
an empty .eh_frame section, despite the fact that the OpenBSD crtend.o
explicitly inserts a terminator. The Linux LSB "standard":

https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html#EHFRAME

explicitly says that

    The .eh_frame section shall contain 1 or more Call Frame Information (CFI) records.

This diff includes a test that specifically tests the issue I'm seeing
on OpenBSD.

Patch by Mark Kettenis!

llvm-svn: 301931

7 years agoAMDGPU: Add AMDGPU_HS calling convention
Marek Olsak [Tue, 2 May 2017 15:41:10 +0000 (15:41 +0000)]
AMDGPU: Add AMDGPU_HS calling convention

Reviewers: arsenm, nhaehnle

Subscribers: mehdi_amini, kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 301930

7 years ago[InstCombine] don't use DeMorgan's Law on integer constants (2nd try)
Sanjay Patel [Tue, 2 May 2017 15:31:40 +0000 (15:31 +0000)]
[InstCombine] don't use DeMorgan's Law on integer constants (2nd try)

This was originally checked in here:
https://reviews.llvm.org/rL301923

And reverted here:
https://reviews.llvm.org/rL301924

Because there's a clang test that would fail after this. I fixed/removed the
offending CHECK lines in:
https://reviews.llvm.org/rL301928

So let's try this again. Original commit message:

This is the fold that causes the infinite loop in BoringSSL
(https://github.com/google/boringssl/blob/master/crypto/cipher/e_rc2.c)
when we fix instcombine demanded bits to prefer 'not' ops as in https://reviews.llvm.org/D32255.

There are 2 or 3 problems with dyn_castNotVal, and I don't think we can
reinstate https://reviews.llvm.org/D32255 until dyn_castNotVal is completely eliminated.

1. As shown here, it transforms 'not' into random xor. This transform is harmful to SCEV and codegen because 'not' can often be folded while random xor cannot.
2. It does not transform vector constants. This is actually a good thing, but if you don't believe the above argument, then we shouldn't have excluded vectors.
3. It tries to avoid transforming not(not(X)). That's nice, but it doesn't match the greedy nature of instcombine. If we DeMorganize a pattern that has an extra 'not' in it: ~(~(~X) & Y) --> (~X | ~Y)

  That's just another case of DeMorgan, so we should trust that we'll fold that pattern too: (~X | ~ Y) --> ~(X & Y)

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

llvm-svn: 301929

7 years ago[CodeGen] remove/fix checks that will fail when r301923 is recommitted
Sanjay Patel [Tue, 2 May 2017 15:20:18 +0000 (15:20 +0000)]
[CodeGen] remove/fix checks that will fail when r301923 is recommitted

Don't test the optimizer as part of front-end verification.

llvm-svn: 301928

7 years agotsan: allow fast large MemoryRangeSet on non-Windows Go
Dmitry Vyukov [Tue, 2 May 2017 15:15:45 +0000 (15:15 +0000)]
tsan: allow fast large MemoryRangeSet on non-Windows Go

The fast reset for large memory regions is not working
only on windows. So enable it for Go/linux/darwin/freebsd.

See https://github.com/golang/go/issues/20139
for background and motivation.

Based on idea by Josh Bleecher Snyder.

llvm-svn: 301927

7 years ago[compiler-rt] move tsan's Android __get_tls() to sanitizer_common
Kostya Kortchinsky [Tue, 2 May 2017 15:13:36 +0000 (15:13 +0000)]
[compiler-rt] move tsan's Android __get_tls() to sanitizer_common

Summary:
TSan's Android `__get_tls()` and `TLS_SLOT_TSAN` can be used by other sanitizers as well (see D32649), this change moves them to sanitizer_common.
I picked sanitizer_linux.h as their new home.
In the process, add the 32-bit versions for ARM, i386 & MIPS.

Can the address of `__get_tls()[TLS_SLOT_TSAN]` change in between the calls?
I am not sure if there is a need to repeat the construct as opposed to using a variable. So I left things as they were.

Testing on my side was restricted to a successful cross-compilation.

Reviewers: dvyukov, kubamracek

Reviewed By: dvyukov

Subscribers: aemerson, rengolin, srhines, dberris, arichardson, llvm-commits

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

llvm-svn: 301926

7 years ago[NFC] [IslAST] fix typo: "int the" -> "in the"
Siddharth Bhat [Tue, 2 May 2017 14:54:49 +0000 (14:54 +0000)]
[NFC] [IslAST] fix typo: "int the" -> "in the"

llvm-svn: 301925

7 years agorevert r301923 : [InstCombine] don't use DeMorgan's Law on integer constants
Sanjay Patel [Tue, 2 May 2017 14:48:23 +0000 (14:48 +0000)]
revert r301923 : [InstCombine] don't use DeMorgan's Law on integer constants

There's a clang test that is wrongly using -O1 and failing after this commit.

llvm-svn: 301924

7 years ago[InstCombine] don't use DeMorgan's Law on integer constants
Sanjay Patel [Tue, 2 May 2017 14:31:30 +0000 (14:31 +0000)]
[InstCombine] don't use DeMorgan's Law on integer constants

This is the fold that causes the infinite loop in BoringSSL
(https://github.com/google/boringssl/blob/master/crypto/cipher/e_rc2.c)
when we fix instcombine demanded bits to prefer 'not' ops as in D32255.

There are 2 or 3 problems with dyn_castNotVal, and I don't think we can
reinstate D32255 until dyn_castNotVal is completely eliminated.
1. As shown here, it transforms 'not' into random xor. This transform is
   harmful to SCEV and codegen because 'not' can often be folded while
   random xor cannot.
2. It does not transform vector constants. This is actually a good thing,
   but if you don't believe the above argument, then we shouldn't have
   excluded vectors.
3. It tries to avoid transforming not(not(X)). That's nice, but it doesn't
   match the greedy nature of instcombine. If we DeMorganize a pattern
   that has an extra 'not' in it:
   ~(~(~X) & Y) --> (~X | ~Y)

   That's just another case of DeMorgan, so we should trust that we'll fold
   that pattern too:
   (~X | ~ Y) --> ~(X & Y)

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

llvm-svn: 301923

7 years ago[DAGCombine] (uaddo X, (addcarry Y, 0, Carry)) -> (addcarry X, Y, Carry)
Amaury Sechet [Tue, 2 May 2017 14:15:48 +0000 (14:15 +0000)]
[DAGCombine] (uaddo X, (addcarry Y, 0, Carry)) -> (addcarry X, Y, Carry)

Summary: This is a common pattern that arise when legalizing large integers operations. Only do it when Y + 1 cannot overflow as this would change the carry behavior of uaddo .

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

llvm-svn: 301922

7 years agoAdd llvm::object::getELFSectionTypeName().
Rafael Espindola [Tue, 2 May 2017 14:04:52 +0000 (14:04 +0000)]
Add llvm::object::getELFSectionTypeName().

This is motivated by https://reviews.llvm.org/D32488 where I am trying
to add printing of the section type for incompatible sections to LLD
error messages. This patch allows us to use the same code in
llvm-readobj and LLD instead of duplicating the function inside LLD.

Patch by Alexander Richardson!

llvm-svn: 301921

7 years agoImprovements to TableGen/LangIntro.rst
Alex Bradbury [Tue, 2 May 2017 13:47:10 +0000 (13:47 +0000)]
Improvements to TableGen/LangIntro.rst

Document the 'code' data type, and that value{15-17} is different to
value{17-15}.

Patch by @chenwj (Wei-Ren Chen).

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

llvm-svn: 301920

7 years ago[DAGCombine] (add X, (addcarry Y, 0, Carry)) -> (addcarry X, Y, Carry)
Amaury Sechet [Tue, 2 May 2017 13:34:25 +0000 (13:34 +0000)]
[DAGCombine] (add X, (addcarry Y, 0, Carry)) -> (addcarry X, Y, Carry)

Summary: Common pattern when legalizing large integers operations. Similar to D32687, when the carry isn't used.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

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

llvm-svn: 301919

7 years agoAndroid.rules: set "ar" path correctly
Pavel Labath [Tue, 2 May 2017 13:14:45 +0000 (13:14 +0000)]
Android.rules: set "ar" path correctly

llvm-svn: 301918

7 years agoObjectFileELF: Fix symbol lookup in bss section
Pavel Labath [Tue, 2 May 2017 12:40:31 +0000 (12:40 +0000)]
ObjectFileELF: Fix symbol lookup in bss section

Summary:
If we have symbol information in a separate file, we need to be very
careful about presenting a unified section view of module to the rest of
the debugger. ObjectFileELF had code to handle that, but it was being
overly cautious -- the section->GetFileSize()!=0 meant that the
unification would fail for sections which do not occupy any space in the
object file (e.g., .bss). In my case, that manifested itself as not
being able to display the values of .bss variables properly as the
section associated with the variable did not have it's load address set
(because it was not present in the unified section list).

I test this by making sure the unified section list and the variables
refer to the same section.

Reviewers: eugene, zturner

Subscribers: tberghammer, lldb-commits, mgorny

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

llvm-svn: 301917

7 years agoRevert r301735 (and subsequent r301786).
Daniel Jasper [Tue, 2 May 2017 12:38:27 +0000 (12:38 +0000)]
Revert r301735 (and subsequent r301786).

It leads to clang crashing, e.g. on this short code fragment (added to
test/SemaCXX/warn-thread-safety-parsing.cpp):

  class SomeClass {
  public:
    void foo() {
      auto l = [this] { auto l = [] EXCLUSIVE_LOCKS_REQUIRED(mu_) {}; };
    }
    Mutex mu_;
  };

llvm-svn: 301916

7 years ago[X86][SSE] Add test for PR30264 (combining multiple constants inputs in a shuffle)
Simon Pilgrim [Tue, 2 May 2017 12:25:17 +0000 (12:25 +0000)]
[X86][SSE] Add test for PR30264 (combining multiple constants inputs in a shuffle)

llvm-svn: 301915

7 years ago[clang-move] Find template class forward declarations more precisely.
Haojian Wu [Tue, 2 May 2017 12:15:11 +0000 (12:15 +0000)]
[clang-move] Find template class forward declarations more precisely.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 301914

7 years ago[analyzer] Detect bad free of function pointers
Daniel Marjamaki [Tue, 2 May 2017 11:46:12 +0000 (11:46 +0000)]
[analyzer] Detect bad free of function pointers

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

llvm-svn: 301913

7 years ago[X86] Tidyup subvector insert/extract helpers. NFCI.
Simon Pilgrim [Tue, 2 May 2017 11:08:15 +0000 (11:08 +0000)]
[X86] Tidyup subvector insert/extract helpers. NFCI.

Use getConstantOperandVal where possible.

llvm-svn: 301912

7 years agoFix typo in comment. NFCI.
Simon Pilgrim [Tue, 2 May 2017 10:43:33 +0000 (10:43 +0000)]
Fix typo in comment. NFCI.

llvm-svn: 301911

7 years ago[SelectionDAG] Improve support for promotion of <1 x fX> floating point argument...
Simon Pilgrim [Tue, 2 May 2017 10:33:08 +0000 (10:33 +0000)]
[SelectionDAG] Improve support for promotion of <1 x fX> floating point argument types (PR31088)

PR31088 demonstrated that we were assuming that only integers require promotion from <1 x iX> types, when in fact float types may require it as well - in this case half floats.

This patch adds support for extension/truncation for both integer and float types.

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

llvm-svn: 301910

7 years agoRevert r301904 causing tsan test failure in x86_64-linux-autoconf
Pierre Gousseau [Tue, 2 May 2017 10:22:05 +0000 (10:22 +0000)]
Revert r301904 causing tsan test failure in x86_64-linux-autoconf

llvm-svn: 301909

7 years agoChange UniqueCStringMap to use ConstString as the key
Pavel Labath [Tue, 2 May 2017 10:17:30 +0000 (10:17 +0000)]
Change UniqueCStringMap to use ConstString as the key

Summary:
UniqueCStringMap "sorts" the entries for fast lookup, but really it only cares about uniqueness.  ConstString can be compared by pointer alone, rather than with strcmp, resulting in much faster comparisons.  Change the interface to take ConstString instead, and propagate use of the type to the callers where appropriate.

Reviewers: #lldb, clayborg

Reviewed By: clayborg

Subscribers: labath, jasonmolenda, lldb-commits

Differential Revision: https://reviews.llvm.org/D32316
Patch by Scott Smith <scott.smith@purestorage.com>.

llvm-svn: 301908

7 years ago[DAGCombiner] Improve MatchBswapHword logic (PR31357)
Simon Pilgrim [Tue, 2 May 2017 10:16:19 +0000 (10:16 +0000)]
[DAGCombiner] Improve MatchBswapHword logic (PR31357)

The existing code only looks at half of the tree when matching bswap + rol patterns ending in an OR tree (as opposed to a cascade).

Patch originally introduced by Jim Lewis.

Submitted on the behalf of Dinar Temirbulatov.

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

llvm-svn: 301907

7 years agoRemove leftover test expectation from rL301902.
Emilio Cobos Alvarez [Tue, 2 May 2017 09:57:30 +0000 (09:57 +0000)]
Remove leftover test expectation from rL301902.

llvm-svn: 301906

7 years ago[ARM] GlobalISel: Use TableGen instruction selector
Diana Picus [Tue, 2 May 2017 09:40:49 +0000 (09:40 +0000)]
[ARM] GlobalISel: Use TableGen instruction selector

Emit and use the TableGen instruction selector for ARM. At the moment,
this allows us to remove the hand-written code for selecting G_SDIV and
G_UDIV.

Future commits will focus on increasing the code coverage for it and
removing more dead code from the current instruction selector.

llvm-svn: 301905

7 years ago[asan] Add strndup/__strndup interceptors if targeting linux.
Pierre Gousseau [Tue, 2 May 2017 09:01:02 +0000 (09:01 +0000)]
[asan] Add strndup/__strndup interceptors if targeting linux.

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

llvm-svn: 301904

7 years agoRemove unused code related to CPlusPlusLanguage::FindEquivalentNames
Pavel Labath [Tue, 2 May 2017 09:00:52 +0000 (09:00 +0000)]
Remove unused code related to CPlusPlusLanguage::FindEquivalentNames

Summary: It is simply unused, and the header for it is private, so there should be no external dependencies.

Reviewers: #lldb, zturner

Reviewed By: zturner

Subscribers: zturner, tberghammer, jingham, lldb-commits

Differential Revision: https://reviews.llvm.org/D32503
Patch by Scott Smith <scott.smith@purestorage.com>.

llvm-svn: 301903

7 years ago[libclang] Revert rL301328 and add tests for the regressions introduced.
Emilio Cobos Alvarez [Tue, 2 May 2017 08:32:15 +0000 (08:32 +0000)]
[libclang] Revert rL301328 and add tests for the regressions introduced.

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

llvm-svn: 301902

7 years ago[APInt] Move APInt::getSplat out of line.
Craig Topper [Tue, 2 May 2017 06:32:27 +0000 (06:32 +0000)]
[APInt] Move APInt::getSplat out of line.

I think this method is probably too complex to be inlined.

llvm-svn: 301901

7 years ago[APInt] Move the setBit and clearBit methods inline.
Craig Topper [Tue, 2 May 2017 05:49:40 +0000 (05:49 +0000)]
[APInt] Move the setBit and clearBit methods inline.

This makes setBit/clearBit more consistent with setBits which is already inlined.

llvm-svn: 301900

7 years agoRefactor callsite cost computation into a helper function /NFC
Xinliang David Li [Tue, 2 May 2017 05:38:41 +0000 (05:38 +0000)]
Refactor callsite cost computation into a helper function /NFC

Makes code more readable. The function will also be used
by the partial inlining's cost analysis.

llvm-svn: 301899

7 years agoclang/test/Modules/diag-flags.cpp: Appease targeting *-win32 with explicit triple...
NAKAMURA Takumi [Tue, 2 May 2017 05:12:55 +0000 (05:12 +0000)]
clang/test/Modules/diag-flags.cpp: Appease targeting *-win32 with explicit triple. Fixes r301846.

MicrosoftRecordLayoutBuilder doesn't have ability of -Wpadded.

FIXME: Would other diag be available here?
llvm-svn: 301898

7 years agoELF: Set symbol binding to STB_GLOBAL when undefining symbols during LTO.
Peter Collingbourne [Tue, 2 May 2017 05:07:41 +0000 (05:07 +0000)]
ELF: Set symbol binding to STB_GLOBAL when undefining symbols during LTO.

If there is a bug in the LTO implementation that causes it to fail to provide
an expected symbol definition, the linker should report an undefined symbol
error. Unfortunately, we were failing to do so if the symbol definition
was weak, as the undefine() function was turning the definition into a weak
undefined symbol, which resolves to zero if the symbol remains undefined. This
patch causes us to set the binding to STB_GLOBAL when we undefine a symbol.

I can't see a good way to test this. The behaviour should only be observable
if there is a bug in the LTO implementation.

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

llvm-svn: 301897

7 years agoUpdate commetns.
Rui Ueyama [Tue, 2 May 2017 02:58:04 +0000 (02:58 +0000)]
Update commetns.

llvm-svn: 301896

7 years agoMake getArchiveMembers function a non-member function.
Rui Ueyama [Tue, 2 May 2017 02:57:45 +0000 (02:57 +0000)]
Make getArchiveMembers function a non-member function.

It didn't have to be a member function of Driver. This patch makes
that function a file-scoped non-member function.

llvm-svn: 301895

7 years ago[PartialInlining] Hook up inline cost analysis
Xinliang David Li [Tue, 2 May 2017 02:44:14 +0000 (02:44 +0000)]
[PartialInlining] Hook up inline cost analysis

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

llvm-svn: 301894