platform/upstream/llvm.git
6 years agoLet TableGen write output only if it changed, instead of doing so in cmake.
Nico Weber [Tue, 24 Apr 2018 17:29:05 +0000 (17:29 +0000)]
Let TableGen write output only if it changed, instead of doing so in cmake.

Removes one subprocess and one temp file from the build for each tablegen
invocation.

No intended behavior change.

https://reviews.llvm.org/D45899

llvm-svn: 330742

6 years agoReland "[mips] Guard traps for microMIPS correctly"
Simon Dardis [Tue, 24 Apr 2018 17:11:37 +0000 (17:11 +0000)]
Reland "[mips] Guard traps for microMIPS correctly"

This is part of fixing the instruction predicates for MIPS.

Reviewers: atanasyan, abeserminji

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

This patch relands r327409, hopefully without the problematic part of the
tests that cause FileCheck to assert on the windows expensive checks bot.

llvm-svn: 330741

6 years ago[lit, lldbsuite] Update the lldbsuite to correctly run tests on windows and windows...
Aaron Smith [Tue, 24 Apr 2018 17:08:05 +0000 (17:08 +0000)]
[lit, lldbsuite] Update the lldbsuite to correctly run tests on windows and windows server

Summary:
The new script to run the lldbtests as part of lit invokes each test by calling dotest.py, however, we cannot rely on the system to always correctly interpret the script as python causing the tests to be unresolved on windows (at least). To fix this, we need to make sure that the first parameter in the command line is the python executable itself.

In Makefile.rules, there are a number of windows specific definitions that rely on the HOST_OS being set as Windows_NT but the logic detecting the OS currently does not detect server versions of windows correctly. This change updates the logic to detect windows server as well.

Reviewers: asmith, labath, JDevlieghere, zturner

Reviewed By: JDevlieghere, zturner

Subscribers: zturner, llvm-commits

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

llvm-svn: 330740

6 years ago[LV][VPlan] Detect outer loops for explicit vectorization.
Diego Caballero [Tue, 24 Apr 2018 17:04:17 +0000 (17:04 +0000)]
[LV][VPlan] Detect outer loops for explicit vectorization.

Patch #2 from VPlan Outer Loop Vectorization Patch Series #1
(RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-December/119523.html).

This patch introduces the basic infrastructure to detect, legality check
and process outer loops annotated with hints for explicit vectorization.
All these changes are protected under the feature flag
-enable-vplan-native-path. This should make this patch NFC for the existing
inner loop vectorizer.

Reviewers: hfinkel, mkuper, rengolin, fhahn, aemerson, mssimpso.

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

llvm-svn: 330739

6 years ago[LoopInterchange] Make isProfitableForVectorization slightly more conservative.
Florian Hahn [Tue, 24 Apr 2018 16:55:32 +0000 (16:55 +0000)]
[LoopInterchange] Make isProfitableForVectorization slightly more conservative.

After D43236, we started interchanging loops with empty dependence
matrices.  In isProfitableForVectorization, we try to determine if
interchanging makes the loop dependences more friendly to the
vectorizer. If there are no dependences, we should not interchange,
based on that heuristic.

Reviewers: efriedma, mcrosier, karthikthecool, blitz.opensource

Reviewed By: mcrosier

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

llvm-svn: 330738

6 years ago[X86][F16C] Add WriteCvtF2FSt scheduling class
Simon Pilgrim [Tue, 24 Apr 2018 16:43:07 +0000 (16:43 +0000)]
[X86][F16C] Add WriteCvtF2FSt scheduling class

Fixes the classification of VCVTPS2PHmr/VCVTPS2PHYmr which were tagged as WriteCvtF2FLd_WriteRMW (PR36887)

llvm-svn: 330737

6 years ago[ADT] Remove ilist_default_traits
Fangrui Song [Tue, 24 Apr 2018 16:32:55 +0000 (16:32 +0000)]
[ADT] Remove ilist_default_traits

llvm-svn: 330736

6 years ago[X86][BtVer2] Fix VCVTPS2PHmr/VCVTPS2PHYmr latencies
Simon Pilgrim [Tue, 24 Apr 2018 16:26:51 +0000 (16:26 +0000)]
[X86][BtVer2] Fix VCVTPS2PHmr/VCVTPS2PHYmr latencies

These are stores, not loads, so don't need to account for load latency.

llvm-svn: 330735

6 years ago[X86][IVB] Add F16C resource tests.
Simon Pilgrim [Tue, 24 Apr 2018 16:22:59 +0000 (16:22 +0000)]
[X86][IVB] Add F16C resource tests.

Note this is IvyBridge (which shares the model) NOT SandyBridge.

llvm-svn: 330734

6 years ago[llvm-mca] Default the output asm dialect used by the instruction printer to the...
Andrea Di Biagio [Tue, 24 Apr 2018 16:19:08 +0000 (16:19 +0000)]
[llvm-mca] Default the output asm dialect used by the instruction printer to the input asm dialect.

The instruction printer used by llvm-mca to generate the performance report now
defaults the output assembly format to the format used for the input assembly
file.

On x86, the asm format can be either AT&T or Intel, depending on the
presence/absence of directive `.intel_syntax`.

Users can still specify a different assembly dialect with the command line flag
-output-asm-variant=<uint>.

llvm-svn: 330733

6 years ago[mips] Show an error if register number is out of range
Simon Atanasyan [Tue, 24 Apr 2018 16:14:00 +0000 (16:14 +0000)]
[mips] Show an error if register number is out of range

Current code does not check that a register number is in the 0-31 range.
Sometimes the parser checks that later for some kinds of instructions,
but that leads to unclear / incorrect error messages like that:

  % cat test.s
  .text
  lb $4, 8($32)

  % llvm-mc test.s -triple=mips64-unknown-linux
  test.s:2:10: error: expected memory with 16-bit signed offset
    lb $4, 8($32)
           ^

Sometimes the parser just crashes:

  % cat test.s
  .text
  lw  $4, 8($32)

  % llvm-mc test.s -triple=mips64-unknown-linux

This patch resolves the problem by checking that register number after
'$' sign is in the 0-31 range. If the number is out of the range the
parser shows the `invalid register number` error, but treats invalid
register number as a normal one to continue parsing and catch other
possible errors.

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

