6342 Commits

Author SHA1 Message Date
Craig Topper
911f6bba33 [TableGen] Teach tablegen to allow SDNPCommutable nodes with more than 2 operands.
Summary:
Tablegen already supports commutable instrinsics with more than 2 operands. There it just assumes the first two operands are commutable.

I plan to use this to improve the generation of FMA patterns in the X86 backend.

Reviewers: aymanmus, zvi, RKSimon, spatel, arsenm

Reviewed By: arsenm

Subscribers: arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-04 03:44:33 +00:00
Reid Kleckner
bf95626bdc [lit] Fix some issues with short paths in test discovery introduced in r312254
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312288 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31 21:56:14 +00:00
Reid Kleckner
93d5c695d8 [lit] Make symlinks in test paths work a different way
Use os.path.normpath instead of realpath to collapse '..' and '.' path
components. Use realpath when caching search results about a path for
good measure.

I considered rigging up a test involving symlinks for this, but I doubt
I can check a symlink into SVN. The test would have to conditionally
create a symlink at runtime if the host OS supports it. This sounds too
fragile and complicated to me to be worth it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312254 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31 17:07:35 +00:00
Reid Kleckner
44fb142cab Revert "[lit] Don't call realpath on the path used for test suite search"
This reverts r312250, it breaks the lit test suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312251 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31 16:42:30 +00:00
Reid Kleckner
b2e2c4b8a9 [lit] Don't call realpath on the path used for test suite search
This preserves symlinks in paths, so that someone can symlink more tests
into a larger test suite. For example, debuginfo-tests is currently
designed to be checked out into clang/test. With this change, it can be
symlinked into place instead, which works better with the monorepo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312250 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31 16:35:08 +00:00
Craig Topper
923dbc9300 [TableGen] Fix a range based for loop to take the value by reference so that SimplifyTree can modify the copy in the array if its needs to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312088 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30 02:05:03 +00:00
Yuka Takahashi
3b1f2041f7 [Bash-autocompletion] Add support for -std=
Summary:
Add support for autocompleting values of -std= by including
LangStandards.def. This patch relies on D36782, and is using two-stage
code generation.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29 02:01:56 +00:00
Yuka Takahashi
f9f2c95eca Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"
This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e.

r311552 broke lld buildbot because I've changed OptionInfos type from
ArrayRef to vector. However the bug is fixed, so I'll commit this again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311958 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29 00:09:31 +00:00
Matthias Braun
1047945a59 Try to fix compilation problem with libstdc++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311918 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 20:11:28 +00:00
Matthias Braun
7dc0bf2675 Address r311914 review comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311917 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 20:11:27 +00:00
Matthias Braun
863f34946c TableGen: Fix subreg composition/concatenation
This fixes 2 problems in subregister hierarchies with multiple levels
and tuples:

1) For bigger tuples computing secondary subregs would miss 2nd order
effects.  In the test case a register like `S10_S11_S12_S13_S14` with D5
= S10_S11, D6 = S12_S13 we would correctly compute sub0 = D5, sub1 = D6
but would miss the fact that we could now form ssub0_ssub1_ssub2_ssub3
(aka sub0_sub1) = D5_D6. This is fixed by changing
computeSecondarySubRegs() to compute a fixpoint.

2) Fixing 1) exposed a problem where TableGen would create multiple
names for effectively the same subregister index. In the test case
the subregister index sub0 is composed from ssub0 and ssub1, and sub1 is
composed from ssub2 and ssub3. TableGen should not create both sub0_sub1
and ssub0_ssub1_ssub2_ssub3 as infered subregister indexes. This changes
the code to build a transitive closure of the subregister components
before forming new concatenated subregister indexes.

This fix was developed for an out of tree target. For the in-tree
targets the only change is in the register information computed for ARM.
There is a slight chance this fixed/improved some register coalescing
around the QQQQ/QQ register classes there but I couldn't see/provoke any
code generation differences.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311914 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 19:48:42 +00:00
Matthias Braun
8c42b74f86 TableGen: Add -gen-register-info-debug-dump
Adds a new --gen-register-info-debug-dump mode to tablegen that dumps various register related information:

- List of register classes with super and subclasses
- List of subregister indexes with lanemasks
- List of registers with subregisters

I will use this in an upcoming commit to create a test.

