platform/upstream/llvm.git
4 years agoget rid of the NDEBUG usage in RecoveryExpr, NFC.
Haojian Wu [Tue, 12 May 2020 08:16:30 +0000 (10:16 +0200)]
get rid of the NDEBUG usage in RecoveryExpr, NFC.

use the llvm::all_of, per dblaikie's suggestion.

4 years ago[NFC][AArch64] Update tests
Sam Parker [Tue, 12 May 2020 07:47:28 +0000 (08:47 +0100)]
[NFC][AArch64] Update tests

Add cost model tests for extending loads.

4 years agoFix typos encountered while working on pass pipeline for O1.
Eric Christopher [Tue, 12 May 2020 07:44:05 +0000 (00:44 -0700)]
Fix typos encountered while working on pass pipeline for O1.

4 years agoRevert "[NFC][DwarfDebug] Prefer explicit to auto type deduction"
Djordje Todorovic [Tue, 12 May 2020 07:40:47 +0000 (09:40 +0200)]
Revert "[NFC][DwarfDebug] Prefer explicit to auto type deduction"

This wasn't proposed by the LLVM Style Guide.
Please see https://reviews.llvm.org/D79624.

This reverts commit rG2552dc5317e0.

4 years agoRevert "[NFC][DwarfDebug] Avoid default capturing when using lambdas"
Djordje Todorovic [Tue, 12 May 2020 07:04:57 +0000 (09:04 +0200)]
Revert "[NFC][DwarfDebug] Avoid default capturing when using lambdas"

Reverting this because we found it isn't that useful.
Please see https://reviews.llvm.org/D79616.

This reverts commit rG45e5a32a8bd3.

4 years ago[SystemZ] Improve foldMemoryOperandImpl: vec->FP conversions
Jonas Paulsson [Wed, 18 Mar 2020 17:11:56 +0000 (18:11 +0100)]
[SystemZ] Improve foldMemoryOperandImpl: vec->FP conversions

Use FP-mem instructions when folding reloads into single lane (W..) vector
instructions.

Only do this when all other operands of the instruction have already been
allocated to an FP (F0-F15) register.

Review: Ulrich Weigand

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

4 years ago[CodeGen] Fix incorrect uses of getVectorNumElements()
David Sherwood [Tue, 5 May 2020 08:58:24 +0000 (09:58 +0100)]
[CodeGen] Fix incorrect uses of getVectorNumElements()

I have fixed up some places in SelectionDAG::getNode() where we
used to assert that the number of vector elements for two types
are the same. I have changed such cases to assert that the
element counts are the same instead. I've added new tests that
exercise the code paths for all the truncations. All the extend
operations are covered by this existing test:

  CodeGen/AArch64/sve-sext-zext.ll

For the ISD::SETCC case I fixed this code path is exercised by
these existing tests:

  CodeGen/AArch64/sve-fcmp.ll
  CodeGen/AArch64/sve-intrinsics-int-compares-with-imm.ll

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

4 years ago[LLDB] Disable TestBasicEntryValues.py for arm
Muhammad Omair Javaid [Tue, 12 May 2020 06:32:54 +0000 (11:32 +0500)]
[LLDB] Disable TestBasicEntryValues.py for arm

TestBasicEntryValues.py fails on arm 32 bit. Currently running on silent master here:
http://lab.llvm.org:8014/builders/lldb-arm-ubuntu/

4 years ago[clangd] Have suppression comments take precedence over warning-as-error
Nathan Ridge [Sun, 10 May 2020 19:08:18 +0000 (15:08 -0400)]
[clangd] Have suppression comments take precedence over warning-as-error

Summary: This matches the clang-tidy behaviour.

Fixes https://github.com/clangd/clangd/issues/375

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years agoTemporarily Revert "[mlir][shape] Tidy up shape.shape_of" as it's breaking a few...
Eric Christopher [Tue, 12 May 2020 06:03:41 +0000 (23:03 -0700)]
Temporarily Revert "[mlir][shape] Tidy up shape.shape_of" as it's breaking a few tests.

This reverts commit b6045448869a63dc7da3a4c87c124e85101220d7.

Followed up offline with a testcase.

4 years ago[RISCV] Make CanLowerReturn protected for downstream maintenance
Jim Lin [Tue, 12 May 2020 05:48:30 +0000 (13:48 +0800)]
[RISCV] Make CanLowerReturn protected for downstream maintenance

Summary: For the downstream RISCV maintenance, it would be easier to override and reuse CanLowerReturn for customizing.

Reviewers: asb, lenary, luismarques

Reviewed By: lenary

Subscribers: hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, s.egerton, pzheng, sameer.abuasal, apazos, evandro, llvm-commits

Tags: #llvm

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

4 years ago[PowerPC] Add fma/fsqrt/fmax strict-fp intrinsics
Qiu Chaofan [Tue, 12 May 2020 05:40:54 +0000 (13:40 +0800)]
[PowerPC] Add fma/fsqrt/fmax strict-fp intrinsics

This patch adds strict-fp intrinsics support for fma, fsqrt, fmaxnum and
fminnum on PowerPC.

Reviewed By: hfinkel

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

4 years agoRevert "[libcxx] shared_ptr changes from library fundamentals (P0414R2)."
zoecarver [Tue, 12 May 2020 05:42:49 +0000 (22:42 -0700)]
Revert "[libcxx] shared_ptr changes from library fundamentals (P0414R2)."

This reverts commit e8c13c182a562f45287d6b8da612264d09027087.

4 years ago[gcov] Fix big-endian problems
Fangrui Song [Tue, 12 May 2020 05:30:49 +0000 (22:30 -0700)]
[gcov] Fix big-endian problems

In a big-endian .gcda file, the first four bytes are "gcda" instead of "adcg".
All 32-bit values are in big-endian.

With this change, libclang_rt.profile can hopefully produce gcov
compatible output.

4 years agoRevert part of D49132 "[gcov] Fix gcov profiling on big-endian machines"
Fangrui Song [Tue, 12 May 2020 05:08:07 +0000 (22:08 -0700)]
Revert part of D49132 "[gcov] Fix gcov profiling on big-endian machines"

D49132 is partially correct. For 64-bit values, the lower 32-bit part comes
before the higher 32-bit part (in a little-endian manner).

For 32-bit values, libgcov reads/writes 32-bit values in native endianness.

4 years agoPartially revert "[CMake] Fix building with -DBUILD_SHARED_LIBS=ON on mingw"
Martin Storsjö [Tue, 12 May 2020 05:20:34 +0000 (08:20 +0300)]
Partially revert "[CMake] Fix building with -DBUILD_SHARED_LIBS=ON on mingw"

