1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
Commit Graph

5869 Commits

Author SHA1 Message Date
Krzysztof Parzyszek
ca42fcdaff [TableGen] Ensure proper ordering of subtarget feature names
Recommit r297039 without the testcase. The MIR testcase did not work
well with MC code emitter.

llvm-svn: 297080
2017-03-06 21:26:49 +00:00
Krzysztof Parzyszek
f1dd05bcae Revert r297039, it's causing some mysterious buildbot failures
llvm-svn: 297062
2017-03-06 20:24:21 +00:00
Adam Nemet
056c20b496 [opt-diff] Fix the case when the script is invoked with directories
llvm-svn: 297055
2017-03-06 19:15:22 +00:00
Krzysztof Parzyszek
34717b9d7f [TableGen] Ensure proper ordering of subtarget feature names
llvm-svn: 297039
2017-03-06 18:08:37 +00:00
Daniel Berlin
33909a77e0 Fix bug in bisect-skip-count not using passed-in arguments
llvm-svn: 296961
2017-03-04 03:23:41 +00:00
Zachary Turner
394896e64a Teach lit to expand glob expressions.
This will enable removing hacks throughout the codebase
in clang and compiler-rt that feed multiple inputs to a
testing utility by globbing, all of which are either disabled
on Windows currently or using xargs / find hacks.

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

llvm-svn: 296904
2017-03-03 18:55:24 +00:00
Adam Nemet
0da430395a New tool: opt-diff.py
This tool allows generating the different between two optimization record
files.  The result is a YAML file too that can be visualized with opt-viewer.

This is very useful to see what optimization were added and removed by a
change.

llvm-svn: 296767
2017-03-02 17:00:59 +00:00
Adam Nemet
9ca7072392 [opt-viewer] Treat remarks with different attributes as different
We used to exclude arguments but for a diffed YAML file, it's interesting to
show these as changes.

Turns out this also affects gvn/LoadClobbered because we used to squash
multiple entries of this on the same line even if they reported clobbers
by *different* instructions.  This increases the number of unique entries now
and the share of gvn/LoadClobbered.

Total number of remarks      902287

Top 10 remarks by pass:
  inline                         43%
  gvn                            37%
  licm                           11%
  loop-vectorize                  4%
  asm-printer                     3%
  regalloc                        1%
  loop-unroll                     1%
  inline-cost                     0%
  slp-vectorizer                  0%
  loop-delete                     0%

Top 10 remarks:
  gvn/LoadClobbered              33%
  inline/Inlined                 16%
  inline/CanBeInlined            14%
  inline/NoDefinition             7%
  licm/Hoisted                    6%
  licm/LoadWithLoopInvariantAddressInvalidated  5%
  gvn/LoadElim                    3%
  asm-printer/InstructionCount    3%
  inline/TooCostly                2%
  loop-vectorize/MissedDetails    2%

llvm-svn: 296766
2017-03-02 17:00:56 +00:00
Adam Nemet
10d70eff47 [opt-viewer] Don't use __getattr__ for missing YAML attributes
__getattr__ does not work well with debugging.  If the attribute function has
a run-time error, a missing attribute is reported instead.

llvm-svn: 296765
2017-03-02 17:00:53 +00:00
Adam Nemet
80e9af88fe [opt-viewer] Sort entries with identical hotness by source line
We want entries that are close to each other in the source appear next to each
other.

llvm-svn: 296764
2017-03-02 17:00:49 +00:00
Adam Nemet
6702f17f53 New tool: opt-stats.py
I am planning to use this tool to find too noisy (missed) optimization
remarks.  Long term it may actually be better to just have another tool that
exports the remarks into an sqlite database and perform queries like this in
SQL.

This splits out the YAML parsing from opt-viewer.py into a new Python module
optrecord.py.

This is the result of the script on the LLVM testsuite:

Total number of remarks        714433

Top 10 remarks by pass:
  inline                         52%
  gvn                            24%
  licm                           13%
  loop-vectorize                  5%
  asm-printer                     3%
  loop-unroll                     1%
  regalloc                        1%
  inline-cost                     0%
  slp-vectorizer                  0%
  loop-delete                     0%