It may also be useful for target developers wanting to get an overview
of all the register related information, esp. the things inferred by
tablegen and not directly visible in the .td file.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311913 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 19:48:40 +00:00
Ilya Biryukov
a6b4f0552f Changed Dockerfiles to install LLVM into /usr/local
Summary:
Previously, the installation path was simply '/'.
Using '/usr/local' would ensure that LLVM installation does not
conflict with software installed via package managers.

Reviewers: mehdi_amini, klimek

Reviewed By: klimek

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311890 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 15:12:24 +00:00
Sanjay Patel
34ce329ff4 [utils] add aarch64 target as an option
I don't know enough to add a custom scrubber for AArch64, so I just re-used ARM.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 19:33:18 +00:00
Ilya Biryukov
33badf7093 Use temporary directory when building docker image.
Summary:
This avoids races on copying of compiled clang from 'build' image
to 'release' image.

Reviewers: klimek, mehdi_amini

Reviewed By: mehdi_amini

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311769 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 09:03:57 +00:00
Chandler Carruth
2b7d94b2dc Teach the llc check updater to recognize the end-of-function comment
used on Windows and sometimes Darwin. Cleans up generated patterns for
me quite a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311752 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25 02:32:48 +00:00
Daniel Sanders
a8273d0212 [globalisel][tablegen] Predicates should start from GIPFP_Invalid+1 not GIPFP_Invalid
This fixes a warning when there are zero defined predicates and also fixes an
unnoticed bug where the first predicate in the table was unusable.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311684 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-24 18:54:16 +00:00
Daniel Sanders
02ad65f1a0 Re-commit: [globalisel][tablegen] Add support for ImmLeaf without SDNodeXForm
Summary:
This patch adds support for predicates on imm nodes but only for ImmLeaf and not
for PatLeaf or PatFrag and only where the value does not need to be transformed
before being rendered into the instruction.

The limitation on PatLeaf/PatFrag/SDNodeXForm is due to differences in the
necessary target-supplied C++ for GlobalISel.

Depends on D36085

The previous commit was reverted for breaking the build but this appears to have
been the recurring problem on the Windows bots with tablegen not being re-run
when llvm-tblgen is changed but the .td's aren't. If it re-occurs then forcing a
build with clean=True should fix it but this string should do this in advance:
    Requires a clean build.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, javed.absar, igorb, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311645 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-24 09:11:20 +00:00
Ilya Biryukov
851d8014a1 Fixed invalid variable name in Dockerfile scripts.
LLVM_SVN_REVISION was used instead of LLVM_SVN_REV.
This caused a revision option to be ignored in Dockerfiles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311564 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23 15:36:44 +00:00
Victor Leschuk
0e75cf0e23 Revert r311546 as it breaks build
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/4394



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311560 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23 15:21:10 +00:00
Victor Leschuk
d177228190 Make lit :: shtest-format.py supported on Windows again
It was marked as unsupported on Windows in r311230 because on some Win10 
machines it failed or caused hang. The problem was that on these machines
system bash (C:\Windows\System32\bash.exe) was used which requires paths to be
passed like '/mnt/c/path/to/my/script' instead of 'C:\path\to\my\script'.

TODO: we should make lit detect if system bash is used instead of msys and set
appropriate path format.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311558 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23 14:59:09 +00:00
Rui Ueyama
6603f56f5f Revert r311552: [Bash-autocompletion] Add support for static analyzer flags
This reverts commit r311552 because it broke ubsan and asan bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311557 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23 14:48:58 +00:00
Yuka Takahashi
c2ae4dbfbe [Bash-autocompletion] Add support for static analyzer flags
Summary:
This is a patch for clang autocomplete feature.

It will collect values which -analyzer-checker takes, which is defined in
clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically.
First, from ValuesCode class in Options.td, TableGen will generate C++
code in Options.inc. Options.inc will be included in DriverOptions.cpp, and
calls OptTable's addValues function. addValues function will add second
argument to Option's Values class. Values contains string like "foo,bar,.."
which is handed to Values class
in OptTable.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: hiraditya, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311552 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23 13:39:47 +00:00
Daniel Sanders
631020137d [globalisel][tablegen] Add support for ImmLeaf without SDNodeXForm
Summary:
This patch adds support for predicates on imm nodes but only for ImmLeaf and not for PatLeaf or PatFrag and only where the value does not need to be transformed before being rendered into the instruction.