This reverts parts of commit 609ef948387ba40e3693c2bd693d82ca34dcdc02,
as it caused build failures on windows if LLVM_BUILD_EXAMPLES was
enabled, due to Bye being added as a dependency of the lit tests.

4 years ago[DWARF5]: Added support for dumping strx forms in llvm-dwarfdump
Sourabh Singh Tomar [Mon, 27 Apr 2020 16:16:11 +0000 (21:46 +0530)]
[DWARF5]: Added support for dumping strx forms in llvm-dwarfdump

This patch adds support for dumping DW_MACRO_define_strx,
DW_MACRO_undef_strx in llvm-dwarfdump. These forms are currently
supported only in debug_macro section.

Reviewed By: ikudrin, dblaikie

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

4 years ago[gcov] Emit GCOV_TAG_OBJECT_SUMMARY/GCOV_TAG_PROGRAM_SUMMARY correctly and fix llvm...
Fangrui Song [Tue, 12 May 2020 01:43:15 +0000 (18:43 -0700)]
[gcov] Emit GCOV_TAG_OBJECT_SUMMARY/GCOV_TAG_PROGRAM_SUMMARY correctly and fix llvm-cov's decoding of runcount

gcov 9 (r264462) started to use GCOV_TAG_OBJECT_SUMMARY. Before,
GCOV_TAG_PROGRAM_SUMMARY was used.
libclang_rt.profile should emit just one tag according to the version.

Another bug introduced by rL194499 is that the wrong runcount field was
selected.

Fix the two bugs so that gcov can correctly decode "Runs:" from
libclang_rt.profile produced .gcda files, and llvm-cov gcov can
correctly decode "Runs:" from libgcov produced .gcda files.

4 years ago[x86/SLH][NFC] Add a test to produce a failed generation.
Wang, Pengfei [Tue, 12 May 2020 03:43:20 +0000 (11:43 +0800)]
[x86/SLH][NFC] Add a test to produce a failed generation.

4 years ago[mlir] [VectorOps] Replace zero-scalar + splat into direct zero vector constant
aartbik [Tue, 12 May 2020 01:22:59 +0000 (18:22 -0700)]
[mlir] [VectorOps] Replace zero-scalar + splat into direct zero vector constant

Summary:
The scalar zero + splat yields more intermediate code than the direct
dense zero constant, and ultimately is lowered to exactly the same
LLVM IR operations, so no point wasting the intermediate code.

Reviewers: nicolasvasilache, andydavis1, reidtatge

Reviewed By: nicolasvasilache

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

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

4 years agoQuote error string from qLaunchSuccess
Jason Molenda [Tue, 12 May 2020 03:01:54 +0000 (20:01 -0700)]
Quote error string from qLaunchSuccess

If the error message from qLaunchSucess included a gdb RSP
metacharacter, it could crash lldb.  Apply the binary
escaping to the string before sending it to lldb; lldb
promiscuously applies the binary escaping protocol on
packets it receives.

Also fix a small bug in cstring_to_asciihex_string where
a high bit character (eg utf-8 chars) would not be
quoted correctly due to signed char fun.

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

rdar://problem/62873581

4 years agoFix a release+noasserts werror for unused variable.
Eric Christopher [Tue, 12 May 2020 03:02:54 +0000 (20:02 -0700)]
Fix a release+noasserts werror for unused variable.

4 years agoTemporarily Revert "[lld-macho] Re-add dylink-lazy test" as it
Eric Christopher [Tue, 12 May 2020 02:46:06 +0000 (19:46 -0700)]
Temporarily Revert "[lld-macho] Re-add dylink-lazy test" as it
appears to be still failing.

This reverts commit 723c46e645dbe23942c926d2cb800ce020df6b8b.

4 years ago[libcxx] shared_ptr changes from library fundamentals (P0414R2).
zoecarver [Tue, 12 May 2020 01:42:50 +0000 (18:42 -0700)]
[libcxx] shared_ptr changes from library fundamentals (P0414R2).

Implements P0414R2:
  * Adds support for array types in std::shared_ptr.
  * Adds reinterpret_pointer_cast for shared_ptr.

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

4 years ago[FileCheck] Make invalid prefix diagnostics more precise
Joel E. Denny [Mon, 11 May 2020 13:57:37 +0000 (09:57 -0400)]
[FileCheck] Make invalid prefix diagnostics more precise

This will prove especially helpful after D79276, which introduces
comment prefixes.  Specifically, identifying whether there's a
uniqueness violation will be helpful as prefixes will be required to
be unique across both check prefixes and comment prefixes.

Also, remove a related comment about `cl::list` that no longer seems
relevant now that FileCheck is also a library.

Reviewed By: jhenderson, thopre

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

4 years ago[AMDGPU][GlobalISel] Revise handling of wide loads in RegBankSelect
Austin Kerbow [Tue, 12 May 2020 00:24:03 +0000 (17:24 -0700)]
[AMDGPU][GlobalISel] Revise handling of wide loads in RegBankSelect

When splitting loads in RegBankSelect G_EXTRACT_VECTOR_ELT were being added
which could not be selected. Since invoking the legalizer will generate
instructions that split and combine wide loads, we can remove the redundant
repair instructions which are added by RegBankSelect.

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

4 years ago[gn build] Use relative paths in generated lit.site.cfg.py files for llvm and clang.
Nico Weber [Tue, 12 May 2020 00:57:46 +0000 (20:57 -0400)]
[gn build] Use relative paths in generated lit.site.cfg.py files for llvm and clang.

This ports a16ba6fea2e554f to the GN build.

No intended behavior change.

4 years ago[Inlining] Make shouldBeDeferred static (NFC)
Kazu Hirata [Mon, 11 May 2020 21:04:10 +0000 (14:04 -0700)]
[Inlining] Make shouldBeDeferred static (NFC)

Summary:
This patch makes shouldBeDeferred static because it is called only
from shouldInline in the same .cpp file.

Reviewers: davidxl, mtrofin

Reviewed By: mtrofin

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[SelectionDAG] Don't promote the alignment of allocas beyond the stack alignment.
Eli Friedman [Wed, 6 May 2020 19:06:29 +0000 (12:06 -0700)]
[SelectionDAG] Don't promote the alignment of allocas beyond the stack alignment.

allocas in LLVM IR have a specified alignment. When that alignment is
specified, the alloca has at least that alignment at runtime.

If the specified type of the alloca has a higher preferred alignment,
SelectionDAG currently ignores that specified alignment, and increases
the alignment. It does this even if it would trigger stack realignment.
I don't think this makes sense, so this patch changes that.

I was looking into this for SVE in particular: for SVE, overaligning
vscale'ed types is extra expensive because it requires realigning the
stack multiple times, or using dynamic allocation. (This currently isn't
implemented.)