Top 10 remarks:
  gvn/LoadClobbered              20%
  inline/Inlined                 19%
  inline/CanBeInlined            18%
  inline/NoDefinition             9%
  licm/LoadWithLoopInvariantAddressInvalidated  6%
  licm/Hoisted                    6%
  asm-printer/InstructionCount    3%
  inline/TooCostly                3%
  gvn/LoadElim                    3%
  loop-vectorize/MissedDetails    2%

Beside some refactoring, I also changed optrecords not to use context to
access global data (max_hotness).  Because of the separate module this would
have required splitting context into two.  However it's not possible to access
the optrecord context from the SourceFileRenderer when calling back to
Remark.RelativeHotness.

llvm-svn: 296682
2017-03-01 21:35:00 +00:00
Adam Nemet
7a4ea683e9 [opt-viewer] Suggest installing the faster parser (libYAML)
llvm-svn: 296553
2017-03-01 00:54:40 +00:00
Adam Nemet
124ee267f6 [opt-viewer] Handle column number 0
The asm-printer now emits remarks with function location which have
unspecified (0) source column number.

llvm-svn: 296547
2017-02-28 23:59:46 +00:00
Daniel Berlin
a5b1489dbe This script was meant to be committed with the DebugCounter changes.
llvm-svn: 296425
2017-02-28 02:19:11 +00:00
Sanjay Patel
26ce1715ae [utils] allow auto-generation of checks for thumb triples
If there's some reason not to do this, feel free to revert and/or fix, but
for the cases I'm looking at, the script appears to do fine for these targets.