llvm-svn: 330732

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Tue, 24 Apr 2018 16:08:03 +0000 (16:08 +0000)]
[InstCombine] regenerate checks; NFC

The first step in fixing problems raised in D45862
is to make the problems visible. Now we can more easily
see/update cases where selects have been turned into
multiple instructions with no apparent improvement in
analysis or benefits for other passes (vectorization).

llvm-svn: 330731

6 years ago[AMDGPU][Waitcnt] NFC. Cleanup some code/naming consistency:
Mark Searles [Tue, 24 Apr 2018 15:59:59 +0000 (15:59 +0000)]
[AMDGPU][Waitcnt] NFC. Cleanup some code/naming consistency:
- s/SWaitcnt/Waitcnt s/WaitCnt/Waitcnt

llvm-svn: 330730

6 years ago[InstCombine] regenerate checks; NFC
Sanjay Patel [Tue, 24 Apr 2018 15:42:30 +0000 (15:42 +0000)]
[InstCombine] regenerate checks; NFC

The current version of the script uses regex for params.
This could mask a bug (param values got wrongly swapped),
but it seems unlikely in practice, so let's just update
the whole file to reduce diffs when there is a meaningful
change here.

llvm-svn: 330729

6 years ago[lit] Remove spurious `-` in invocation of lit in
Dan Liew [Tue, 24 Apr 2018 15:42:00 +0000 (15:42 +0000)]
[lit] Remove spurious `-` in invocation of lit in
`shtest-xunit-output.py` test.

Although there is no `-` file Jeremy Morse has reported to me that it
causes problems in their setup because lit tries to find it and ends up
loading an out of tree lit configuration file.

llvm-svn: 330728

6 years agoRemove LLVM_INSTALL_CCTOOLS_SYMLINKS
Nico Weber [Tue, 24 Apr 2018 15:41:02 +0000 (15:41 +0000)]
Remove LLVM_INSTALL_CCTOOLS_SYMLINKS

It used to symlink dsymutil to llvm-dsymutil, but after r327790 llvm's dsymutil
binary is now called dsymutil without prefix.

r327792 then reversed the direction of the symlink if
LLVM_INSTALL_CCTOOLS_SYMLINKS was set, but that looks like a buildfix and not
like something anyone should need.

https://reviews.llvm.org/D45966

llvm-svn: 330727

6 years agoFix some layering in AggressiveInstCombine (avoiding inclusion of Scalar.h)
David Blaikie [Tue, 24 Apr 2018 15:40:07 +0000 (15:40 +0000)]
Fix some layering in AggressiveInstCombine (avoiding inclusion of Scalar.h)

llvm-svn: 330726

6 years ago[LoadStoreVectorize] Ignore interleaved invariant loads.
Benjamin Kramer [Tue, 24 Apr 2018 15:28:47 +0000 (15:28 +0000)]
[LoadStoreVectorize] Ignore interleaved invariant loads.

The memory location an invariant load is using can never be clobbered by
any store, so it's safe to move the load ahead of the store.

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

llvm-svn: 330725

6 years ago[sanitizer] More dead code removal
Kostya Kortchinsky [Tue, 24 Apr 2018 14:58:10 +0000 (14:58 +0000)]
[sanitizer] More dead code removal

Summary:
The following functions are only used in tests: `SetEnv`,
`SanitizerSetThreadName`, `SanitizerGetThreadName`. I don't think they are
going to be used in the future, and I propose to get rid of them, and associated
tests and include.

Reviewers: alekseyshl, eugenis, vitalybuka

Reviewed By: vitalybuka

Subscribers: dvyukov, vitalybuka, kubamracek, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 330724

6 years ago[llvm-mca] Refactor the Scheduler interface in preparation for PR36663.
Andrea Di Biagio [Tue, 24 Apr 2018 14:53:16 +0000 (14:53 +0000)]
[llvm-mca] Refactor the Scheduler interface in preparation for PR36663.

Zero latency instructions are now scheduled the same way as other instructions.
Before this patch, there was a specialzed code path for those instructions.

All scheduler events are now generated from method `scheduleInstruction()` and
from method `cycleEvent()`. This will make easier to implement a "execution
stage", and let that stage publish all the scheduler events.

No functional change intended.

llvm-svn: 330723

6 years ago[Attr] Print enum attributes at correct position
Joel E. Denny [Tue, 24 Apr 2018 14:50:23 +0000 (14:50 +0000)]
[Attr] Print enum attributes at correct position

For example, given:

  void fn() {
    enum __attribute__((deprecated)) T *p;
  }

-ast-print produced:

  void fn() {
    enum T __attribute__((deprecated(""))) *p;
  }

-ast-print on that produced:

  void fn() {
    enum T *p __attribute__((deprecated("")));
  }

The attribute is on enum T in the first case, but it's on p in the
other cases.

Details:

Within enum declarations, enum attributes were always printed after
the tag and any member list.  When no member list was present but the
enum was a type specifier in a variable declaration, the attribute
then applied to the variable not the enum, changing the semantics.

This patch fixes that by always printing attributes between the enum's
keyword and tag, as clang already does for structs, unions, and
classes.

Reviewed By: rsmith

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

llvm-svn: 330722

6 years ago[OpenCL] Fix diagnostic of thread_local
Sven van Haastregt [Tue, 24 Apr 2018 14:47:29 +0000 (14:47 +0000)]
[OpenCL] Fix diagnostic of thread_local