I updated the expected assembly for a couple tests; in particular, for
arg-copy-elide.ll, the optimization in question does not increase the
alignment the way SelectionDAG normally would. For the rest, I just
increased the specified alignment on the allocas to match what
SelectionDAG was inferring.

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

4 years ago[AMDGPU] Reserving VGPR for future SGPR Spill
Saiyedul Islam [Fri, 10 Apr 2020 07:55:11 +0000 (07:55 +0000)]
[AMDGPU] Reserving VGPR for future SGPR Spill

Summary: One VGPR register is allocated to handle a future spill of SGPR if "--amdgpu-reserve-vgpr-for-sgpr-spill" option is used

Reviewers: arsenm, rampitec, msearles, cdevadas

Reviewed By: arsenm

Subscribers: madhur13490, qcolombet, kerbowa, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #amdgpu, #llvm

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

4 years ago[AArch64][SVE] Add patterns for VSELECT of immediates.
Eli Friedman [Sat, 2 May 2020 03:58:49 +0000 (20:58 -0700)]
[AArch64][SVE] Add patterns for VSELECT of immediates.

This covers forms involving "CPY (immediate, zeroing)".

This doesn't handle the case where the operands are reversed, and the
condition is freely invertible.  Not sure how to handle that.  Maybe a
DAGCombine.

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

4 years ago[MLIR] Fix several misc issues in in Toy tutorial
Rahul Joshi [Mon, 11 May 2020 23:53:16 +0000 (16:53 -0700)]
[MLIR] Fix several misc issues in in Toy tutorial

Summary:
- Fix comments in several places
- Eliminate extra ' in AST dump and adjust tests accordingly

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

4 years ago[AMDGPU] Allow spilling FP to memory
Austin Kerbow [Thu, 7 May 2020 21:56:37 +0000 (14:56 -0700)]
[AMDGPU] Allow spilling FP to memory

If there are no available lanes in a reserved VGPR, no free SGPR, and no unused CSR
VGPR when trying to save the FP it needs to be spilled to memory as a last
resort. This can be done in the prolog/epilog if we manually add the spill
and manage exec.

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

4 years agoRevert "[FileCheck] Make invalid prefix diagnostics more precise"
Joel E. Denny [Mon, 11 May 2020 23:40:15 +0000 (19:40 -0400)]
Revert "[FileCheck] Make invalid prefix diagnostics more precise"

This reverts commit a78e13745d4ee4a42e41ebbe698159f651515fc5 to try to
fix a bot:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23489

4 years agoRevert "[FileCheck] Support comment directives"
Joel E. Denny [Mon, 11 May 2020 23:39:49 +0000 (19:39 -0400)]
Revert "[FileCheck] Support comment directives"

This reverts commit 9a9a5f9893c8db05cebc8818eb8485bff61f7c74 to try to
fix a bot:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23489

4 years ago[gn build] Make paths in generated llvm-lit relative.
Nico Weber [Mon, 11 May 2020 23:31:26 +0000 (19:31 -0400)]
[gn build] Make paths in generated llvm-lit relative.

This ports d4638cba and e613f0ee to the GN build.
Since paths in the generated lit.site.cfg.py files still contain
absolute paths in the GN build, this isn't very useful yet.

No intended behavior change.

4 years ago[GlobalISel] Remove debug locations when emitting G_FCONSTANT.
Davide Italiano [Mon, 11 May 2020 23:21:26 +0000 (16:21 -0700)]
[GlobalISel] Remove debug locations when emitting G_FCONSTANT.

<rdar://problem/62991543>

4 years ago[gn build] Make config_map computation in llvm-lit more table-driven.
Nico Weber [Mon, 11 May 2020 23:21:31 +0000 (19:21 -0400)]
[gn build] Make config_map computation in llvm-lit more table-driven.

No behavior change.

4 years agollvm-lit.in: Use a raw string for LLVM_SOURCE_DIR
Nico Weber [Mon, 11 May 2020 23:04:28 +0000 (19:04 -0400)]
llvm-lit.in: Use a raw string for LLVM_SOURCE_DIR

In case the path from cmake build dir contains a backslash
escape on Windows (which uses \ as path separator).

While here, consistently use one form of quotes in this file.

No intended behavior change.

4 years ago[YAMLTraits] Add trait for char
Jonas Devlieghere [Mon, 11 May 2020 21:41:38 +0000 (14:41 -0700)]
[YAMLTraits] Add trait for char

Add a YAML trait for char.

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

4 years agoFix auto -> auto * clang tidy.
Eric Christopher [Mon, 11 May 2020 22:50:22 +0000 (15:50 -0700)]
Fix auto -> auto * clang tidy.

4 years ago[hwasan] Fix allocator alignment.
Evgenii Stepanov [Fri, 8 May 2020 23:32:33 +0000 (16:32 -0700)]
[hwasan] Fix allocator alignment.

Summary:
Fix hwasan allocator not respecting the requested alignment when it is
higher than a page, but still within primary (i.e. [2048, 65536]).

Reviewers: pcc, hctim, cryptoad

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[mlir][StandardToSPIRV] Add support for lowering index_cast to SPIR-V.
Hanhan Wang [Mon, 11 May 2020 22:41:12 +0000 (15:41 -0700)]
[mlir][StandardToSPIRV] Add support for lowering index_cast to SPIR-V.

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

4 years agoAdd vendor macro to "lld"
stevewan [Mon, 11 May 2020 22:33:55 +0000 (18:33 -0400)]
Add vendor macro to "lld"

Summary:
Add the vendor macro to "lld" for extended version output support,
such that it's able to print additional version info. This is
consistent with the Clang and LLVM version printer, and the
additional version message can be provided via PACKAGE_VENDOR.

Reviewers: hubert.reinterpretcast, kbarton, cebowleratibm, rzurob, ruiu

Reviewed By: hubert.reinterpretcast

Subscribers: emaste, mgorny, llvm-commits

Tags: #llvm

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

4 years agoFix a few clang-tidy warnings about auto * and const auto.
Eric Christopher [Mon, 11 May 2020 22:32:18 +0000 (15:32 -0700)]
Fix a few clang-tidy warnings about auto * and const auto.

4 years ago[AMDGPU] Fix promote alloca which is already vector
Stanislav Mekhanoshin [Mon, 11 May 2020 19:09:16 +0000 (12:09 -0700)]
[AMDGPU] Fix promote alloca which is already vector

Just do not touch loads and stores which are already vector.
Previously pass was just unable to see these loads and stores
because these were hidden bitcasts.

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

4 years ago[mlir] Revisit std.subview handling of static information.
Nicolas Vasilache [Mon, 11 May 2020 21:38:20 +0000 (17:38 -0400)]
[mlir] Revisit std.subview handling of static information.