llvm-svn: 296181
2017-02-24 21:47:44 +00:00
Simon Pilgrim
cbb7f7f641 Fixed IntOperandMatcher::emitCxxPredicateExpr arguments
Extra const in the StringRef argument meant that MSVC complained about it not correctly overriding from OperandPredicateMatcher::emitCxxPredicateExpr (which didn't have the const)

llvm-svn: 296138
2017-02-24 17:20:27 +00:00
Daniel Sanders
68fde537e1 [globalisel] Decouple src pattern operands from dst pattern operands.
Summary:
This isn't testable for AArch64 by itself so this patch also adds
support for constant immediates in the pattern and physical
register uses in the result.

The new IntOperandMatcher matches the constant in patterns such as
'(set $rd:GPR32, (G_XOR $rs:GPR32, -1))'. It's always safe to fold
immediates into an instruction so this is the first rule that will match
across multiple BB's.

The Renderer hierarchy is responsible for adding operands to the result
instruction. Renderers can copy operands (CopyRenderer) or add physical
registers (in particular %wzr and %xzr) to the result instruction
in any order (OperandMatchers now import the operand names from
SelectionDAG to allow renderers to access any operand). This allows us to
emit the result instruction for:
  %1 = G_XOR %0, -1 --> %1 = ORNWrr %wzr, %0
  %1 = G_XOR -1, %0 --> %1 = ORNWrr %wzr, %0
although the latter is untested since the matcher/importer has not been
taught about commutativity yet.

Added BuildMIAction which can build new instructions and mutate them where
possible. W.r.t the mutation aspect, MatchActions are now told the name of
an instruction they can recycle and BuildMIAction will emit mutation code
when the renderers are appropriate. They are appropriate when all operands
are rendered using CopyRenderer and the indices are the same as the matcher.
This currently assumes that all operands have at least one matcher.

Finally, this change also fixes a crash in
AArch64InstructionSelector::select() caused by an immediate operand
passing isImm() rather than isCImm(). This was uncovered by the other
changes and was detected by existing tests.

Depends on D29711

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

Reviewed By: rovka

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

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

llvm-svn: 296131
2017-02-24 15:43:30 +00:00
Daniel Sanders
9facf34333 Fix missing call to base class constructor in r296121.
The 'Kind' member used in RTTI for InstructionPredicateMatcher was not
initialized but went undetected since I always ended up with the correct value.

llvm-svn: 296126
2017-02-24 14:53:35 +00:00
Daniel Sanders
c7b4b479ed [globalisel] Sort RuleMatchers by priority.
Summary:
This makes more important rules have priority over less important rules.
For example, '%a = G_ADD $b:s64, $c:s64' has priority over
'%a = G_ADD $b:s32, $c:s32'. Previously these rules were emitted in the
correct order by chance.

NFC in this patch but it is required to make the next patch work correctly.

Depends on D29710

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

Reviewed By: ab, rovka

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

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

llvm-svn: 296121
2017-02-24 13:58:11 +00:00
Eli Friedman
ae591c71b4 Add some testcases for bitfields with illegal widths.
clang will generate IR like this for input using packed bitfields;
very simple semantically, but it's a bit tricky to actually
generate good code.

llvm-svn: 296080
2017-02-24 03:04:11 +00:00
Pavel Labath
4666520529 tablegen: Fix android build
use llvm::to_string instead of std:: version.

llvm-svn: 295711
2017-02-21 09:19:41 +00:00
Sanjoy Das
4dceaf597f Add a wrapper around copy_if in STLExtras; NFC
I will add one more use for this in a later change.

llvm-svn: 295685
2017-02-21 00:38:44 +00:00
Daniel Sanders
edd7201c9d [globalisel] OperandPredicateMatcher's shouldn't need to generate the MachineOperand expr. NFC
Summary:
Each OperandPredicateMatcher shouldn't need to know how to generate the expression
to reference a MachineOperand. The OperandMatcher should provide it.

In addition to separating responsibilities, this also lays some groundwork for
decoupling source patterns from destination patterns to allow invented operands
or operands provided by GlobalISel's equivalent to the ComplexPattern<> class.

Depends on D29709

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

Reviewed By: ab

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

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

llvm-svn: 295668
2017-02-20 15:30:43 +00:00
Daniel Sanders
7be2370666 [globalisel] Separate the SelectionDAG importer from the emitter. NFC
Summary:
In the near future the rules will be sorted between these two steps to
ensure that more important rules are not prevented by less important ones.

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

Reviewed By: ab

Subscribers: dberris, kristof.beyls, llvm-commits

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

llvm-svn: 295661
2017-02-20 14:31:27 +00:00
Ayman Musa
1b508961ee [X86][AVX] Extend hasVEX_WPrefix bit to accept WIG value (W Ignore) + update all AVX instructions with the new value.
Add WIG value to all of AVX instructions which ignore the W-bit in their encoding, instead of giving them the default value of 0.
This patch is needed for a follow up work on EVEX2VEX pass (replacing EVEX encoded instructions with their corresponding VEX version when possible).

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

llvm-svn: 295643
2017-02-20 08:27:54 +00:00
Craig Topper
93ddfca815 [TableGen] Make sure EnforceSameSize populates the type sets if necessary.
This was found by another commit I'm working on.

llvm-svn: 295578
2017-02-18 22:53:38 +00:00
Brian Cain
703593abca opt-viewer: Fix syntax highlighting
Syntax highlighting has been done line-at-a-time. Done this way, the lexer
resets the context at each line, distorting the formatting.

This change will render the whole file at once and feed the highlighted text
line-at-a-time to be wrapped by the SourceFileRenderer.

Leading/trailing newlines were being ignored by Pygments but since each line
was rendered in its own row, it didn't matter. This bug was masked by the
line-at-a-time algorithm. So now we need to add "stripnl=False" to the 
CppLexer to change its behavior to match the expectation.

llvm-svn: 295546
2017-02-18 15:13:58 +00:00
Aditya Nandakumar
b5cce55dd5 [Tablegen] Instrumenting table gen DAGGenISelDAG
To help assist in debugging ISEL or to prioritize GlobalISel backend
work, this patch adds two more tables to <Target>GenISelDAGISel.inc -
one which contains the patterns that are used during selection and the
other containing include source location of the patterns
Enabled through CMake varialbe LLVM_ENABLE_DAGISEL_COV

llvm-svn: 295081
2017-02-14 18:32:41 +00:00
Adam Nemet
72bbc3337e [opt-viewer] For single-process, fall back on map instead of Pool.map
This allows for nicer backtrace and debugging when -j1 is passed:

  $ opt-viewer.py CMakeFiles/LLVMScalarOpts.dir/LoopVersioningLICM.cpp.opt.yaml html
  Traceback (most recent call last):
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 405, in <module>
      generate_report(pmap, all_remarks, file_remarks, args.source_dir, args.output_dir)
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 362, in generate_report
      pmap(_render_file_bound, file_remarks.items())
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 251, in map
      return self.map_async(func, iterable, chunksize).get()
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 567, in get
      raise self._value
  Exception: blah

  $ opt-viewer.py -j 1 CMakeFiles/LLVMScalarOpts.dir/LoopVersioningLICM.cpp.opt.yaml html
  Traceback (most recent call last):
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 405, in <module>
      generate_report(pmap, all_remarks, file_remarks, args.source_dir, args.output_dir)
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 362, in generate_report
      pmap(_render_file_bound, file_remarks.items())
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 317, in _render_file
      SourceFileRenderer(source_dir, output_dir, filename).render(remarks)
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 168, in __init__
      raise Exception("blah")
  Exception: blah

llvm-svn: 295080
2017-02-14 18:18:58 +00:00
Saleem Abdulrasool
7641b1278e vim: add returned keyword
The `returned` keyword was added in SVN r179925.  Update the vim syntax
rules.

llvm-svn: 294808
2017-02-10 23:57:11 +00:00
Adam Nemet
105c1f8b7f opt-viewer: fix HtmlFormatter encoding
Summary: Small fix to HtmlFormatter, defaults to ascii encoding, so utf-8 output may get `UnicodeEncodeError: 'ascii' codec can't encode character ... ordinal not in range(128)` during write.

Patch by Brian Cain!

Reviewers: anemet, fhahn

Reviewed By: anemet

Subscribers: llvm-commits

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

llvm-svn: 294710
2017-02-10 04:50:18 +00:00
Ahmed Bougacha
aba6cb82df [GlobalISel] Return an Expected<RuleMatcher> for each SDAG pattern. NFC.
Instead of emitting the matcher code directly, return the rule matcher
and the skip reason as an Expected<RuleMatcher>.

This will let us record all matchers and process them before emission.

It's a somewhat unconventional use of Error, but it's nicer than, say,
std::pair, because of the bool conversions.

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

llvm-svn: 294706
2017-02-10 04:00:17 +00:00
Quentin Colombet
279d883daa [TableGen][AsmWriterEmitter] Use a deterministic order to sort InstrAliases
Inside an alias group, when ordering instruction aliases, we rely
on the priority field to sort them.
When the priority is not set or more generally when there is a tie between
two aliases, we used to rely on the lexicographic order. However, this
order can change for the anonymous records when more instruction, intrinsic,
etc. are inserted.

For instance, given two anonymous records r1 and r2 with respective name
A_999 and A_1000, their lexicography order will be r2 then r1. Now, if
an instruction is added before them, their name will become respectively
A_1000 and A_1001, thus the lexicography order will be r1 then r2, i.e.,
it changed.

If that happens in an alias group, the assembly output would prefer a
different alias for no apparent good reasons.

A way to fix that is to use proper priority for all aliases, but we
can also make the tie breaker comparison smarter and use a deterministic
ordering. This is what this patch does.

llvm-svn: 294695
2017-02-10 02:43:09 +00:00
Eric Fiselier
db10580e9b [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.

llvm-svn: 294690
2017-02-10 01:59:20 +00:00
Vedant Kumar
7e6d9e2797 [utils] coverage: Add help text about the --restrict flag (NFC)
Passing the --restrict flag to the coverage prep script before other
positional arguments is wrong, because it prevents the argparse module
from telling apart arguments to --restrict versus positional arguments.

Pointed out by Sean Callanan!

llvm-svn: 294616
2017-02-09 19:37:18 +00:00
Ahmed Bougacha
f68160ea2c [GlobalISel] Simplify StringRef parameters. NFC.
'const' on StringRef parameters adds no guarantees. Remove it.

llvm-svn: 294555
2017-02-09 02:50:01 +00:00
Amara Emerson
f2bc921f98 Revert r294437 as it broke an asan buildbot.
llvm-svn: 294523
2017-02-08 21:41:16 +00:00
Hans Wennborg
92fdc04010 build_llvm_package.bat: Build teh clang-format plugin separately
In r293373 we switched the build to linking dynamically against the
Universal CRT and include the redistributables in the installer.

However, clang-format.exe is copied into the vsix and needs to be
statically linked. This commit makes us build the plugin in a separate
step that uses static linking.

llvm-svn: 294513
2017-02-08 20:58:33 +00:00
Amara Emerson
1aff3665bd [AArch64][TableGen] Skip tied result operands for InstAlias
This patch checks the number of operands in the resulting
instruction instead of just the alias, then skips over
tied operands when generating the printing method.

This allows us to generate the preferred assembly syntax
for the AArch64 'ins' instruction, which should always be
displayed as 'mov' according to the ARMARM.

Several unit tests have changed as a result, but only to
reflect the preferred disassembly.

Some other InstAlias patterns (movk/bic/orr) needed a
slight adjustment to stop them becoming the default
and breaking other unit tests.

Patch by Graham Hunter.

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

llvm-svn: 294437
2017-02-08 11:28:08 +00:00
Craig Topper
4d5a27ef2a Move mnemonicIsValid to Mips target.
Summary:
The Mips target is the only user of mnemonicIsValid. This patch
moves this method from AsmMatcherEmitter.cpp to MipsAsmParser.cpp,
getting rid of the method in all other targets where it generated
warnings about an unused function.

Patch by Gonsolo.

Reviewers: craig.topper

Reviewed By: craig.topper

Subscribers: sdardis

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

llvm-svn: 294400
2017-02-08 02:54:12 +00:00
Jon Chesterfield
b7704a045e [TableGen] Use less stack in DAGISelMatcherOpt
Refactor a helper function, FactorNodes, to search for a push node in constant space. This resolves a problem in a not-yet-upstreamed backend where a recursive pattern blew the call stack (at a depth of 255) under a debug build of tablegen. No functional change so no new test coverage. The change is minimal to avoid disturbing existing behaviour.

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

llvm-svn: 294230
2017-02-06 19:41:44 +00:00
Dimitry Andric
b3b4315a84 Add lld to the test-release.sh script
Building lld is enabled by default, but it can be disabled using the
-no-lld option.

Reviewers: tstellarAMD, rengolin, hans

Reviewed By: hans

Subscribers: grosser, wdng, emaste, llvm-commits

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

llvm-svn: 294102
2017-02-04 22:24:55 +00:00
Ahmed Bougacha
3bb4549a53 [GlobalISel] Add a few comments to the tablegen backend. NFC.
Based on a review of D29478 by Kristof Beyls.

llvm-svn: 294077
2017-02-04 00:47:10 +00:00
Ahmed Bougacha
9ffc857132 [GlobalISel] Print the matched patterns using an action.
This lets us split out PatternToMatch from the top-level RuleMatcher,
where it doesn't really belong.  That, in turn, lets us eventually
generate RuleMatchers from non-SelectionDAG sources.

llvm-svn: 294076
2017-02-04 00:47:08 +00:00
Ahmed Bougacha
f3d2d6fcd4 [GlobalISel] Separate matchers with newlines in emitted selector. NFC.
We don't try very hard to format the emitted code, but newlines
are an easy way to make it more readable.

llvm-svn: 294074
2017-02-04 00:47:02 +00:00
Daniel Sanders
2af2b18cba [globalisel] Fix missing break.
The instruction selector has been emitting the register bank information too.

llvm-svn: 294007
2017-02-03 14:18:35 +00:00
Adam Nemet
f2820def91 [opt-viewer] HTML-escape function names
llvm-svn: 293869
2017-02-02 05:49:02 +00:00
Adam Nemet
d7b037ff30 [opt-viewer] Alternating row background colors on index page
llvm-svn: 293868
2017-02-02 05:49:00 +00:00
Daniel Sanders
b76f1fbc59 [globalisel] Make the MatchAction hierarchy consistent with the matchers. NFC.
Reviewers: aditya_nandakumar, rovka, t.p.northover, qcolombet, ab

Subscribers: dberris, llvm-commits, kristof.beyls

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

llvm-svn: 293760
2017-02-01 10:53:10 +00:00
Dan Gohman
754743ea64 [Utils] Update comment in vimrc
Fixed wrong paths in comments for *.vim files.

Patch By: Bruno Rosa (brunoalr)

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

llvm-svn: 293693
2017-01-31 21:33:21 +00:00