The limitation on PatLeaf/PatFrag/SDNodeXForm is due to differences in the necessary target-supplied C++ for GlobalISel.

Depends on D36085

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, javed.absar, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311546 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23 12:14:18 +00:00
Daniel Sanders
c2086906b5 [globalisel][tablegen] Add tests for FeatureBitsets and ComplexPattern predicates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311542 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-23 10:09:25 +00:00
Craig Topper
3662f50ee1 [AVX512] Add 128->256 vbroadcastf64x2/vbroadcasti64x2 instructions to the EVEX->VEX table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311307 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-21 05:03:28 +00:00
Victor Leschuk
df50467fed Temporary mark lit :: shtest-format as unsupported on windows
When run manually it fails, but when run under buildbot it causes hang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311230 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-19 07:58:07 +00:00
Ben Dunbobbin
a74a4df4d5 [lit] support unsetting env variables (again!)
This is an updated version of https://reviews.llvm.org/D22144 by @jlpeyton.

The patch was accepted but not landed.

This is useful functionality and I would like to use this to enable lit tests for environment variable behaviour.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311180 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18 17:32:57 +00:00
Ilya Biryukov
9ad46603e4 Addressed some security issues in Dockerfiles.
Summary:
- Removed --trust-server-cert from `svn checkout` invocations.
  Installing 'ca-certificates' package on ubuntu adds required CAs to
  the system and svn can do proper checkout using https.

- Added checksum verification when installing cmake from cmake.org.

Reviewers: mehdi_amini, klimek

Reviewed By: mehdi_amini

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311152 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18 09:37:23 +00:00
Daniel Sanders
c3fa9e8b81 [globalisel][tablegen] Generate TypeObject table. NFC
Summary:
Generate the type table from the types used by a target rather than hard-coding
the union of types used by all targets.

Depends on D36084

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311084 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-17 13:18:35 +00:00
Daniel Sanders
2cd3b1f607 Re-commit: [globalisel][tablegen] Support zero-instruction emission.
Summary:
Support the case where an operand of a pattern is also the whole of the
result pattern. In this case the original result and all its uses must be
replaced by the operand. However, register class restrictions can require
a COPY. This patch handles both cases by always emitting the copy and
leaving it for the register allocator to optimize.

The previous commit failed on Windows machines due to a flaw in the sort
predicate which allowed both A < B < C and B == C to be satisfied
simultaneously. The cause of this was some sloppiness in the priority order of
G_CONSTANT instructions compared to other instructions. These had equal priority
because it makes no difference, however there were operands had higher priority
than G_CONSTANT but lower priority than any other instruction. As a result, a
priority order between G_CONSTANT and other instructions must be enforced to
ensure the predicate defines a strict weak order.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Subscribers: javed.absar, kristof.beyls, igorb, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311076 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-17 09:26:14 +00:00
Tom Stellard
1dbfdcc5b5 test-release.sh: Move test-suite setup to beginning of the script
Summary:
We want to catch failures early before do the full 3 stage build.

The goal here is to avoid running through the whole build process and have
it fail at the end (and not create the binary packages), just because
some prerequisites failed to install.

Reviewers: rovka, hans

Reviewed By: hans

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310939 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15 18:11:56 +00:00
Daniel Sanders
97c5e76113 Revert r310919 - [globalisel][tablegen] Support zero-instruction emission.
As expected, this failed on the windows bots but the instrumentation showed
something interesting. The ADD8ri and INC8r rules are never directly compared
on the windows machines. That implies that the issue lies in transitivity of
the Compare predicate. I believe I've already verified that but maybe I missed
something.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15 15:10:31 +00:00
Daniel Sanders
b5378b63e3 Re-commit with some instrumentation: [globalisel][tablegen] Support zero-instruction emission.
Summary:
Support the case where an operand of a pattern is also the whole of the
result pattern. In this case the original result and all its uses must be
replaced by the operand. However, register class restrictions can require
a COPY. This patch handles both cases by always emitting the copy and
leaving it for the register allocator to optimize.