Summary:
The main objective of this revision is to change the way static information is represented, propagated and canonicalized in the SubViewOp.

In the current implementation the issue is that canonicalization may strictly lose information because static offsets are combined in irrecoverable ways into the result type, in order to fit the strided memref representation.

The core semantics of the op do not change but the parser and printer do: the op always requires `rank` offsets, sizes and strides. These quantities can now be either SSA values or static integer attributes.

The result type is automatically deduced from the static information and more powerful canonicalizations (as powerful as the representation with sentinel `?` values allows). Previously static information was inferred on a best-effort basis from looking at the source and destination type.

Relevant tests are rewritten to use the idiomatic `offset: x, strides : [...]`-form. Bugs are corrected along the way that were not trivially visible in flattened strided memref form.

It is an open question, and a longer discussion, whether a better result type representation would be a nicer alternative. For now, the subview op carries the required semantic.

Reviewers: ftynse, mravishankar, antiagainst, rriddle!, andydavis1, timshen, asaadaldien, stellaraccident

Reviewed By: mravishankar

Subscribers: aartbik, bondhugula, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, bader, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Vector] NFC - Rename vector.strided_slice into vector.extract_strided_slice
Reid Tatge [Mon, 11 May 2020 18:59:14 +0000 (11:59 -0700)]
[mlir][Vector] NFC - Rename vector.strided_slice into vector.extract_strided_slice

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

4 years agoRISCVAttributeParser.h - remove unnecessary ScopedPrinter.h include. NFC.
Simon Pilgrim [Sun, 10 May 2020 18:48:29 +0000 (19:48 +0100)]
RISCVAttributeParser.h - remove unnecessary ScopedPrinter.h include. NFC.

All uses of ScopedPrinter are in terms of ELFAttributeParser which are handled by ELFAttributeParser.h

4 years ago[X86] Add inline assembly load hardening mitigation for Load Value Injection (LVI)
Craig Topper [Mon, 11 May 2020 20:28:41 +0000 (13:28 -0700)]
[X86] Add inline assembly load hardening mitigation for Load Value Injection (LVI)

Added code to X86AsmParser::emitInstruction() to add an LFENCE after each instruction that may load, and emit a warning if it encounters an instruction that may be vulnerable, but cannot be automatically mitigated.

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

4 years ago[CMake] Fix building with -DBUILD_SHARED_LIBS=ON on mingw
Martin Storsjö [Mon, 11 May 2020 20:41:08 +0000 (23:41 +0300)]
[CMake] Fix building with -DBUILD_SHARED_LIBS=ON on mingw

Set the right target name in clang/examples/Attribute.

Add a missing dependency in the TableGen GlobalISel sublibrary.

Skip building the Bye pass plugin example on windows; plugins
that should have undefined symbols that are found in the host
process aren't supported on windows - this matches what was done
for a unit test in bc8e44218810c0db6328b9809c959ceb7d43e3f5.

4 years ago[mlir][Linalg] Introduce a helper function for staged pattern application
Nicolas Vasilache [Mon, 11 May 2020 20:05:39 +0000 (16:05 -0400)]
[mlir][Linalg] Introduce a helper function for staged pattern application

Summary:
This revision introduces a helper function to allow applying rewrite patterns, interleaved with more global transformations, in a staged fashion:
1. the first stage consists of an OwningRewritePatternList. The RewritePattern in this list are applied once and in order.
2. the second stage consists of a single OwningRewritePattern that is applied greedily until convergence.
3. the third stage consists of applying a lambda, generally used for non-local transformation effects.

This allows creating custom fused transformations where patterns can be ordered and applied at a finer granularity than a sequence of traditional compiler passes.

A test that exercises these behaviors is added.

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

4 years agoUpdate lldb for rG10658691951f to avoid Werror messages around
Eric Christopher [Mon, 11 May 2020 20:44:12 +0000 (13:44 -0700)]
Update lldb for rG10658691951f to avoid Werror messages around
new unhandled matrix types.

4 years ago[clang][SLH] Add __has_feature(speculative_load_hardening)
Zola Bridges [Mon, 11 May 2020 18:27:29 +0000 (11:27 -0700)]
[clang][SLH] Add __has_feature(speculative_load_hardening)

SLH doesn't support asm goto and is unlikely to ever support it. Users of asm
goto need a way to choose whether to use asm goto or fallback to an SLH
compatible code path when SLH is enabled. This feature flag will give users
this ability.

Tested via unit test

Reviewed By: mattdr

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

4 years ago[CGP] remove duplicate function for finding a splat shuffle; NFC
Sanjay Patel [Mon, 11 May 2020 20:34:19 +0000 (16:34 -0400)]
[CGP] remove duplicate function for finding a splat shuffle; NFC

4 years ago[Attributor][FIX] Disallow function signature rewrite for casted calls
Johannes Doerfert [Mon, 11 May 2020 20:22:14 +0000 (15:22 -0500)]
[Attributor][FIX] Disallow function signature rewrite for casted calls

We will now ensure ensure the return type of called function is the type
of all call sites we are going to rewrite. This avoids a problem
partially fixed by D79680. The part that was not covered is a use of
this "weird" casted call site (see `@func3` in `misc_crash.ll`).

misc_crash.ll checks are auto-generated now.

4 years ago[Attributor] Make AAIsDead dependences optional to prevent top state
Johannes Doerfert [Mon, 11 May 2020 17:22:41 +0000 (12:22 -0500)]
[Attributor] Make AAIsDead dependences optional to prevent top state

We should never give up on AAIsDead as it guards other AAs from
unreachable code (in which SSA properties are meaningless). We did
however use required dependences on some queries in AAIsDead which
caused us to invalidate AAIsDead if the queried AA got invalidated.
We now use optional dependences instead. The bug that exposed this is
added to the liveness.ll test and other test changes show the impact.

Bug report by @sdmitriev.

4 years ago[Attributor] Force update of "newly live" abstract attributes
Johannes Doerfert [Mon, 11 May 2020 17:20:27 +0000 (12:20 -0500)]
[Attributor] Force update of "newly live" abstract attributes

During an update of AAIsDead, new instructions become live. If we query
information from them, the result is often just the initial state, e.g.,
for call site `noreturn` and `nounwind`. We will now trigger an update
for cached attributes during the AAIsDead update, though other AAs might
later use the same API.

4 years ago[flang] Fix bug with IMPORT of USE of USE
Tim Keith [Mon, 11 May 2020 20:28:05 +0000 (13:28 -0700)]
[flang] Fix bug with IMPORT of USE of USE