Commit 08c258670c ("[OpenCL] Generic address space has been added in
OpenCL v2.0.", 2014-11-26) did not mark the thread_local keyword as a
storage class specifier, whereas it did mark _Thread_local as such.
According to the C++14 spec s7.1.1, thread_local is a storage class
specifier, so mark it as such.

I will add a test for this in a follow-up commit that adds keyword
restrictions to the OpenCL C++ language mode.

llvm-svn: 330721

6 years ago[X86] Remove unnecessary FMA reg-mem InstRW scheduler overrides.
Simon Pilgrim [Tue, 24 Apr 2018 14:47:11 +0000 (14:47 +0000)]
[X86] Remove unnecessary FMA reg-mem InstRW scheduler overrides.

llvm-svn: 330720

6 years ago[clang-tidy] Fix PR35468
Gabor Horvath [Tue, 24 Apr 2018 14:45:58 +0000 (14:45 +0000)]
[clang-tidy] Fix PR35468

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

llvm-svn: 330719

6 years ago[SystemZ] Use preferred 16-byte function alignment
Ulrich Weigand [Tue, 24 Apr 2018 14:03:21 +0000 (14:03 +0000)]
[SystemZ] Use preferred 16-byte function alignment

While not necessary for correctness, it is preferable for
performance reasons on all architectures we currently support
to align functions to 16-byte boundaries by default.

llvm-svn: 330718

6 years ago[CodeComplete] Fix completion at the end of keywords
Ilya Biryukov [Tue, 24 Apr 2018 13:48:53 +0000 (13:48 +0000)]
[CodeComplete] Fix completion at the end of keywords

Summary:
Make completion behave consistently no matter if it is run at the
start, in the middle or at the end of an identifier that happens to
be a keyword or a macro name. Since completion is often ran on
incomplete identifiers, they may turn into keywords by accident.

For example, we should produce same results for all of these
completion points:

    // ^ is completion point.
    ^class
    cla^ss
    class^

Previously clang produced different results for the last case (as if
the completion point was after a space: `class ^`).

This change also updates some offsets in tests that (unintentionally?)
relied on the old behavior.

Reviewers: sammccall, bkramer, arphaman, aaron.ballman

Reviewed By: sammccall

Subscribers: cfe-commits

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

llvm-svn: 330717

6 years agoFix Wdocumentation warnings. NFCI.
Simon Pilgrim [Tue, 24 Apr 2018 13:38:26 +0000 (13:38 +0000)]
Fix Wdocumentation warnings. NFCI.

llvm-svn: 330716

6 years ago[X86] Fix missing cfi from sitofp checks
Simon Pilgrim [Tue, 24 Apr 2018 13:24:56 +0000 (13:24 +0000)]
[X86] Fix missing cfi from sitofp checks

llvm-svn: 330715

6 years ago[X86] Add vector element insertion/extraction scheduler classes
Simon Pilgrim [Tue, 24 Apr 2018 13:21:41 +0000 (13:21 +0000)]
[X86] Add vector element insertion/extraction scheduler classes

Split off pinsr/pextr and extractps instructions.

(Mostly) fixes PR36887.

Note: It might be worth adding a WriteFInsertLd class as well in the future.

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

llvm-svn: 330714

6 years ago[MC] Remove orphan MCSchedModel::computeReciprocalThroughput declaration. NFCI.
Simon Pilgrim [Tue, 24 Apr 2018 13:01:03 +0000 (13:01 +0000)]
[MC] Remove orphan MCSchedModel::computeReciprocalThroughput declaration. NFCI.

llvm-svn: 330713

6 years agoThe OpenBSD UBsan port introduced two typos that broke the Solaris sanitizer build.
Rainer Orth [Tue, 24 Apr 2018 13:00:24 +0000 (13:00 +0000)]
The OpenBSD UBsan port introduced two typos that broke the Solaris sanitizer build.
The following patch restores it, will shortly commit as obvious.

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

llvm-svn: 330712

6 years ago[X86] Replace action Promote with Expand for operation ISD::SINT_TO_FP
Alexander Ivchenko [Tue, 24 Apr 2018 12:57:51 +0000 (12:57 +0000)]
[X86] Replace action Promote with Expand for operation ISD::SINT_TO_FP

Summary:
If attribute "use-soft-float"="true" is set then X86ISelLowering.cpp sets
'Promote' action for ISD::SINT_TO_FP operation on type i32.

But 'Promote' action is not proper in this case since lib function
__floatsidf is available for casting from signed int to float type.
Thus Expand action is more suitable here.

The Expand action should be set for ISD::UINT_TO_FP for soft float as well.

If function attribute "use-soft-float"="true" is set then infinite looping
can happen in DAG combining, function visitSINT_TO_FP() replaces SINT_TO_FP
node with UINT_TO_FP node and function combineUIntToFP() replace vice versa in cycle.
The fix prevents it.

Patch by vrybalov

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

llvm-svn: 330711

6 years ago[GCC] Don't keep a StringRef to a temporary std::string
Martin Storsjo [Tue, 24 Apr 2018 11:57:02 +0000 (11:57 +0000)]
[GCC] Don't keep a StringRef to a temporary std::string

This fixes failures in asan builds and possibly other buildbots
as well, after SVN r330696.

Prior to that revision, the std::string was stored in another
variable, before assigning to a StringRef.

llvm-svn: 330710

6 years ago[CodeGen] Print user-friendly debug locations as MI comments
Francis Visoiu Mistrih [Tue, 24 Apr 2018 11:00:46 +0000 (11:00 +0000)]
[CodeGen] Print user-friendly debug locations as MI comments

If available, print the file, line and column of the DebugLoc attached
to the MachineInstr:

MOV16mr $rbp, 1, $noreg, -112, $noreg, killed renamable $ax, debug-location !56 :: (store 2 into %ir.._value12); stepping.swift:10:17
renamable $edx = MOVZX32rm16 $rbp, 1, $noreg, -112, $noreg, debug-location !62 :: (dereferenceable load 2 from %ir.._value13); stepping.swift:10:17

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

llvm-svn: 330709

6 years ago[dotest] Make the set of tests independent of the test configuration
Pavel Labath [Tue, 24 Apr 2018 10:51:44 +0000 (10:51 +0000)]
[dotest] Make the set of tests independent of the test configuration

Summary:
In the magic test duplicator, we were making the decision whether to
create a test variant based on the compiler and the target platform.
This meant that the set of known tests was different for each test
configuration.

This patch makes the set of generated test variants static and handles
the skipping via runtime checks instead. This is more consistent with
how we do other test-skipping decision (e.g. for libc++ tests), and
makes it easier to expose the full set of tests to lit, which now does
not need to know anything about what things can potentially cause tests
to appear or disappear.

Reviewers: JDevlieghere, aprantl

Subscribers: eraman, lldb-commits

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

llvm-svn: 330708

6 years ago[PM/LoopUnswitch] Fix a bug in the loop block set formation of the new
Chandler Carruth [Tue, 24 Apr 2018 10:33:08 +0000 (10:33 +0000)]
[PM/LoopUnswitch] Fix a bug in the loop block set formation of the new
loop unswitch.

This code incorrectly added the header to the loop block set early. As
a consequence we would incorrectly conclude that a nested loop body had
already been visited when the header of the outer loop was the preheader
of the nested loop. In retrospect, adding the header eagerly doesn't
really make sense. It seems nicer to let the cycle be formed naturally.
This will catch crazy bugs in the CFG reconstruction where we can't
correctly form the cycle earlier rather than later, and makes the rest
of the logic just fall out.

I've also added various asserts that make these issues *much* easier to
debug.

llvm-svn: 330707

6 years agoCorrect dwarf unwind information in function epilogue
Petar Jovanovic [Tue, 24 Apr 2018 10:32:08 +0000 (10:32 +0000)]
Correct dwarf unwind information in function epilogue

This patch aims to provide correct dwarf unwind information in function
epilogue for X86.
It consists of two parts. The first part inserts CFI instructions that set
appropriate cfa offset and cfa register in emitEpilogue() in
X86FrameLowering. This part is X86 specific.

The second part is platform independent and ensures that:

* CFI instructions do not affect code generation (they are not counted as
  instructions when tail duplicating or tail merging)
* Unwind information remains correct when a function is modified by
  different passes. This is done in a late pass by analyzing information
  about cfa offset and cfa register in BBs and inserting additional CFI
  directives where necessary.

Added CFIInstrInserter pass:

* analyzes each basic block to determine cfa offset and register are valid
  at its entry and exit
* verifies that outgoing cfa offset and register of predecessor blocks match
  incoming values of their successors
* inserts additional CFI directives at basic block beginning to correct the
  rule for calculating CFA

Having CFI instructions in function epilogue can cause incorrect CFA
calculation rule for some basic blocks. This can happen if, due to basic
block reordering, or the existence of multiple epilogue blocks, some of the
blocks have wrong cfa offset and register values set by the epilogue block
above them.
CFIInstrInserter is currently run only on X86, but can be used by any target
that implements support for adding CFI instructions in epilogue.

Patch by Violeta Vukobrat.

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

llvm-svn: 330706

6 years ago[mips] Correct the patterns for bswap
Simon Dardis [Tue, 24 Apr 2018 10:19:29 +0000 (10:19 +0000)]
[mips] Correct the patterns for bswap

Guard the MIPS64 variant correctly for i64, mark the MIPS32 version as not
in microMIPS and provide the microMIPS version.

Additionally, remove a related stale XFAIL'd test as bswap has its own test
case providing coverage.

Reviewers: smaksimovic, abeserminji, atanasyan

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

llvm-svn: 330705

6 years ago[ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous...
Aleksei Sidorin [Tue, 24 Apr 2018 10:11:53 +0000 (10:11 +0000)]
[ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous decls

This patch introduces the ability to test an arbitrary sequence of imports
between a given set of virtual source files. This should finally allow
us to write simple tests and fix annoying issues inside ASTImporter
that cause failures in CSA CTU. This is done by refactoring
ASTImporterTest functions and introducing `testImportSequence` facility.
As a side effect, `testImport` facility was generalized a bit more. It
should now allow import of non-decl AST nodes; however, there is still no
test using this ability.

As a "test for test", there is also a fix for import anonymous TagDecls
referred by typedef. Before this patch, the setting of typedef for anonymous
structure was delayed; however, this approach misses the corner case if
an enum constant is imported directly. In this patch, typedefs for
anonymous declarations are imported right after the anonymous declaration
is imported, without any delay.

Thanks to Adam Balogh for suggestions included into this patch.

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

llvm-svn: 330704

6 years ago[llvm-mca][CommandGuide] Fix typo in example.
Andrea Di Biagio [Tue, 24 Apr 2018 10:09:32 +0000 (10:09 +0000)]
[llvm-mca][CommandGuide] Fix typo in example.

llvm-svn: 330703

6 years ago[ELF] - Never use std::sort.
George Rimar [Tue, 24 Apr 2018 09:55:39 +0000 (09:55 +0000)]
[ELF] - Never use std::sort.

It turns out we should not use the std::sort anymore.
r327219 added a new wrapper llvm::sort (D39245).
When EXPENSIVE_CHECKS is defined, it shuffles the
input container and that helps to find non-deterministic
ordering.

Patch changes code to use llvm::sort and std::stable_sort
instead of std::sort

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

llvm-svn: 330702

6 years ago[ELF] - Refactor lazy symbol duplicated code.
George Rimar [Tue, 24 Apr 2018 09:41:56 +0000 (09:41 +0000)]
[ELF] - Refactor lazy symbol duplicated code.

Our code for LazyObject and LazyArchive duplicates.

This patch extracts the common part to remove
the duplication.

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

llvm-svn: 330701

6 years ago[CodeGen] Do not allow opt-bisect-limit to skip ScalarizeMaskedMemIntrin.
Andrei Elovikov [Tue, 24 Apr 2018 09:24:29 +0000 (09:24 +0000)]
[CodeGen] Do not allow opt-bisect-limit to skip ScalarizeMaskedMemIntrin.

Summary:
The pass is supposed to scalarize such intrinsics if the target does not support
them natively, so if the scalarization does not happen instruction selection
crashes due to inability to lower these intrinsics.

Reviewers: andrew.w.kaylor, craig.topper

Reviewed By: andrew.w.kaylor

Subscribers: llvm-commits

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

llvm-svn: 330700

6 years ago[NFC] Remove recently added SE verification because it may be false-positive
Max Kazantsev [Tue, 24 Apr 2018 09:11:01 +0000 (09:11 +0000)]
[NFC] Remove recently added SE verification because it may be false-positive

llvm-svn: 330699

6 years ago[LoopInfo] Verify BBMap tracks innermost loops for BBs.
Florian Hahn [Tue, 24 Apr 2018 09:10:05 +0000 (09:10 +0000)]
[LoopInfo] Verify BBMap tracks innermost loops for BBs.

By checking that none of the child loops contain a BB we make sure BBMap
contains the innermost loop defining BB. This invariant was violated in
LoopInterchange and got caught by this assertion.

Reviewers: chandlerc, mzolotukhin, sanjoy, mehdi_amini, efriedma

Reviewed By: efriedma

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

llvm-svn: 330698

6 years ago[AArch64][SVE] Asm: Support for contiguous, first-faulting LDFF1 (scalar+scalar)...
Sander de Smalen [Tue, 24 Apr 2018 08:59:08 +0000 (08:59 +0000)]
[AArch64][SVE] Asm: Support for contiguous, first-faulting LDFF1 (scalar+scalar) load instructions.

Reviewers: fhahn, rengolin, samparker, SjoerdMeijer, t.p.northover, echristo, evandro, javed.absar

Reviewed By: rengolin

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330697

6 years ago[GCC] Match a GCC version with a patch suffix without a third version component
Martin Storsjo [Tue, 24 Apr 2018 08:50:11 +0000 (08:50 +0000)]
[GCC] Match a GCC version with a patch suffix without a third version component

Previously it would only accept a string as a GCC version if it had
either two components and no suffix, or three components with an
optional suffix.

Debian and ubuntu provided mingw compilers have lib/gcc/target entries
like "5.3-posix" and "5.3-win32". This doesn't try to make any specific
preference between them (other than lexical sorting of the suffix).

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

llvm-svn: 330696

6 years ago[test] Fix a typo in a test directory name. NFC.
Martin Storsjo [Tue, 24 Apr 2018 08:49:57 +0000 (08:49 +0000)]
[test] Fix a typo in a test directory name. NFC.

llvm-svn: 330695

6 years agoLink to AggressiveInstCombine in a few places. Unbreaks build for me.
Roman Lebedev [Tue, 24 Apr 2018 08:40:44 +0000 (08:40 +0000)]
Link to AggressiveInstCombine in a few places. Unbreaks build for me.

/usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass()
>>> referenced by cc1_main.cpp
>>>               tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp)

And so on

The bot coverage is clearly missing.

llvm-svn: 330694

6 years agoLink to AggressiveInstCombine in a few places. Unbreaks build for me.
Roman Lebedev [Tue, 24 Apr 2018 08:40:37 +0000 (08:40 +0000)]
Link to AggressiveInstCombine in a few places. Unbreaks build for me.

/usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass()
>>> referenced by cc1_main.cpp
>>>               tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp)

And so on

The bot coverage is clearly missing.

llvm-svn: 330693

6 years ago[libclang] Only mark CXCursors for explicit attributes with a type
Erik Verbruggen [Tue, 24 Apr 2018 08:39:46 +0000 (08:39 +0000)]
[libclang] Only mark CXCursors for explicit attributes with a type

All attributes have a source range associated with it. However, implicit
attributes are added by the compiler, and not added because the user
wrote something in the input. So no token type should be set to
CXCursor_*Attr.

The problem was visible when a class gets marked by e.g.
MSInheritanceAttr, which has the full CXXRecordDecl's range as its
own range. The effect of marking that range as CXCursor_UnexposedAttr
was that all cursors for the record decl, including all child decls,
would become CXCursor_UnexposedAttr.

llvm-svn: 330692

6 years ago[Support/Path] Add more tests and improve failure messages of existing ones
Pavel Labath [Tue, 24 Apr 2018 08:29:20 +0000 (08:29 +0000)]
[Support/Path] Add more tests and improve failure messages of existing ones

Summary:
I am preparing a patch to the path function. While working on it, I
noticed that some of the areas are lacking test coverage (e.g. filename
and parent_path functions), so I add more tests to guard against
regressions there.

I have also found the failure messages hard to understand, so I rewrote
some existing test to give more actionable messages when they fail:
- for tests which run over multiple inputs, I use SCOPED_TRACE, to show
  which of the inputs caused the actual failure.
- for comparisons of vectors, I use gmock's container matchers, which
  will print out the full container contents (and the elements that
  differ) when they fail to match.

Reviewers: zturner, espindola

Subscribers: llvm-commits

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

llvm-svn: 330691

6 years ago[AST] Another attempt at fixing the ARM bots.
Benjamin Kramer [Tue, 24 Apr 2018 08:18:32 +0000 (08:18 +0000)]
[AST] Another attempt at fixing the ARM bots.

llvm-svn: 330690

6 years ago[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.
Benjamin Kramer [Tue, 24 Apr 2018 07:53:10 +0000 (07:53 +0000)]
[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.

llvm-svn: 330689

6 years ago[LVI] Fix typo. NFC
Xin Tong [Tue, 24 Apr 2018 07:38:07 +0000 (07:38 +0000)]
[LVI] Fix typo. NFC

llvm-svn: 330688

6 years ago[LibFuzzer] Tweak `MutationDispatcher::Mutate_CopyPart` mutation.
Dan Liew [Tue, 24 Apr 2018 06:31:09 +0000 (06:31 +0000)]
[LibFuzzer] Tweak `MutationDispatcher::Mutate_CopyPart` mutation.

It doesn't make sense to non-deterministically choose between
`CopyPart(..)` and `InsertPart(..)` when it is known that
`InsertPart(..)` will fail.

This upstream's a change from JFS solver's fork of LibFuzzer.

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

llvm-svn: 330687

6 years ago[llvm-objcopy] Adjust the code for the old versions of msvc
Alexander Shaposhnikov [Tue, 24 Apr 2018 06:23:22 +0000 (06:23 +0000)]
[llvm-objcopy] Adjust the code for the old versions of msvc

Follow-up for r330685.

llvm-svn: 330686

6 years agoRecommit "[llvm-objcopy] Switch over to using TableGen for parsing arguments"
Alexander Shaposhnikov [Tue, 24 Apr 2018 05:43:32 +0000 (05:43 +0000)]
Recommit "[llvm-objcopy] Switch over to using TableGen for parsing arguments"

Add explicit dependency on ObjcopyTableGen
and rerun the tests on Windows.
I will double-check the build bots
and revert this commit if necessary.

llvm-svn: 330685

6 years ago[NFC] Use FileCheck in test
Max Kazantsev [Tue, 24 Apr 2018 04:42:37 +0000 (04:42 +0000)]
[NFC] Use FileCheck in test

llvm-svn: 330684

6 years ago[NFC] Use forgetTopmostLoop instead of logic duplication
Max Kazantsev [Tue, 24 Apr 2018 04:33:04 +0000 (04:33 +0000)]
[NFC] Use forgetTopmostLoop instead of logic duplication

llvm-svn: 330683

6 years ago[X86] Add a BSWAP16 instruction using the 32-bit encoding plus a 0x66 prefix.
Craig Topper [Tue, 24 Apr 2018 04:28:02 +0000 (04:28 +0000)]
[X86] Add a BSWAP16 instruction using the 32-bit encoding plus a 0x66 prefix.

This encoding is recognized by the CPU, but the behavior is undefined. This makes the disassembler handle it correctly so we don't print bswapl with a 16-bit register.

llvm-svn: 330682

6 years ago[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.
Craig Topper [Tue, 24 Apr 2018 03:36:08 +0000 (03:36 +0000)]
[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.

The unmasked versions already didn't have this restrction. I don't think gcc or icc limit these to 64-bit mode so we shouldn't either.

llvm-svn: 330681

6 years ago[PM/LoopUnswitch] Remove another over-aggressive assert.
Chandler Carruth [Tue, 24 Apr 2018 03:27:00 +0000 (03:27 +0000)]
[PM/LoopUnswitch] Remove another over-aggressive assert.

This code path can very clearly be called in a context where we have
baselined all the cloned blocks to a particular loop and are trying to
handle nested subloops. There is no harm in this, so just relax the
assert. I've added a test case that will make sure we actually exercise
this code path.

llvm-svn: 330680

6 years agoFixup Polly for an LLVM header file change.
David Blaikie [Tue, 24 Apr 2018 02:23:41 +0000 (02:23 +0000)]
Fixup Polly for an LLVM header file change.

llvm-svn: 330679

6 years agoRemove unused function HexagonEarlyIfConversion::replacePhiEdges. NFC.
Eric Christopher [Tue, 24 Apr 2018 02:10:59 +0000 (02:10 +0000)]
Remove unused function HexagonEarlyIfConversion::replacePhiEdges. NFC.

llvm-svn: 330678

6 years ago[NFC] Add clarification comment
Max Kazantsev [Tue, 24 Apr 2018 02:08:05 +0000 (02:08 +0000)]
[NFC] Add clarification comment

llvm-svn: 330677

6 years agoReflow formatting after previous NFC commit.
Eric Christopher [Tue, 24 Apr 2018 01:57:03 +0000 (01:57 +0000)]
Reflow formatting after previous NFC commit.

llvm-svn: 330676

6 years agoChange if-conditionals to else-if as they should all be mutually exclusive.
Eric Christopher [Tue, 24 Apr 2018 01:57:02 +0000 (01:57 +0000)]
Change if-conditionals to else-if as they should all be mutually exclusive.

No functional change intended.

llvm-svn: 330675

6 years agoMake add_clang_tool() formatting a bit more consistent.
Nico Weber [Tue, 24 Apr 2018 01:30:44 +0000 (01:30 +0000)]
Make add_clang_tool() formatting a bit more consistent.

llvm-svn: 330674

6 years agoMostly revert r330672.
Nico Weber [Tue, 24 Apr 2018 01:24:42 +0000 (01:24 +0000)]
Mostly revert r330672.

The test is apparently needed e.g. for check-cfi on Windows where we get
  'C:/b/slave/sanitizer-windows/build/./bin/clang.exe': command not found
without it.  Try to fix the problem that was fixed by r330672 by also checking
for isabs() instead.

llvm-svn: 330673

6 years agoRemove code that's almost always dead, and harmful if not.
Nico Weber [Tue, 24 Apr 2018 01:05:04 +0000 (01:05 +0000)]
Remove code that's almost always dead, and harmful if not.

lit's util.which() would check if the passed-in path existed directly,
and if so return it as-is.  This is never the case when running llvm's, clang's,
or lld's tests normally.  But when running `./llvm-lit path/to/clang/test`
with a cwd of llvm-build/bin, this if would detect that clang exists at path
'clang' and return 'clang' as the discovered clang binary -- and then lit would
use the " clang " -> "*** Do not use 'clang' in tests, use '%clang'. ***"
substitution to replace that with a broken test.  By removing this early
return, lit ends up with the usual absolute path and everything works even
in this uncommon case.

llvm-svn: 330672

6 years agoFix build break due to content moving from Scalar.h to InstCombine.h in LLVM
David Blaikie [Tue, 24 Apr 2018 00:59:22 +0000 (00:59 +0000)]
Fix build break due to content moving from Scalar.h to InstCombine.h in LLVM

llvm-svn: 330671

6 years agoFix build breaks in examples due to moving stuff from Scalar.h to InstCombine.h
David Blaikie [Tue, 24 Apr 2018 00:58:57 +0000 (00:58 +0000)]
Fix build breaks in examples due to moving stuff from Scalar.h to InstCombine.h

llvm-svn: 330670

6 years agoInstCombine: Fix layering by not including Scalar.h in InstCombine
David Blaikie [Tue, 24 Apr 2018 00:48:59 +0000 (00:48 +0000)]
InstCombine: Fix layering by not including Scalar.h in InstCombine

(notionally Scalar.h is part of libLLVMScalarOpts, so it shouldn't be
included by InstCombine which doesn't/shouldn't need to depend on
ScalarOpts)

llvm-svn: 330669

6 years ago[AggressiveInstCombine] Add aggressive inst combiner to the LLVM C API.
Craig Topper [Tue, 24 Apr 2018 00:39:29 +0000 (00:39 +0000)]
[AggressiveInstCombine] Add aggressive inst combiner to the LLVM C API.

I just tried to copy what was done for regular InstCombine. Hopefully I didn't miss anything.

llvm-svn: 330668

6 years agoReland r301880(!): "[InstSimplify] Handle selects of GEPs with 0 offset"
George Burgess IV [Tue, 24 Apr 2018 00:25:01 +0000 (00:25 +0000)]
Reland r301880(!): "[InstSimplify] Handle selects of GEPs with 0 offset"

I was reminded today that this patch got reverted in r301885. I can no
longer reproduce the failure that caused the revert locally (...almost
one year later), and the patch applied pretty cleanly, so I guess we'll
see if the bots still get angry about it.

The original breakage was InstSimplify complaining (in "assertion
failed" form) about getting passed some crazy IR when running `ninja
check-sanitizer`. I'm unable to find traces of what, exactly, said crazy
IR was. I suppose we'll find out pretty soon if that's still the case.
:)

Original commit:

  Author: gbiv
  Date: Mon May  1 18:12:08 2017
  New Revision: 301880

  URL: http://llvm.org/viewvc/llvm-project?rev=301880&view=rev
  Log:
  [InstSimplify] Handle selects of GEPs with 0 offset

  In particular (since it wouldn't fit nicely in the summary):
  (select (icmp eq V 0) P (getelementptr P V)) -> (getelementptr P V)

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

llvm-svn: 330667

6 years ago[HWASan] Use dynamic shadow memory on Android only.
Alex Shlyapnikov [Tue, 24 Apr 2018 00:17:02 +0000 (00:17 +0000)]
[HWASan] Use dynamic shadow memory on Android only.

There're issues with IFUNC support on other platforms.

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

llvm-svn: 330666

6 years ago[HWASan] Use dynamic shadow memory on Android only (LLVM)
Alex Shlyapnikov [Tue, 24 Apr 2018 00:16:54 +0000 (00:16 +0000)]
[HWASan] Use dynamic shadow memory on Android only (LLVM)

There're issues with IFUNC support on other platforms.

DIfferential Revision: https://reviews.llvm.org/D45840

llvm-svn: 330665

6 years ago[AggressiveInstCombine] Add createAggressiveInstCombinerPass to LinkAllPasses.h.
Craig Topper [Tue, 24 Apr 2018 00:11:04 +0000 (00:11 +0000)]
[AggressiveInstCombine] Add createAggressiveInstCombinerPass to LinkAllPasses.h.

llvm-svn: 330664

6 years ago[AggressiveInstCombine] Add library initializer routine for AggressiveInstCombine...
Craig Topper [Tue, 24 Apr 2018 00:05:21 +0000 (00:05 +0000)]
[AggressiveInstCombine] Add library initializer routine for AggressiveInstCombine library. Use it in bugpoint and llvm-opt-fuzzer to match regular InstCombine.

This should make aggressive instcombine usable with these tools.

llvm-svn: 330663

6 years ago[X86] Remove unnecessary vector memory folded InstRW overrides.
Simon Pilgrim [Mon, 23 Apr 2018 22:45:04 +0000 (22:45 +0000)]
[X86] Remove unnecessary vector memory folded InstRW overrides.

We have test coverage for these with resources-sse*/avx*

llvm-svn: 330662

6 years ago[LLVM-C] DIBuilder Bindings For Variable Expressions
Robert Widmann [Mon, 23 Apr 2018 22:31:49 +0000 (22:31 +0000)]
[LLVM-C] DIBuilder Bindings For Variable Expressions

Summary: Add DIBuilder bindings for (global) variable expressions, variable value expressions, and debug value intrinsic insertion.

Reviewers: harlanhaskins, deadalnix, whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 330661

6 years ago[GlobalISel][Legalizer] Look thro copies while combining G_UNMERGE's
Roman Tereshin [Mon, 23 Apr 2018 22:28:36 +0000 (22:28 +0000)]
[GlobalISel][Legalizer] Look thro copies while combining G_UNMERGE's

As we're becoming stricter w/ respect to not allowing vregs having LLTs
and regclasses assigned both mid-globalisel pipeline, the number of
extra copies grows, some of which separate G_UNMERGE's from their
corresponding G_MERGE's, becoming a performance concern.

It's worth mentioning that we're already looking through copies while
combining legalization artifacts for every kind of artifact but
G_UNMERGE.

Reviewed By: aditya_nandakumar

Reviewers: ab, t.p.northover, volkan, javed.absar

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 330660

6 years ago[X86] Remove unnecessary BMI2 InstRW overrides.
Simon Pilgrim [Mon, 23 Apr 2018 22:19:55 +0000 (22:19 +0000)]
[X86] Remove unnecessary BMI2 InstRW overrides.

We have test coverage for these with resources-bmi2.s

llvm-svn: 330659

6 years ago[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_...
Craig Topper [Mon, 23 Apr 2018 22:18:36 +0000 (22:18 +0000)]
[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_64.def.

The 32-bit refers to their input/output type, but the instructions are only available in 64-bit mode.

llvm-svn: 330658

6 years ago[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_6...
Craig Topper [Mon, 23 Apr 2018 22:18:34 +0000 (22:18 +0000)]
[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_64.def to make them unavailable in 32-bit mode.

llvm-svn: 330657

6 years ago[AST] strcmp/memcmp always compares unsigned chars.
Benjamin Kramer [Mon, 23 Apr 2018 22:04:34 +0000 (22:04 +0000)]
[AST] strcmp/memcmp always compares unsigned chars.

This makes it return the right result in a couple of edge cases. The
wide versions always do the comparison on the underlying wchar_t type.

llvm-svn: 330656

6 years agoRe-commit r330627 "[libcxx] implement <experimental/simd> declarations based on P0214R7."
Tim Shen [Mon, 23 Apr 2018 21:54:06 +0000 (21:54 +0000)]
Re-commit r330627 "[libcxx] implement <experimental/simd> declarations based on P0214R7."

There are 3 changes:
* Renamed genertor.pass.cpp to generator.pass.cpp
* Removed nothing_to_do.pass.cpp
* Mark GCC 4.9 as UNSUPPORTED for the test files that have negative
  narrowing conversion SFINAE test (see GCC PR63723).

llvm-svn: 330655

6 years ago[Docs] Regenerate command line documentation.
Craig Topper [Mon, 23 Apr 2018 21:41:06 +0000 (21:41 +0000)]
[Docs] Regenerate command line documentation.

llvm-svn: 330654

6 years ago[LoopInterchange] Do not change LI for BBs in child loops.
Florian Hahn [Mon, 23 Apr 2018 21:38:19 +0000 (21:38 +0000)]
[LoopInterchange] Do not change LI for BBs in child loops.

If a loop with child loops becomes our new inner loop after
interchanging, we only need to update LoopInfo for the blocks defined in
the old outer loop. BBs in child loops will stay there.

Reviewers: efriedma, karthikthecool, mcrosier

Reviewed By: efriedma

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

llvm-svn: 330653

6 years ago[libFuzzer] Add feature to not use AFL's deferred forkserver.
Matt Morehouse [Mon, 23 Apr 2018 21:36:21 +0000 (21:36 +0000)]
[libFuzzer] Add feature to not use AFL's deferred forkserver.

A small but substantial minority of libFuzzer-based fuzzers run code that
does not play well with fork in global constructors or LLVMFuzzerInitialize.
This patch allows these fuzzers to use afl_driver by allowing them to
opt-out of using AFL's deferred forkserver which deferres calling fork until
after this code.

Patch By: metzman

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

llvm-svn: 330652

6 years ago[Sema] Add -Wno-self-assign-overloaded
Roman Lebedev [Mon, 23 Apr 2018 21:35:21 +0000 (21:35 +0000)]
[Sema] Add -Wno-self-assign-overloaded

Summary:
It seems there isn't much enthusiasm for `-wtest` D45685.

This is more conservative version, which i had in the very first
revision of D44883, but that 'erroneously' got removed because of the review.

**Based on some [irc] discussions, it must really be documented that
we want all the new diagnostics to have their own flags, to ease
rollouts, transitions, etc.**

Please do note that i'm only adding `-Wno-self-assign-overloaded`,
but not `-Wno-self-assign-field-overloaded`, because i'm honestly
not aware of any false-positives from the `-field` variant,
but i can just as easily add it if wanted.
https://reviews.llvm.org/D44883#1068561

Reviewers: dblaikie, aaron.ballman, thakis, rjmccall, rsmith

Reviewed By: dblaikie

Subscribers: Quuxplusone, chandlerc, cfe-commits

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

llvm-svn: 330651

6 years agoChange kAllocatorSpace for powerpc64.
Martin Liska [Mon, 23 Apr 2018 21:13:40 +0000 (21:13 +0000)]
Change kAllocatorSpace for powerpc64.

Fixes issue: https://github.com/google/sanitizers/issues/933

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

llvm-svn: 330650

6 years agolog10: Use sw implementation from amd builtins
Jan Vesely [Mon, 23 Apr 2018 21:10:42 +0000 (21:10 +0000)]
log10: Use sw implementation from amd builtins

Add missing table.
Fixes log10d CTS on carrizo.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Aaron Watry <awatry@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 330649

6 years ago[X86] Remove unnecessary WriteLEA InstRW overrides.
Simon Pilgrim [Mon, 23 Apr 2018 21:04:23 +0000 (21:04 +0000)]
[X86] Remove unnecessary WriteLEA InstRW overrides.

llvm-svn: 330648

6 years ago[COFF] Alias /DEBUG:FULL to /DEBUG
Zachary Turner [Mon, 23 Apr 2018 20:54:08 +0000 (20:54 +0000)]
[COFF] Alias /DEBUG:FULL to /DEBUG

With MSVC linker, /DEBUG is an alias of /DEBUG:FASTLINK, and if
you don't want /DEBUG:FASTLINK you have to explicitly specify
/DEBUG:FULL.

LLD doesn't support /DEBUG:FASTLINK, and so our standard /DEBUG
option is what MSVC calls /DEBUG:FULL.  To provide command line
compatibility with MSVC, we should also support /DEBUG:FULL, and
since it's the same as what LLD already does for /DEBUG, just
alias it.

llvm-svn: 330647

6 years ago[DAGCombiner] Unfold scalar masked merge if profitable
Roman Lebedev [Mon, 23 Apr 2018 20:38:49 +0000 (20:38 +0000)]
[DAGCombiner] Unfold scalar masked merge if profitable

Summary:
This is [[ https://bugs.llvm.org/show_bug.cgi?id=37104 | PR37104 ]].

[[ https://bugs.llvm.org/show_bug.cgi?id=6773 | PR6773 ]] will introduce an IR canonicalization that is likely bad for the end assembly.
Previously, `andl`+`andn`/`andps`+`andnps` / `bic`/`bsl` would be generated. (see `@out`)
Now, they would no longer be generated  (see `@in`).
So we need to make sure that they are still generated.

If the mask is constant, we do nothing. InstCombine should have unfolded it.
Else, i use `hasAndNot()` TLI hook.

For now, only handle scalars.

https://rise4fun.com/Alive/bO6

----

I *really* don't like the code i wrote in `DAGCombiner::unfoldMaskedMerge()`.
It is super fragile. Is there something like IR Pattern Matchers for this?

Reviewers: spatel, craig.topper, RKSimon, javed.absar

Reviewed By: spatel

Subscribers: andreadb, courbet, kristof.beyls, javed.absar, rengolin, nemanjai, llvm-commits

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

llvm-svn: 330646

6 years ago[X86][AArch64][NFC] Add tests for masked merge unfolding
Roman Lebedev [Mon, 23 Apr 2018 20:38:42 +0000 (20:38 +0000)]
[X86][AArch64][NFC] Add tests for masked merge unfolding

Summary:
This is [[ https://bugs.llvm.org/show_bug.cgi?id=37104 | PR37104 ]].

[[ https://bugs.llvm.org/show_bug.cgi?id=6773 | PR6773 ]] will introduce an IR canonicalization that is likely bad for the end assembly.
Previously, `andl`+`andn`/`andps`+`andnps` / `bic`/`bsl` would be generated. (see `@out`)
Now, they would no longer be generated  (see `@in`).
I'm guessing `llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp` should be able to unfold this.

Reviewers: spatel, craig.topper, RKSimon, javed.absar

Reviewed By: spatel

Subscribers: nemanjai, rengolin, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 330645

6 years agoRemove duplicate "error:" from an error message.
Rui Ueyama [Mon, 23 Apr 2018 20:34:35 +0000 (20:34 +0000)]
Remove duplicate "error:" from an error message.

This patch also simplifies the code a bit which wasn't committed in
https://reviews.llvm.org/r330600.

llvm-svn: 330644

6 years ago[Sanitizer] Internal Printf string width + left-justify.
Alex Shlyapnikov [Mon, 23 Apr 2018 20:30:50 +0000 (20:30 +0000)]
[Sanitizer] Internal Printf string width + left-justify.

Summary:
Example:

  Printf("%-5s", "123");

should yield:

  '123  '

In case Printf's requested string field width is larger than the string
argument length, the resulting string should be padded up to the requested
width.

For the simplicity sake, implementing left-justified (right padding) only.

Reviewers: eugenis

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 330643