The previous commit failed on the windows bots and this one is likely to fail
on those same bots. However, the added instrumentation should reveal a particular
isHigherPriorityThan() evaluation which I'm expecting to expose that
these machines are weighing priority of two rules differently from the
non-windows machines.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Subscribers: javed.absar, kristof.beyls, igorb, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310919 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15 13:50:09 +00:00
Andrew Kaylor
68d0bd1ed4 Add strictfp attribute to prevent unwanted optimizations of libm calls
Differential Revision: https://reviews.llvm.org/D34163



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310885 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 21:15:13 +00:00
Daniel Sanders
4e00089e47 Revert r310716 (and r310735): [globalisel][tablegen] Support zero-instruction emission.
Two of the Windows bots are failing test\CodeGen\X86\GlobalISel\select-inc.mir
which should not have been affected by the change. Reverting while I investigate.

Also reverted r310735 because it builds on r310716.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310745 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 19:19:21 +00:00
Daniel Sanders
bbb446c67c [globalisel][tablegen] Generate TypeObject table. NFC
Summary:
Generate the type table from the types used by a target rather than hard-coding
the union of types used by all targets.

Depends on D36084

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310735 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 17:30:37 +00:00
Daniel Sanders
85e8bedc1a [globalisel][tablegen] Support zero-instruction emission.
Summary:
Support the case where an operand of a pattern is also the whole of the
result pattern. In this case the original result and all its uses must be
replaced by the operand. However, register class restrictions can require
a COPY. This patch handles both cases by always emitting the copy and
leaving it for the register allocator to optimize.

Depends on D35833

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Subscribers: javed.absar, kristof.beyls, igorb, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310716 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 15:40:32 +00:00
Daniel Sanders
0e484a9fbc [globalisel][tablegen] Remove unnecessary ; to satisfy ubuntu-gcc7.1-werror.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310357 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 13:21:26 +00:00
Daniel Sanders
2ce2d5b785 [globalisel][tablegen] Add support for importing 'imm' operands.
Summary:
This patch enables the import of rules containing 'imm' operands that do not
constrain the acceptable values using predicates. Support for ImmLeaf will
arrive in a later patch.