When a module contained an import of a use-association of a
use-association, we weren't recognizing that the symbols was needed.
The fix is the follow all of the use-associations using `GetUltimate()`.

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

4 years ago[gn build] Port e97a3e5d9d4
LLVM GN Syncbot [Mon, 11 May 2020 20:09:12 +0000 (20:09 +0000)]
[gn build] Port e97a3e5d9d4

4 years ago[X86] Add Support for Load Hardening to Mitigate Load Value Injection (LVI)
Scott Constable [Mon, 11 May 2020 18:30:55 +0000 (11:30 -0700)]
[X86] Add Support for Load Hardening to Mitigate Load Value Injection (LVI)

After finding all such gadgets in a given function, the pass minimally inserts
LFENCE instructions in such a manner that the following property is satisfied:
for all SOURCE+SINK pairs, all paths in the CFG from SOURCE to SINK contain at
least one LFENCE instruction. The algorithm that implements this minimal
insertion is influenced by an academic paper that minimally inserts memory
fences for high-performance concurrent programs:

http://www.cs.ucr.edu/~lesani/companion/oopsla15/OOPSLA15.pdf

The algorithm implemented in this pass is as follows:

1. Build a condensed CFG (i.e., a GadgetGraph) consisting only of the following components:
  -SOURCE instructions (also includes function arguments)
  -SINK instructions
  -Basic block entry points
  -Basic block terminators
  -LFENCE instructions
2. Analyze the GadgetGraph to determine which SOURCE+SINK pairs (i.e., gadgets) are already mitigated by existing LFENCEs. If all gadgets have been mitigated, go to step 6.
3. Use a heuristic or plugin to approximate minimal LFENCE insertion.
4. Insert one LFENCE along each CFG edge that was cut in step 3.
5. Go to step 2.
6. If any LFENCEs were inserted, return true from runOnFunction() to tell LLVM that the function was modified.

By default, the heuristic used in Step 3 is a greedy heuristic that avoids
inserting LFENCEs into loops unless absolutely necessary. There is also a
CLI option to load a plugin that can provide even better optimization,
inserting fewer fences, while still mitigating all of the LVI gadgets.
The plugin can be found here: https://github.com/intel/lvi-llvm-optimization-plugin,
and a description of the pass's behavior with the plugin can be found here:
https://software.intel.com/security-software-guidance/insights/optimized-mitigation-approach-load-value-injection.

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

4 years ago[X86] Add a Pass that builds a Condensed CFG for Load Value Injection (LVI) Gadgets
Scott Constable [Mon, 11 May 2020 17:25:35 +0000 (10:25 -0700)]
[X86] Add a Pass that builds a Condensed CFG for Load Value Injection (LVI) Gadgets

Adds a new data structure, ImmutableGraph, and uses RDF to find LVI gadgets and add them to a MachineGadgetGraph.

More specifically, a new X86 machine pass finds Load Value Injection (LVI) gadgets consisting of a load from memory (i.e., SOURCE), and any operation that may transmit the value loaded from memory over a covert channel, or use the value loaded from memory to determine a branch/call target (i.e., SINK).

Also adds a new target feature to X86: +lvi-load-hardening

The feature can be added via the clang CLI using -mlvi-hardening.

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

4 years agoMove PowerPC specific test under PowerPC directive to fix build break
jasonliu [Mon, 11 May 2020 20:03:37 +0000 (20:03 +0000)]
Move PowerPC specific test under PowerPC directive to fix build break

Fix build break in x86 platform which introduced by
https://reviews.llvm.org/D79127

4 years agoRun Coverage pass before other *San passes under new pass manager
Arthur Eubanks [Mon, 11 May 2020 01:06:55 +0000 (18:06 -0700)]
Run Coverage pass before other *San passes under new pass manager

Summary:
This fixes compiler-rt/test/msan/coverage-levels.cpp under the new pass manager (final check-msan test!).
Under the old pass manager, the coverage pass would run before the MSan pass. The opposite happened under the new pass manager. The MSan pass adds extra basic blocks, changing the number of coverage callbacks.

Reviewers: vitalybuka, leonardchan

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[mlir][shape] Tidy up shape.shape_of
Sean Silva [Sun, 10 May 2020 02:17:41 +0000 (19:17 -0700)]
[mlir][shape] Tidy up shape.shape_of

Summary:
- Mark it NoSideEffect
- Add custom parser/printer

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

4 years ago[mlir][Value] Add v.getDefiningOp<OpTy>()
Sean Silva [Sun, 10 May 2020 00:52:35 +0000 (17:52 -0700)]
[mlir][Value] Add v.getDefiningOp<OpTy>()

Summary:
This makes a common pattern of
`dyn_cast_or_null<OpTy>(v.getDefiningOp())` more concise.

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

4 years ago[XCOFF][AIX] Emit correct alignment for csect
jasonliu [Mon, 11 May 2020 18:43:07 +0000 (18:43 +0000)]
[XCOFF][AIX] Emit correct alignment for csect

Summary:
This patch tries to emit the correct alignment result for both
object file generation path and assembly path.

Reviewed by: hubert.reinterpretcast, DiggerLin, daltenty

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

4 years ago[lld-macho] Re-add dylink-lazy test
Jez Ng [Sun, 10 May 2020 21:15:42 +0000 (14:15 -0700)]
[lld-macho] Re-add dylink-lazy test

The initial attempt didn't work on Windows; apparently Powershell has a
different syntax for running commands sequentially and concatenating
their outputs. So I've created two temporary files instead.

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

4 years agoFP LangOpts should not be dependent on CGOpt
Melanie Blower [Mon, 11 May 2020 19:29:52 +0000 (12:29 -0700)]
FP LangOpts should not be dependent on CGOpt
This bug was observed by Apple since their compiler processes LangOpts and CGOpts in a different order.

Reviewed By: rjmccall

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

4 years ago[VectorCombine] account for extra uses in scalarization cost
Sanjay Patel [Mon, 11 May 2020 19:20:57 +0000 (15:20 -0400)]
[VectorCombine] account for extra uses in scalarization cost

Follow-up to D79452.
Mimics the extra use cost formula for the inverse transform with extracts.

4 years ago[VectorCombine] add tests for possible scalarization with extra uses; NFC
Sanjay Patel [Mon, 11 May 2020 18:55:32 +0000 (14:55 -0400)]
[VectorCombine] add tests for possible scalarization with extra uses; NFC

4 years ago[FileCheck] Support comment directives
Joel E. Denny [Mon, 4 May 2020 22:05:55 +0000 (18:05 -0400)]
[FileCheck] Support comment directives

Sometimes you want to disable a FileCheck directive without removing
it entirely, or you want to write comments that mention a directive by
name.  The `COM:` directive makes it easy to do this.  For example,
you might have:

```
; X32: pinsrd_1:
; X32:    pinsrd $1, 4(%esp), %xmm0

; COM: FIXME: X64 isn't working correctly yet for this part of codegen, but
; COM: X64 will have something similar to X32:
; COM:
; COM:   X64: pinsrd_1:
; COM:   X64:    pinsrd $1, %edi, %xmm0
```

Without this patch, you need to use some combination of rewording and
directive syntax mangling to prevent FileCheck from recognizing the
commented occurrences of `X32:` and `X64:` above as directives.
Moreover, FileCheck diagnostics have been proposed that might complain
about the occurrences of `X64` that don't have the trailing `:`
because they look like directive typos:

  <http://lists.llvm.org/pipermail/llvm-dev/2020-April/140610.html>

I think dodging all these problems can prove tedious for test authors,
and directive syntax mangling already makes the purpose of existing
test code unclear.  `COM:` can avoid all these problems.

This patch also updates the small set of existing tests that define
`COM` as a check prefix:

- clang/test/CodeGen/default-address-space.c
- clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
- clang/test/Driver/hip-device-libs.hip
- llvm/test/Assembler/drop-debug-info-nonzero-alloca.ll

I think lit should support `COM:` as well.  Perhaps `clang -verify`
should too.

Reviewed By: jhenderson, thopre

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

4 years ago[FileCheck] Make invalid prefix diagnostics more precise
Joel E. Denny [Mon, 11 May 2020 13:57:37 +0000 (09:57 -0400)]
[FileCheck] Make invalid prefix diagnostics more precise

This will prove especially helpful after D79276, which introduces
comment prefixes.  Specifically, identifying whether there's a
uniqueness violation will be helpful as prefixes will be required to
be unique across both check prefixes and comment prefixes.

Also, remove a related comment about `cl::list` that no longer seems
relevant now that FileCheck is also a library.

Reviewed By: jhenderson, thopre

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

4 years ago[OpenMP][NFC] Fix `not` sustitution in tests
Joel E. Denny [Mon, 11 May 2020 13:51:32 +0000 (09:51 -0400)]
[OpenMP][NFC] Fix `not` sustitution in tests

D78566 introduced a `\bnot\b` lit substitution in OpenMP test suites.
However, that would corrupt a command like
`FileCheck -implicit-check-not` or any file name like `%t.not`.  We
could use lookbehind/lookahead assertions to avoid such cases, but
this patch switches to `%not` (suggested during the D78566 review) as
a safer option.

Reviewed By: jdoerfert

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

4 years ago[flang][NFC] Simplify semantics test scripts
Tim Keith [Mon, 11 May 2020 18:38:53 +0000 (11:38 -0700)]
[flang][NFC] Simplify semantics test scripts

There were several different ways of handling the option to f18 to
find predefined modules:
- test_errors.sh was created by cmake substituting
  FLANG_INTRINSIC_MODULES_DIR into test_errors.sh.in
- some tests used the flang script which has the option built it
- some tests used %f18_with_includes which was replaced by the path
  to f18 plus the -I option
- some included -I../../include/flang in their run command

To make this more consistent, change %f18 to include the
-intrinsic-module-directory option and use it everywhere, including
to replace %flang and %f18_with_includes. This requires changing all
of the invocations of the test scripts to put %f18 at the end so that
it can expand to more than one argument.

This eliminates the need to generate test_errors.sh which means we
don't need flang/test/Semantics/CMakeLists.txt or the %B substitution.
That makes the test_errors.sh command like the others, replacing
%B/test/Semantics/test_errors.sh with %S/test_errors.sh.

Also remove the OPTIONS: functionality as custom options can be included
in the RUN: command. And remove -I/../../include/flang as that is now
always included.

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

4 years ago[AArch64][GlobalISel] Make LR livein to entry in llvm.returnaddress selection
Jessica Paquette [Sat, 9 May 2020 01:10:46 +0000 (18:10 -0700)]
[AArch64][GlobalISel] Make LR livein to entry in llvm.returnaddress selection

This fixes a couple verifier failures on this bot:

http://green.lab.llvm.org/green/job/test-suite-verify-machineinstrs-aarch64-globalisel-O0-g/

The failures show up in eeprof-1.c and pr17377.c in the GCC C Torture Suite.

Specifically:

*** Bad machine code: MBB has allocatable live-in, but isn't entry or landing-pad. ***
- function:    foo
- basic block: %bb.3 if.end (0x7fac7106dfc8)
- p. register: $lr

and

*** Bad machine code: Using an undefined physical register ***
- function:    f
- basic block: %bb.1 entry (0x7f8941092588)
- instruction: %18:gpr64 = COPY $lr
- operand 1:   $lr

Unlike SDAG, we were setting LR as a live in to the block containing the
returnaddress.

Also, this ensures that we don't add LR as a livein to the entry block twice.
In MachineBasicBlock.h there's a comment saying

"Note that it is an error to add the same register to the same set more than
once unless the intention is to call sortUniqueLiveIns after all registers are
added."

so it's probably good to avoid adding LR twice.

Surprisingly the verifier doesn't complain about that. Maybe it should.

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

4 years ago[RISCV] Support Constant Pools in Load/Store Peephole
Sam Elliott [Mon, 11 May 2020 17:52:42 +0000 (18:52 +0100)]
[RISCV] Support Constant Pools in Load/Store Peephole

Summary:
RISC-V uses a post-select peephole pass to optimise
`(load/store (ADDI $reg, %lo(addr)), 0)` into `(load/store $reg, %lo(addr))`.
This peephole wasn't firing for accesses to constant pools, which is how we
materialise most floating point constants.

This adds support for the constantpool case, which improves code generation for
lots of small FP loading examples. I have not added any tests because this
structure is well-covered by the `fp-imm.ll` testcases, as well as almost
all other uses of floating point constants in the RISC-V backend tests.

Reviewed By: luismarques, asb

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

4 years ago[Matrix] Add matrix type to Clang.
Florian Hahn [Mon, 11 May 2020 16:45:51 +0000 (17:45 +0100)]
[Matrix] Add matrix type to Clang.

This patch adds a matrix type to Clang as described in the draft
specification in clang/docs/MatrixSupport.rst. It introduces a new option
-fenable-matrix, which can be used to enable the matrix support.

The patch adds new MatrixType and DependentSizedMatrixType types along
with the plumbing required. Loads of and stores to pointers to matrix
values are lowered to memory operations on 1-D IR arrays. After loading,
the loaded values are cast to a vector. This ensures matrix values use
the alignment of the element type, instead of LLVM's large vector
alignment.

The operators and builtins described in the draft spec will will be added in
follow-up patches.

