150488 Commits

Author SHA1 Message Date
Davide Italiano
089beaa07c [SCCP] Clarify a comment about unhandled instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305579 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 20:27:17 +00:00
Wei Mi
abc4fc5ad2 [GVN] Recommit the patch "Add phi-translate support in scalarpre".
The recommit fixes two bugs: The first one is to use CurrentBlock instead of
PREInstr's Parent as param of performScalarPREInsertion because the Parent
of a clone instruction may be uninitialized. The second one is stop PRE when
CurrentBlock to its predecessor is a backedge and an operand of CurInst is
defined inside of CurrentBlock. The same value defined inside of loop in last
iteration can not be regarded as available.

Right now scalarpre doesn't have phi-translate support, so it will miss some
simple pre opportunities. Like the following testcase, current scalarpre cannot
recognize the last "a * b" is fully redundent because a and b used by the last
"a * b" expr are both defined by phis.

long a[100], b[100], g1, g2, g3;
__attribute__((pure)) long goo();

void foo(long a, long b, long c, long d) {

  g1 = a * b;
  if (__builtin_expect(g2 > 3, 0)) {
    a = c;
    b = d;
    g2 = a * b;
  }
  g3 = a * b;      // fully redundant.

}
The patch adds phi-translate support in scalarpre. This is only a temporary
solution before the newpre based on newgvn is available.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305578 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 20:21:01 +00:00
Davide Italiano
6c8d710b32 [SCCP] Remove redundant instruction visitors.
Whenever we don't know what to do with an instruction, we send
it to overdefined anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 19:43:57 +00:00
Spyridoula Gravani
4a2fcf3b58 [DWARF] Replaced mem-initializers with non-static data member initializers in DWARFVerifier class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305570 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 18:55:01 +00:00
Matthias Braun
bd1a266898 Revert "RegScavenging: Add scavengeRegisterBackwards()"
Revert because of reports of some PPC input starting to spill when it
was predicted that it wouldn't and no spillslot was reserved.

This reverts commit r305516.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305566 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 17:48:08 +00:00
Xinliang David Li
17473f556e Fix function name /NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305564 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 16:54:13 +00:00
Craig Topper
998d866d47 [InstCombine] Add test cases to show missed opportunities due to overly conservative single use checks. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305562 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 16:44:36 +00:00
Yonghong Song
1aa4ba7ed9 bpf: avoid load from read-only sections
If users tried to have a structure decl/init code like below
   struct test_t t = { .memeber1 = 45 };
It is very likely that compiler will generate a readonly section
to hold up the init values for variable t. Later load of t members,
e.g., t.member1 will result in a read from readonly section.

BPF program cannot handle relocation. This will force users to
write:
  struct test_t t = {};
  t.member1 = 45;
This is just inconvenient and unintuitive.

This patch addresses this issue by implementing BPF PreprocessISelDAG.
For any load from a global constant structure or an global array of
constant struct, it attempts to
translate it into a constant directly. The traversal of the
constant struct and other constant data structures are similar
to where the assembler emits read-only sections.

Four different unit test cases are also added to cover
different scenarios.

Signed-off-by: Yonghong Song <yhs@fb.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305560 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 15:41:16 +00:00
Yonghong Song
211587773d bpf: set missing types in insn tablegen file
o This is discovered during my study of 32-bit subregister
  support.
o This is no impact on current functionality since we
  only support 64-bit registers.
o Searching the web, looks like the issue has been discovered
  before, so fix it now.

Signed-off-by: Yonghong Song <yhs@fb.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305559 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 15:30:55 +00:00
Daniel Neilson
470c6959b7 [Atomics] Rename and change prototype for atomic memcpy intrinsic
Summary:

Background: http://lists.llvm.org/pipermail/llvm-dev/2017-May/112779.html

This change is to alter the prototype for the atomic memcpy intrinsic. The prototype itself is being changed to more closely resemble the semantics and parameters of the llvm.memcpy intrinsic -- to ease later combination of the llvm.memcpy and atomic memcpy intrinsics. Furthermore, the name of the atomic memcpy intrinsic is being changed to make it clear that it is not a generic atomic memcpy, but specifically a memcpy is unordered atomic.

Reviewers: reames, sanjoy, efriedma

Reviewed By: reames