Depends on D35681

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, javed.absar, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310343 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 10:44:31 +00:00
Nirav Dave
b02dd20ac2 [TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true
Relanding after fixing UB issue with DefaultOffsets.

Consider the following instruction: "inst.eq $dst, $src" where ".eq"
is an optional flag operand.  The $src and $dst operands are
registers.  If we parse the instruction "inst r0, r1", the flag is not
present and it will be marked in the "OptionalOperandsMask" variable.
After the matching is complete we call the "convertToMCInst" method.

The current implementation works only if the optional operands are at
the end of the array.  The "Operands" array looks like [token:"inst",
reg:r0, reg:r1].  The first operand that must be added to the MCInst
is the destination, the r0 register.  The "OpIdx" (in the Operands
array) for this register is 2.  However, since the flag is not present
in the Operands, the actual index for r0 should be 1.  The flag is not
present since we rely on the default value.

This patch removes the "NumDefaults" variable and replaces it with an
array (DefaultsOffset).  This array contains an index for each operand
(excluding the mnemonic).  At each index, the array contains the
number of optional operands that should be subtracted.  For the
previous example, this array looks like this: [0, 1, 1].  When we need
to access the r0 register, we compute its index as 2 -
DefaultsOffset[1] = 1.

Patch by Alexandru Guduleasa!

Reviewers: SamWot, nhaustov, niravd

Reviewed By: niravd

Subscribers: vitalybuka, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310254 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-07 13:55:27 +00:00
Vitaly Buka
4bc3e83301 Revert "[TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true"
Breaks check-llvm under ubsan.

This reverts commit r309949.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310008 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 00:25:24 +00:00
Greg Bedwell
123eabac1f Fix check-lit compatibility with multi-config CMake generators
Multi-configuration CMake generators such as those for Visual Studio or Xcode do not
specify a build config at configure time, but let the user choose at build
time.  In these cases binaries go into build/${Configuration}/bin rather than
build/bin.  Prior to this commit, check-lit would fail when using multi-configuration
generators as it did not know how to resolve ${Configuration} in order
to find tools such as FileCheck.  This commit teaches it to resolve
llvm_tools_dir within lit using the value specified with --param
build_mode.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309967 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 17:55:54 +00:00
Nirav Dave
53e7817cd8 [TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true
Consider the following instruction: "inst.eq $dst, $src" where ".eq"
is an optional flag operand.  The $src and $dst operands are
registers.  If we parse the instruction "inst r0, r1", the flag is not
present and it will be marked in the "OptionalOperandsMask" variable.
After the matching is complete we call the "convertToMCInst" method.

The current implementation works only if the optional operands are at
the end of the array.  The "Operands" array looks like [token:"inst",
reg:r0, reg:r1].  The first operand that must be added to the MCInst
is the destination, the r0 register.  The "OpIdx" (in the Operands
array) for this register is 2.  However, since the flag is not present
in the Operands, the actual index for r0 should be 1.  The flag is not
present since we rely on the default value.

This patch removes the "NumDefaults" variable and replaces it with an
array (DefaultsOffset).  This array contains an index for each operand
(excluding the mnemonic).  At each index, the array contains the
number of optional operands that should be subtracted.  For the
previous example, this array looks like this: [0, 1, 1].  When we need
to access the r0 register, we compute its index as 2 -
DefaultsOffset[1] = 1.

Patch by Alexandru Guduleasa!

Reviewers: SamWot, nhaustov, niravd

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309949 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 15:40:21 +00:00
Florian Hahn
c580a5c5db [GlobalISel] Only merge memory ops for mayLoad or mayStore instrs.
Summary:
We only need to merge memory operands for instructions that access
 memory. This slightly reduces the number of actions executed. 

Reviewers: MatzeB, rovka, dsanders

Reviewed By: dsanders

Subscribers: aemerson, igorb, kristof.beyls, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309944 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-03 14:48:22 +00:00
Reid Kleckner
5db8114aea Revert "[lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs"
This reverts r309602, check-lit still leaves Output directories in the
source directory.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 17:16:25 +00:00
Daniel Sanders
e36182d580 [globalisel][tablegen] Do not merge memoperands from instructions that weren't in the match.
Summary:
Fix a bug discovered in an out-of-tree target where memoperands from
pseudo-instructions that weren't part of the match were being merged into the
result instructions as part of GIR_MergeMemOperands.

This bug was caused by a change to the handling of State.MIs between rules when
the state machine tables were fused into a single table. Previously, each rule
would reset State.MIs using State.MIs.resize(1) but this is no longer done, as a
result stale data is occasionally left in some elements of State.MIs. Most
opcodes aren't affected by this but GIR_MergeMemOperands merges all memoperands
from the intructions recorded in State.MIs into the result instruction.

Suppose for example, we processed but rejected the following pattern:
  (signextend (load x))
at this point, State.MIs contains the signextend and the load. Now suppose we
process and accept this pattern:
  (add x, y)
at this point, State.MIs contains the add as well as the (now irrelevant) load.
When GIR_MergeMemOperands is processed, the memoperands from that irrelevant
load will be merged into the result instruction even though it was not part of
the match.

Bringing back the State.MIs.resize(1) would fix the problem but it would limit
our ability to optimize the table in the future. Instead, this patch fixes the
problem by explicitly stating which instructions should be merged into the result.

There's no direct test case in this commit because a test case would be very brittle.
However, at the time of writing this should fix the failures in
http://green.lab.llvm.org/green/job/Compiler_Verifiers_GlobalISEL/ as well as a
failure in test/CodeGen/ARM/GlobalISel/arm-isel.ll when expensive checks are enabled.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Subscribers: fhahn, kristof.beyls, igorb, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02 11:03:36 +00:00
Reid Kleckner
c39935fb15 [lit] Avoid copying llvm/utils/lit/tests/Inputs with lit site configs
Summary:
This is an alternative solution to running the lit test suite on bots
without polluting the source directory. Each input test suite gets an
auto-generated site config in the build directory that points back to
the test input source directory.

This adds some cmake comlexity, but now we don't need to remove and
re-copy the test input directory before every test.

Reviewers: delcypher, modocache

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309602 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31 18:45:44 +00:00
Don Hinton
842110c5bc [docker] Fix unmatched quote problem in here-document on older versions of bash
Summary:
When outputing usage, emit here-document directly instead of
saving in a variable first -- avoids problem with bash 3.2.57 where an
unmatched ' in the here-document results in the following error:

./build_docker_image.sh: line 135: unexpected EOF while looking for matching `''

bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309568 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-31 15:18:57 +00:00
Lama Saba
b7014e37ac NFC: spell correction.
On behalf of jbhateja

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309521 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30 20:12:17 +00:00