Reviewers: martong, rsmith, Bigcheese, anemet, dexonsmith, rjmccall, aaron.ballman

Reviewed By: rjmccall

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

4 years ago[gn build] (manually) port bba38de50c9
Nico Weber [Mon, 11 May 2020 17:46:21 +0000 (13:46 -0400)]
[gn build] (manually) port bba38de50c9

4 years ago[CGP][x86] add test for funnel-shift with cross-block splat shift-amount; NFC
Sanjay Patel [Mon, 11 May 2020 14:48:47 +0000 (10:48 -0400)]
[CGP][x86] add test for funnel-shift with cross-block splat shift-amount; NFC

4 years ago[flang] Fix compilation after rename of Loop dialect to scf
Valentin Clement [Mon, 11 May 2020 17:13:58 +0000 (13:13 -0400)]
[flang] Fix compilation after rename of Loop dialect to scf

Summary: Flang was not compiling correctly after the renaming of Loop dialect to SCF. This patch fixes the problem.

Reviewers: ftynse, DavidTruby

Reviewed By: ftynse

Subscribers: aartbik, llvm-commits

Tags: #llvm

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

4 years agoRevert "[RISCV] Support Constant Pools in Load/Store Peephole"
Sam Elliott [Mon, 11 May 2020 17:13:41 +0000 (18:13 +0100)]
Revert "[RISCV] Support Constant Pools in Load/Store Peephole"

This reverts commit fe69dfebcfa007e23bf528fff8b96ac63e593e34, due to
a slight change in the API.

4 years ago[PowerPC][NFC] Convert an if/else to a conditional.
Sean Fertile [Mon, 11 May 2020 17:03:45 +0000 (13:03 -0400)]
[PowerPC][NFC] Convert an if/else to a conditional.

Change an if else to use a conditional which is shorter. Also name the
conditonal value to make the code clearer.

4 years ago[WebAssembly] Add wasm-specific vector shuffle builtin and intrinsic
Thomas Lively [Mon, 11 May 2020 16:55:43 +0000 (09:55 -0700)]
[WebAssembly] Add wasm-specific vector shuffle builtin and intrinsic

Summary:

Although using `__builtin_shufflevector` and the `shufflevector`
instruction works fine, they are not opaque to the optimizer. As a
result, DAGCombine can potentially reduce the number of shuffles and
change the shuffle masks. This is unexpected behavior for users of the
WebAssembly SIMD intrinsics who have crafted their shuffles to
optimize the code generated by engines. This patch solves the problem
by adding a new shuffle intrinsic that is opaque to the optimizers in
line with the decision of the WebAssembly SIMD contributors at
https://github.com/WebAssembly/simd/issues/196#issuecomment-622494748. In
the future we may implement custom DAG combines to properly optimize
shuffles and replace this solution.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[RISCV] Support Constant Pools in Load/Store Peephole
Sam Elliott [Mon, 11 May 2020 16:58:33 +0000 (17:58 +0100)]
[RISCV] Support Constant Pools in Load/Store Peephole

Summary:
RISC-V uses a post-select peephole pass to optimise
`(load/store (ADDI $reg, %lo(addr)), 0)` into `(load/store $reg, %lo(addr))`.
This peephole wasn't firing for accesses to constant pools, which is how we
materialise most floating point constants.

This adds support for the constantpool case, which improves code generation for
lots of small FP loading examples. I have not added any tests because this
structure is well-covered by the `fp-imm.ll` testcases, as well as almost
all other uses of floating point constants in the RISC-V backend tests.

Reviewed By: luismarques, asb

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

4 years agoProperly add out-of-module functions to the import list
Hongtao Yu [Mon, 11 May 2020 16:38:29 +0000 (09:38 -0700)]
Properly add out-of-module functions to the import list

This patch addresses two issues related to adding inline functions to the import list while recursively going through the profiling data.
1. For callsite samples, only add an inlined function to the import list if it's from outside of the module (i.e. only has a declaration inside the module).
2. For body samples, add each target function to the import list if it's from outside of the module (i.e. only has a declaration inside the module). Previously we were using getSubProgram() to check whether it has dbg info, which is inaccurate. This fix properly add imports and could improve the quality of the pass.

Added a few changes to the test to catch these cases.

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

4 years ago[lldb/test] Fix for flakiness in TestNSDictionarySynthetic
Vedant Kumar [Wed, 6 May 2020 23:08:19 +0000 (16:08 -0700)]
[lldb/test] Fix for flakiness in TestNSDictionarySynthetic

Summary:
TestNSDictionarySynthetic sets up an NSURL which does not initialize its
_baseURL member. When the test runs and we print out the NSURL, we print
out some garbage memory pointed-to by the _baseURL member, like:

```
_baseURL = 0x0800010020004029 @"d��qX"
```

and this can cause a python unicode decoding error like:

```
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position
10309: invalid start byte
```

There's a discrepancy here because lldb's StringPrinter facility tries
to only print out "printable" sequences (see: isprint32()), whereas python
rejects the StringPrinter output as invalid utf8. For the specific error
seen above, lldb's `isprint32(0xa0) = true`, even though 0xa0 is not
really "printable" in the usual sense.

The problem is that lldb and python disagree on what exactly is
"printable". Both have dismayingly hand-rolled utf8 validation code
(c.f. _Py_DecodeUTF8Ex), and I can't really tell which one is more
correct.

I tried replacing lldb's isprint32() with a call to libc's iswprint():
this satisfied python, but broke emoji printing :|.

Now, I believe that lldb (and python too) ought to just call into some
battle-tested utf library, and that we shouldn't aim for compatibility
with python's strict unicode decoding mode until then.

FWIW I ran this test under an ASanified lldb hundreds of times but
didn't turn up any other issues.

rdar://62941711

Reviewers: JDevlieghere, jingham, shafik

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[compile-rt] Reduce #ifdef noise for ptrauth
Julian Lettner [Thu, 7 May 2020 02:05:31 +0000 (19:05 -0700)]
[compile-rt] Reduce #ifdef noise for ptrauth

Create a sanitizer_ptrauth.h header that #includes <ptrauth> when
available and defines just the required macros as "no ops" otherwise.
This should avoid the need for excessive #ifdef'ing.

Follow-up to and discussed in: https://reviews.llvm.org/D79132

Reviewed By: delcypher

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

4 years ago[gn build] Port bf95cf4a681
LLVM GN Syncbot [Mon, 11 May 2020 16:35:33 +0000 (16:35 +0000)]
[gn build] Port bf95cf4a681

4 years ago[x86][seses] Introduce SESES pass for LVI
Zola Bridges [Mon, 11 May 2020 16:33:55 +0000 (09:33 -0700)]
[x86][seses] Introduce SESES pass for LVI