Subscribers: mzolotukhin, anna, llvm-commits, skatkov

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305558 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 14:43:59 +00:00
Simon Dardis
7810ae7481 Revert "[mips][microMIPS] Extending size reduction pass with ADDIUSP and ADDIUR1SP"
This reverts commit r305455. This commit was reported as breaking one of
the sanitizer buildbots. Reverting until lab.llvm.org comes back online.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305557 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 14:00:33 +00:00
Krzysztof Parzyszek
773e19ab52 [TableGen] Do not assume that the first variant is the original pattern
The variant generation for commutative/associative patterns would simply
delete the first output from the list assuming that it was identical to
the original pattern. This does not have to be the case, and a legitimate
variant could actually be removed that way. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305556 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 13:44:34 +00:00
Krzysztof Parzyszek
c86dcc6411 [Hexagon] Don't kill live registers when creating mux out of tfr
The second part of r305300: when placing the mux at the later location,
make sure that it won't use any register that was killed between the
two original instructions. Remove any such kills and transfer them to
the mux.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305553 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 12:24:03 +00:00
Hiroshi Inoue
0a8e89663b [MachineBlockPlacement] trivial fix in comments, NFC
- Topologocal is abbreviated as "topo" in comments, but "top" is used in only one comment. Modify it for consistency.
- Capitalize "succ" and "pred" for consistency in one figure.
- Other trivial fixes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305552 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 12:23:04 +00:00
Craig Topper
091e96c54f [InstCombine] Fold (!iszero(A & K1) & !iszero(A & K2)) -> (A & (K1 | K2)) == (K1 | K2) if K1 and K2 are a 1-bit mask
Summary: This is the demorganed version of the case we already handle for the OR of iszero.

Reviewers: spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305548 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 05:10:37 +00:00
Rui Ueyama
9a18969a66 Fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305542 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 02:42:33 +00:00
Rui Ueyama
04c012651f Fix msan buildbot.
This patch should fix sanitizer-x86_64-linux-fast bot.