This is an implementation of Speculative Execution Side Effect
Suppression which is intended as a last resort mitigation against Load
Value Injection, LVI, a newly disclosed speculative execution side
channel vulnerability.

One pager:
https://software.intel.com/security-software-guidance/software-guidance/load-value-injection

Deep dive:
https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection

The mitigation consists of a compiler pass that inserts an LFENCE before
each memory read instruction, memory write instruction, and the first
branch instruction in a group of terminators at the end of a basic
block. The goal is to prevent speculative execution, potentially based
on misspeculated conditions and/or containing secret data, from leaking
that data via side channels embedded in such instructions.

This is something of a last-resort mitigation: it is expected to have
extreme performance implications and it may not be a complete mitigation
due to trying to enumerate side channels.

In addition to the full version of the mitigation, this patch
implements three flags to turn off part of the mitigation. These flags
are disabled by default. The flags are not intended to result in a
secure variant of the mitigation. The flags are intended to be used by
users who would like to experiment with improving the performance of
the mitigation. I ran benchmarks with each of these flags enabled in
order to find if there was any room for further optimization of LFENCE
placement with respect to LVI.

Performance Testing Results

When applying this mitigation to BoringSSL, we see the following
results. These are a summary/aggregation of the performance changes when
this mitigation is applied versus when no mitigation is applied.

Fully Mitigated vs Baseline
Geometric mean
0.071 (Note: This can be read as the ops/s of the mitigated
program was 7.1% of the ops/s of the unmitigated program.)
Minimum
0.041
Quartile 1
0.060
Median
0.063
Quartile 3
0.077
Maximum
0.230

Reviewed By: george.burgess.iv

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

4 years ago[mlir] Simplify and better document std.view semantics
Nicolas Vasilache [Mon, 11 May 2020 16:09:18 +0000 (12:09 -0400)]
[mlir] Simplify and better document std.view semantics

This [discussion](https://llvm.discourse.group/t/viewop-isnt-expressive-enough/991/2) raised some concerns with ViewOp.

In particular, the handling of offsets is incorrect and does not match the op description.
Note that with an elemental type change, offsets cannot be part of the type in general because sizeof(srcType) != sizeof(dstType).

Howerver, offset is a poorly chosen term for this purpose and is renamed to byte_shift.

Additionally, for all intended purposes, trying to support non-identity layouts for this op does not bring expressive power but rather increases code complexity.

This revision simplifies the existing semantics and implementation.
This simplification effort is voluntarily restrictive and acts as a stepping stone towards supporting richer semantics: treat the non-common cases as YAGNI for now and reevaluate based on concrete use cases once a round of simplification occurred.

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

4 years ago[llvm][utils] Remove git-svn folder + scripts
Zola Bridges [Mon, 4 May 2020 18:51:16 +0000 (11:51 -0700)]
[llvm][utils] Remove git-svn folder + scripts

Summary:
These tools are no longer useful since we've migrated off of SVN, so
this patch deletes them.

Link: http://lists.llvm.org/pipermail/llvm-dev/2020-May/141386.html
Unless there is opposition in the RFC thread, I'll submit the patch on
May 10, 2020.

I searched through the repo to confirm there were no mentions of the scripts
in other scripts or documentation.

Reviewed By: echristo, tstellar, MaskRay

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

4 years agoAdd vendor identity check for Hygon Dhyana processor in Scudo
Kostya Kortchinsky [Mon, 11 May 2020 16:16:54 +0000 (09:16 -0700)]
Add vendor identity check for Hygon Dhyana processor in Scudo

Summary:
The Hygon Dhyana processor supports hardware CRC32.

Related link:
https://reviews.llvm.org/D78874

Result of "make check":
Testing Time: 1364.04s
  Unsupported Tests:   317
  Expected Passes  : 36802
  Expected Failures:   161
[100%] Built target check-llvm
[100%] Built target check

Reviewers: cryptoad

Reviewed By: cryptoad

Subscribers: craig.topper, cryptoad, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

4 years ago[gn build] Port 48fa355ed4b
LLVM GN Syncbot [Mon, 11 May 2020 16:11:59 +0000 (16:11 +0000)]
[gn build] Port 48fa355ed4b

4 years ago[llvm][NFC] Move inlining decision-related APIs in InliningAdvisor.
Mircea Trofin [Fri, 8 May 2020 03:35:08 +0000 (20:35 -0700)]
[llvm][NFC] Move inlining decision-related APIs in InliningAdvisor.

Summary: Factoring out in preparation to https://reviews.llvm.org/D79042

Reviewers: dblaikie, davidxl

Subscribers: mgorny, eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Speculative fix for the entry values test on arm64
Pavel Labath [Mon, 11 May 2020 15:51:46 +0000 (17:51 +0200)]
[lldb] Speculative fix for the entry values test on arm64

The bot fails with a message which seems to indicate a problem in option
parsing. Avoid grouping the options to see if that helps.

4 years ago[Attributor] Fix for a crash on RAUW when rewriting function signature
Sergey Dmitriev [Mon, 11 May 2020 15:05:51 +0000 (08:05 -0700)]
[Attributor] Fix for a crash on RAUW when rewriting function signature

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: uenoku

Subscribers: hiraditya, uenoku, llvm-commits

Tags: #llvm

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

4 years ago[PowerPC] Use PredictableSelectIsExpensive to enable select to branch in CGP
Kang Zhang [Mon, 11 May 2020 15:02:09 +0000 (15:02 +0000)]
[PowerPC] Use PredictableSelectIsExpensive to enable select to branch in CGP

Summary:
This patch will set the variable PredictableSelectIsExpensive to do the
select to if based on BranchProbability in CodeGenPrepare.

When the BranchProbability more than MinPercentageForPredictableBranch,
PPC will convert SELECT to branch.

Reviewed By: nemanjai

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

4 years ago[Clang] Fix the incorrect return type of atomic_is_lock_free
Kamlesh Kumar [Mon, 11 May 2020 14:47:42 +0000 (10:47 -0400)]
[Clang] Fix the incorrect return type of atomic_is_lock_free

Fixing the return type of atomic_is_lock_free as per
https://en.cppreference.com/w/c/atomic/atomic_is_lock_free

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

4 years ago[mlir][Linalg] NFC - Refactor and simplify Promotion
Nicolas Vasilache [Mon, 11 May 2020 14:39:16 +0000 (10:39 -0400)]
[mlir][Linalg] NFC - Refactor and simplify Promotion

Summary: This revision introduces LinalgPromotionOptions to more easily control the application of promotion patterns. It also simplifies the different entry points into Promotion in preparation for some behavior change in subsequent revisions.

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