The problem was that the contents of this stream are aligned to 4 byte,
and the paddings were created just by incrementing `Offset`, so paddings
had undefined values. When the entire stream is written to an output,
it triggered msan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305541 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 02:17:35 +00:00
Craig Topper
27c1aa03a6 [CorrelatedValuePropagation] Remove superfluous semicolon. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305538 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 01:53:20 +00:00
Eugene Zelenko
1d475d81f9 [BinaryFormat, Option, TableGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305537 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 00:43:26 +00:00
Evgeniy Stepanov
1410aba438 Fix build warning on 32-bit targets where sizeof(size_t) < sizeof(long long).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305535 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 00:32:11 +00:00
Evgeniy Stepanov
3184f8d7bb [cfi] CFI-ICall for ThinLTO.
Implement ControlFlowIntegrity for indirect function calls in ThinLTO.
Design follows the RFC in llvm-dev, see
https://groups.google.com/d/msg/llvm-dev/MgUlaphu4Qc/kywu0AqjAQAJ

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305533 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 00:18:29 +00:00
Zachary Turner
68e216b09a [llvm-pdbutil] Add support for dumping cross module imports/exports.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 00:04:24 +00:00
Zachary Turner
f391f226bc [llvm-pdbutil] Add a function for iterating over debug subsections.
NFC, just adds a helper function to reduce boilerplate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305531 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:59:56 +00:00
Xinliang David Li
9b112a7654 [PartialInlining] Code Refactoring
This is a NFC code refactoring and interface cleanup. This paves the
way to enable outlining-only mode for the partial inliner.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305530 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:56:59 +00:00
Zachary Turner
7b1eb002e9 [llvm-pdbutil] Add support for dumping lines and inlinee lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305529 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:56:19 +00:00
Zachary Turner
ae75a98ae9 Try to fix uninitialized read reported by msan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305528 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:44:19 +00:00
Ahmed Bougacha
8a6e29803a Revert "[DAG] Allow truncated and extend memory operations in Store Merge. NFCI."
This reverts commit r305468, as it caused PR33475.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305527 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:29:47 +00:00
Zachary Turner
e6f0d3c25c [llvm-pdbutil] Add back support for dumping file checksums.
When dumping module source files, also dump checksums.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305526 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:12:41 +00:00
Tom Stellard
aa27e87c45 test-release.sh: Run the test-suite using phase3 clang
Summary: We were using the system compiler to run the test suite.

Reviewers: hansw

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305525 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:05:21 +00:00
Zachary Turner
4d56b5f5fd [llvm-pdbutil] Add back the ability to dump hashes and index offsets.
This was regressed in a previous patch that re-wrote the dumper,
and I'm incrementally adding back the pieces that are missing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305524 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:04:42 +00:00
Alfred Huang
975d465bad [AMDGPU] Testing commit access only, no real change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305523 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 23:02:55 +00:00
Matthias Braun
dcb4305b6f UnitTests: Followup to 305519
We have to use ASSERT_XXX instead of EXPECT_XXX if the test cannot
continue in the failure case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305522 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 22:50:57 +00:00
Kostya Serebryany
93a987eb3e [libFuzzer] change the default max_len from 64 to 4096. This will affect cases where libFuzzer is run w/o initial corpus or with a corpus of very small items.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305521 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 22:43:40 +00:00
Matthias Braun
9b53419507 UnitTests: Replace some if(x)report_fatal_error() with EXPECT_TRUE(!x)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305519 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 22:31:08 +00:00
Zachary Turner
7e5d31edd7 Resubmit "[llvm-pdbutil] rewrite the "raw" output style."
This resubmits commit c0c249e9f2ef83e1d1e5f166b50673d92f3579d7.

It was broken due to some weird template issues, which have
since been fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305517 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 22:24:24 +00:00
Matthias Braun
02688b00ef RegScavenging: Add scavengeRegisterBackwards()
Re-apply r276044/r279124. Trying to reproduce or disprove the ppc64
problems reported in the stage2 build last time, which I cannot
reproduce right now.

This is a variant of scavengeRegister() that works for
enterBasicBlockEnd()/backward(). The benefit of the backward mode is
that it is not affected by incomplete kill flags.

This patch also changes
PrologEpilogInserter::doScavengeFrameVirtualRegs() to use the register
scavenger in backwards mode.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305516 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 22:14:55 +00:00
Matthias Braun
c82adde7b9 docs/Phabricator: Better git examples to produce full context patches
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305515 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 22:09:30 +00:00
Craig Topper
240b649837 [InstCombine] Add two FIXMEs for bad single use checks. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305510 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 21:38:48 +00:00
Craig Topper
66f76f7576 [InstCombine] Add test cases to demonstrate instcombine increasing instruction count when trying to fold (select (icmp eq (and X, C1), 0), Y, (or Y, C2))->(or (shl (and X, C1), C3), y) when the pieces have multiple uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305509 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 21:38:44 +00:00
Galina Kistanova
7438bc918d Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305506 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 21:00:40 +00:00
Zachary Turner
48370ee21f Revert "[llvm-pdbutil] rewrite the "raw" output style."
This reverts commit 83ea17ebf2106859a51fbc2a86031b44d33696ad.

This is failing due to some strange template problems, so reverting
until it can be straightened out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 20:55:51 +00:00
Spyridoula Gravani
312d0db061 [DWARF] Removed dead code. The verifier functionality is provided by
the DWARFVerifier class (as it should).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305503 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 20:40:08 +00:00
Teresa Johnson
93981f885e Split PGO memory intrinsic optimization into its own source file
Summary:
Split the PGOMemOPSizeOpt pass out from IndirectCallPromotion.cpp into
its own file.

Reviewers: davidxl

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305501 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 20:23:57 +00:00
Zachary Turner
cc81e8dc82 Fix some more warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 20:03:57 +00:00
Zachary Turner
1031e14fb0 Fix some -Wreorder issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305497 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 19:45:25 +00:00
Zachary Turner
0f6dce0526 [llvm-pdbutil] rewrite the "raw" output style.
After some internal discussions, we agreed that the raw output style had
outlived its usefulness. It was originally created before we had even
thought of dumping to YAML, and it was intended to give us some insight
into the internals of a PDB file. Now we have YAML mode which does
almost exactly this but is more powerful in that it can round-trip back
to a PDB, which the raw mode could not do. So the raw mode had become
purely a maintenance burden.

One option was to just delete it. However, its original goal was to be
as readable as possible while staying close to the "metal" - i.e.
presenting the output in a way that maps directly to the underlying file
format. We don't actually need that last requirement anymore since it's
covered by the yaml mode, so we could repurpose "raw" mode to actually
just be as readable as possible.

This patch implements about 80% of the functionality previously in raw
mode, but in a completely different style that is more akin to what
cvdump outputs. Records are very compressed, often times appearing on
just one line. One nice thing about this is that it makes full record
matching easier, because you can grep for indices, names, and leaf types
on a single line often.

See the tests for some examples of what the new output looks like.

Note that this patch actually regresses the functionality of raw mode in
a few areas, but only because the patch was already unreasonably large
and going 100% would have been even worse. Specifically, this patch is
missing:

The ability to dump module debug subsections (checksums, lines, etc)
The ability to dump section headers
Aside from that everything is here. While goign through the tests fixing
them all up, I found many duplicate tests. They've been deleted. In
subsequent patches I will go through and re-add the missing
functionality.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305495 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 19:34:41 +00:00
Alexander Timofeev
7807f69e9b DivergencyAnalysis patch for review
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305494 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 19:33:10 +00:00
Craig Topper
f82d26a17d [InstCombine] Make the context instruction parameter of foldOrOfICmps a reference to discourage passing nullptr and to remove the '&' from all of the call sites. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305493 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 19:09:51 +00:00
Craig Topper
ccc684d065 [InstCombine] Pre-commit test cases for the transform proposed in D34244.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305492 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 18:56:05 +00:00
Lei Huang
edd54f82b6 [MachineLICM] Hoist TOC-based address instructions
Add condition for MachineLICM to safely hoist instructions that utilize
non constant registers that are reserved.

On PPC, global variable access is done through the table of contents (TOC)
which is always in register X2.  The ABI reserves this register in any
functions that have calls or access global variables.

A call through a function pointer involves saving, changing and restoring
this register around the call and thus MachineLICM does not consider it to
be invariant. We can however guarantee the register is preserved across the
call and thus is invariant.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15 18:29:59 +00:00