platform/upstream/llvm.git
7 years agoAMDGPU: Fix amdgpu-flat-work-group-size/amdgpu-waves-per-eu check
Konstantin Zhuravlyov [Sun, 16 Jul 2017 19:38:47 +0000 (19:38 +0000)]
AMDGPU: Fix amdgpu-flat-work-group-size/amdgpu-waves-per-eu check

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

llvm-svn: 308147

7 years ago[X86][AVX512] Add 512-bit vector rotate tests
Simon Pilgrim [Sun, 16 Jul 2017 19:26:49 +0000 (19:26 +0000)]
[X86][AVX512] Add 512-bit vector rotate tests

llvm-svn: 308146

7 years agoAMDGPU: Remove duplicate print outs from .AMDGPU.csdata
Konstantin Zhuravlyov [Sun, 16 Jul 2017 19:24:08 +0000 (19:24 +0000)]
AMDGPU: Remove duplicate print outs from .AMDGPU.csdata

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

llvm-svn: 308145

7 years ago[InstCombine] Don't violate dominance when replacing instructions.
Davide Italiano [Sun, 16 Jul 2017 18:56:30 +0000 (18:56 +0000)]
[InstCombine] Don't violate dominance when replacing instructions.

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

llvm-svn: 308144

7 years agoStrip trailing whitespace. NFCI
Simon Pilgrim [Sun, 16 Jul 2017 18:37:23 +0000 (18:37 +0000)]
Strip trailing whitespace. NFCI

llvm-svn: 308143

7 years ago[X86] X86::CMOV to Branch heuristic based optimization.
Amjad Aboud [Sun, 16 Jul 2017 17:39:56 +0000 (17:39 +0000)]
[X86] X86::CMOV to Branch heuristic based optimization.

LLVM compiler recognizes opportunities to transform a branch into IR select instruction(s) - later it will be lowered into X86::CMOV instruction, assuming no other optimization eliminated the SelectInst.
However, it is not always profitable to emit X86::CMOV instruction. For example, branch is preferable over an X86::CMOV instruction when:
1. Branch is well predicted
2. Condition operand is expensive, compared to True-value and the False-value operands

In CodeGenPrepare pass there is a shallow optimization that tries to convert SelectInst into branch, but it is not enough.
This commit, implements machine optimization pass that converts X86::CMOV instruction(s) into branch, based on a conservative heuristic.

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

llvm-svn: 308142

7 years agoApply explicit instantiation workaround to DominanceFrontier
Jakub Kuderski [Sun, 16 Jul 2017 17:29:19 +0000 (17:29 +0000)]
Apply explicit instantiation workaround to DominanceFrontier

This is a workaround for the same explicit instantiation bug
as in DominatorTreeBase.

llvm-svn: 308141

7 years ago[Dominators] Workaround explicit instantiation bug.
Jakub Kuderski [Sun, 16 Jul 2017 17:01:40 +0000 (17:01 +0000)]
[Dominators] Workaround explicit instantiation bug.

Some platforms have problems with emmiting constructors when class
templates get explicitly instantiated.
This patch fixes the bug reported in D35315 by replacing `= default`
with an empty constructor body.

llvm-svn: 308140

7 years ago[Bash-autocompletion] Add support for -W<warning> and -Wno<warning>
Yuka Takahashi [Sun, 16 Jul 2017 15:07:20 +0000 (15:07 +0000)]
[Bash-autocompletion] Add support for -W<warning> and -Wno<warning>

Summary:
`-W[tab]` will autocomplete warnings defined in this link:
https://clang.llvm.org/docs/DiagnosticsReference.html#wweak-vtables

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

llvm-svn: 308139

7 years ago[X86] Add F16C scheduling tests
Simon Pilgrim [Sun, 16 Jul 2017 14:34:18 +0000 (14:34 +0000)]
[X86] Add F16C scheduling tests

llvm-svn: 308138

7 years ago[X86] Add POPCNT scheduling tests
Simon Pilgrim [Sun, 16 Jul 2017 14:22:39 +0000 (14:22 +0000)]
[X86] Add POPCNT scheduling tests

llvm-svn: 308137

7 years ago[X86] Add BMI2 scheduling tests
Simon Pilgrim [Sun, 16 Jul 2017 14:09:15 +0000 (14:09 +0000)]
[X86] Add BMI2 scheduling tests

llvm-svn: 308136

7 years ago[X86] Add BMI1 scheduling tests
Simon Pilgrim [Sun, 16 Jul 2017 13:59:44 +0000 (13:59 +0000)]
[X86] Add BMI1 scheduling tests

llvm-svn: 308135

7 years ago[Polly] Fix a typo [NFC]
Tobias Grosser [Sun, 16 Jul 2017 13:54:41 +0000 (13:54 +0000)]
[Polly] Fix a typo [NFC]

Reviewers: grosser, Meinersbur, bollu

Tags: #polly

Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D35459

llvm-svn: 308134

7 years ago[X86] Add LZCNT scheduling tests
Simon Pilgrim [Sun, 16 Jul 2017 13:40:44 +0000 (13:40 +0000)]
[X86] Add LZCNT scheduling tests

llvm-svn: 308133

7 years ago[X86][SSE4A] Add EXTRQ/INSERTQ values to BTVER2 scheduling model
Simon Pilgrim [Sun, 16 Jul 2017 12:06:06 +0000 (12:06 +0000)]
[X86][SSE4A] Add EXTRQ/INSERTQ values to BTVER2 scheduling model

llvm-svn: 308132

7 years ago[X86][AVX] Regenerate tests with constant broadcast comments
Simon Pilgrim [Sun, 16 Jul 2017 11:43:16 +0000 (11:43 +0000)]
[X86][AVX] Regenerate tests with constant broadcast comments

llvm-svn: 308131

7 years ago[X86][AVX] Regenerate vector tzcnt tests with constant broadcast comments
Simon Pilgrim [Sun, 16 Jul 2017 11:40:23 +0000 (11:40 +0000)]
[X86][AVX] Regenerate vector tzcnt tests with constant broadcast comments

llvm-svn: 308130

7 years ago[X86][AVX] Regenerate vector idiv tests with constant broadcast comments
Simon Pilgrim [Sun, 16 Jul 2017 11:38:14 +0000 (11:38 +0000)]
[X86][AVX] Regenerate vector idiv tests with constant broadcast comments

llvm-svn: 308129

7 years ago[X86][AVX] Regenerate combine tests with constant broadcast comments
Simon Pilgrim [Sun, 16 Jul 2017 11:36:11 +0000 (11:36 +0000)]
[X86][AVX] Regenerate combine tests with constant broadcast comments

llvm-svn: 308128

7 years agofix typos in comments; NFC
Hiroshi Inoue [Sun, 16 Jul 2017 08:11:56 +0000 (08:11 +0000)]
fix typos in comments; NFC

llvm-svn: 308127

7 years agofix typos in comments; NFC
Hiroshi Inoue [Sun, 16 Jul 2017 07:48:48 +0000 (07:48 +0000)]
fix typos in comments; NFC

llvm-svn: 308126

7 years ago[InstSimplify] Use commutable matchers to simplify some code. NFC
Craig Topper [Sun, 16 Jul 2017 06:57:41 +0000 (06:57 +0000)]
[InstSimplify] Use commutable matchers to simplify some code. NFC

llvm-svn: 308125

7 years ago[InstCombine] Move (0 - x) & 1 --> x & 1 to SimplifyDemandedUseBits.
Craig Topper [Sun, 16 Jul 2017 05:37:58 +0000 (05:37 +0000)]
[InstCombine] Move (0 - x) & 1 --> x & 1 to SimplifyDemandedUseBits.

This removes a dedicated matcher and allows us to support more than just an AND masking the lower bit.

llvm-svn: 308124

7 years ago[asan] Disable not working new test on Windows
Vitaly Buka [Sun, 16 Jul 2017 01:28:40 +0000 (01:28 +0000)]
[asan] Disable not working new test on Windows

llvm-svn: 308123

7 years ago[msan] Add missing include for fix test on Windows
Vitaly Buka [Sun, 16 Jul 2017 01:19:35 +0000 (01:19 +0000)]
[msan] Add missing include for fix test on Windows

llvm-svn: 308122

7 years ago[tsan] Disable test with debug runtime
Vitaly Buka [Sun, 16 Jul 2017 01:05:37 +0000 (01:05 +0000)]
[tsan] Disable test with debug runtime

Test expects at least -O1 compiled runtime.

llvm-svn: 308121

7 years ago[asan] Attempt to fix test in Windows after r308064
Vitaly Buka [Sun, 16 Jul 2017 00:40:40 +0000 (00:40 +0000)]
[asan] Attempt to fix test in Windows after r308064

llvm-svn: 308120

7 years agoFix bot failures from r308114
Teresa Johnson [Sun, 16 Jul 2017 00:28:22 +0000 (00:28 +0000)]
Fix bot failures from r308114

Finally figured out that some bots were failing from r308114
with the message:
  llvm-lto2: LTO::run failed: No available targets are compatible with this triple.
after adding in some other checking that finally caused this to show up
in the FileCheck output.

Added "REQUIRES: x86-registered-target" which should fix it.

llvm-svn: 308119

7 years ago[c++2a] Add option -std=c++2a to enable support for potential/transitional C++2a...
Faisal Vali [Sun, 16 Jul 2017 00:23:04 +0000 (00:23 +0000)]
[c++2a] Add option -std=c++2a to enable support for potential/transitional C++2a features

- as usual C++2a implies all the C++'s that came before it.

Thank you Aaron for the feedback here: https://reviews.llvm.org/D35454

llvm-svn: 308118

7 years ago[compiler-rt] Fix fix format specifies type in test
Vitaly Buka [Sun, 16 Jul 2017 00:17:11 +0000 (00:17 +0000)]
[compiler-rt] Fix fix format specifies type in test

llvm-svn: 308117

7 years agoAttempt 2 to debug bot failures
Teresa Johnson [Sun, 16 Jul 2017 00:01:16 +0000 (00:01 +0000)]
Attempt 2 to debug bot failures

Modify checks from r308114 even more, to see if I can narrow down
why some bots are still failing.

llvm-svn: 308116

7 years agoAttempt to debug bot failures
Teresa Johnson [Sat, 15 Jul 2017 23:31:32 +0000 (23:31 +0000)]
Attempt to debug bot failures

Simplifying checks from r308114, to see if I can narrow down why some
bots are still failing.

llvm-svn: 308115

7 years agoRestore with fix "[ThinLTO] Ensure we always select the same function copy to import"
Teresa Johnson [Sat, 15 Jul 2017 22:58:06 +0000 (22:58 +0000)]
Restore with fix "[ThinLTO] Ensure we always select the same function copy to import"

This restores r308078/r308079 with a fix for bot non-determinisim (make
sure we run llvm-lto in single threaded mode so the debug output doesn't get
interleaved).

llvm-svn: 308114

7 years ago[ScopDetection] If a loop is not part of a scop, none of it backedges can be
Tobias Grosser [Sat, 15 Jul 2017 22:42:17 +0000 (22:42 +0000)]
[ScopDetection] If a loop is not part of a scop, none of it backedges can be

This patch makes sure that in case a loop is not fully contained within a region
that later forms a SCoP, none of the loop backedges are allowed to be part of
the region. We currently do not support the situation where only some of a loops
backedges are part of a scop. Today, this can break both scop modeling and code
generation. One such breaking test case is for example
test/ScopDetectionDiagnostics/loop_partially_in_scop-2.ll, where we totally
forgot to code generate some of the backedges. Fortunately, it is commonly not
necessary to support these partial loops, it is way more common that either
no backedge is included in a region or all loop backedge are included.

This fixes a recent miscompile in
MultiSource/Benchmarks/MiBench/consumer-typeset which was exposed after
r306477.

llvm-svn: 308113

7 years ago[IR] Implement Constant::isNegativeZeroValue/isZeroValue/isAllOnesValue/isOneValue...
Craig Topper [Sat, 15 Jul 2017 22:06:19 +0000 (22:06 +0000)]
[IR] Implement Constant::isNegativeZeroValue/isZeroValue/isAllOnesValue/isOneValue/isMinSignedValue for ConstantDataVector without going through getElementAsConstant

Summary:
Currently these methods call ConstantDataVector::getSplatValue which uses getElementsAsConstant to create a Constant object representing the element value. This method incurs a map lookup to see if we already have created such a Constant before and if not allocates a new Constant object.

This patch changes these methods to use getElementAsAPFloat and getElementAsInteger so we can just examine the data values directly.

Reviewers: spatel, pcc, dexonsmith, bogner, craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits

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

llvm-svn: 308112

7 years ago[InstCombine] Improve the expansion in SimplifyUsingDistributiveLaws to handle cases...
Craig Topper [Sat, 15 Jul 2017 21:49:49 +0000 (21:49 +0000)]
[InstCombine] Improve the expansion in SimplifyUsingDistributiveLaws to handle cases where one side doesn't simplify, but the other side resolves to an identity value

Summary:
If one side simplifies to the identity value for inner opcode, we can replace the value with just the operation that can't be simplified.

I've removed a couple now unneeded special cases in visitAnd and visitOr. There are probably other cases I missed.

Reviewers: spatel, majnemer, hfinkel, dberlin

Reviewed By: spatel

Subscribers: grandinj, llvm-commits, spatel

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

llvm-svn: 308111

7 years ago[X86][AVX] Regenerate tests with constant broadcast comments
Simon Pilgrim [Sat, 15 Jul 2017 21:17:35 +0000 (21:17 +0000)]
[X86][AVX] Regenerate tests with constant broadcast comments

llvm-svn: 308110

7 years ago[X86][AVX] Regenerate tests with constant broadcast comments
Simon Pilgrim [Sat, 15 Jul 2017 20:28:09 +0000 (20:28 +0000)]
[X86][AVX] Regenerate tests with constant broadcast comments

llvm-svn: 308109

7 years agoStrip trailing whitespace. NFCI
Simon Pilgrim [Sat, 15 Jul 2017 19:29:19 +0000 (19:29 +0000)]
Strip trailing whitespace. NFCI

llvm-svn: 308108

7 years ago[CodeView] Dump BuildInfoSym and ProcSym type indices
Reid Kleckner [Sat, 15 Jul 2017 18:10:39 +0000 (18:10 +0000)]
[CodeView] Dump BuildInfoSym and ProcSym type indices

I need to print the type index in hex so that I can match it in
FileCheck for a test I'm writing.

llvm-svn: 308107

7 years agoFix mis-use of std::lower_bound
Reid Kleckner [Sat, 15 Jul 2017 18:10:15 +0000 (18:10 +0000)]
Fix mis-use of std::lower_bound

Binary search in C++ is such a PITA. =/

llvm-svn: 308106

7 years ago[InstCombine] improve (1 << x) & 1 --> zext(x == 0) folding
Sanjay Patel [Sat, 15 Jul 2017 17:26:01 +0000 (17:26 +0000)]
[InstCombine] improve (1 << x) & 1 --> zext(x == 0) folding

1. Add a one-use check to prevent increasing instruction count.
2. Generalize the pattern matching to include vector types.

llvm-svn: 308105

7 years ago[InstCombine] Add test cases for (X & (Y | ~X)) -> (X & Y) where the not is an invert...
Craig Topper [Sat, 15 Jul 2017 17:09:23 +0000 (17:09 +0000)]
[InstCombine] Add test cases for (X & (Y | ~X)) -> (X & Y) where the not is an inverted compare. NFC

Do the same for (X | (Y & ~X)) -> (X | Y)

llvm-svn: 308104

7 years ago[InstCombine] Move 4 test cases from a test that didn't use FileCheck and merge them...
Craig Topper [Sat, 15 Jul 2017 17:09:22 +0000 (17:09 +0000)]
[InstCombine] Move 4 test cases from a test that didn't use FileCheck and merge them into a existing test file. NFC

llvm-svn: 308103

7 years ago[InstCombine] add tests for (1 << x) & 1 --> zext(x == 0) ; NFC
Sanjay Patel [Sat, 15 Jul 2017 15:55:07 +0000 (15:55 +0000)]
[InstCombine] add tests for (1 << x) & 1 --> zext(x == 0) ; NFC

This fold hit the trifecta:
1. It was untested.
2. It oversteps (multiuse is not checked, so increases instruction count).
3. It is incomplete (doesn't work for vectors).

llvm-svn: 308102

7 years ago[cxx_status] Fix typos.
Richard Smith [Sat, 15 Jul 2017 15:51:59 +0000 (15:51 +0000)]
[cxx_status] Fix typos.

llvm-svn: 308101

7 years ago[wasm] Update two tests for r308025 which causes scheduling changes due
Chandler Carruth [Sat, 15 Jul 2017 15:44:36 +0000 (15:44 +0000)]
[wasm] Update two tests for r308025 which causes scheduling changes due
to the newly improved AA information.

llvm-svn: 308100

7 years ago[cxx_status] Add approved Toronto WG21 motions.
Richard Smith [Sat, 15 Jul 2017 15:42:36 +0000 (15:42 +0000)]
[cxx_status] Add approved Toronto WG21 motions.

llvm-svn: 308099

7 years ago[InstCombine] allow (0 - x) & 1 --> x & 1 for vectors
Sanjay Patel [Sat, 15 Jul 2017 15:29:47 +0000 (15:29 +0000)]
[InstCombine] allow (0 - x) & 1 --> x & 1 for vectors

llvm-svn: 308098

7 years agoUpdate issues moved in Toronto
Marshall Clow [Sat, 15 Jul 2017 15:22:21 +0000 (15:22 +0000)]
Update issues moved in Toronto

llvm-svn: 308097

7 years ago[InstCombine] remove dead code/tests; NFCI
Sanjay Patel [Sat, 15 Jul 2017 15:01:33 +0000 (15:01 +0000)]
[InstCombine] remove dead code/tests; NFCI

These patterns and tests were added to InstSimplify with:
https://reviews.llvm.org/rL303004

llvm-svn: 308096

7 years agoRevert r308078 (and subsequent tweak in r308079) which introduces a test
Chandler Carruth [Sat, 15 Jul 2017 13:50:26 +0000 (13:50 +0000)]
Revert r308078 (and subsequent tweak in r308079) which introduces a test
that appears to exhibit non-determinism and is flaking on the bots
pretty consistently.

r308078: [ThinLTO] Ensure we always select the same function copy to import
r308079: Require asserts in new test that uses debug flag
llvm-svn: 308095

7 years ago[LoopInterchange] Add some optimization remarks.
Florian Hahn [Sat, 15 Jul 2017 13:13:19 +0000 (13:13 +0000)]
[LoopInterchange] Add some optimization remarks.

Reviewers: anemet, karthikthecool, blitz.opensource

Reviewed By: anemet

Subscribers: mzolotukhin, llvm-commits

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

llvm-svn: 308094

7 years ago[Polly] Translate Scop::DomainMap to islpp
Tobias Grosser [Sat, 15 Jul 2017 12:41:32 +0000 (12:41 +0000)]
[Polly] Translate Scop::DomainMap to islpp

Reviewers: grosser, Meinersbur, bollu

Subscribers: pollydev

Tags: #polly

Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D35453

llvm-svn: 308093

7 years agoUse ARC parsing rules for ns_returns_retained in MRC so that code can
John McCall [Sat, 15 Jul 2017 11:06:46 +0000 (11:06 +0000)]
Use ARC parsing rules for ns_returns_retained in MRC so that code can
be shared without warnings.  Build AttributedTypes to leave breadcrumbs
for tools like the static analyzer.  Warn about attempting to use the
attribute with incompatible return types.

llvm-svn: 308092

7 years ago[Bash-autocompletion] Fixed a bug on bash
Yuka Takahashi [Sat, 15 Jul 2017 09:09:51 +0000 (09:09 +0000)]
[Bash-autocompletion] Fixed a bug on bash

Summary: Maybe I mismerged when merging previous commits by hand.

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

llvm-svn: 308091

7 years ago[docs] AliasAnalysis: clarify that PartialAlias doesn't enforce
Nuno Lopes [Sat, 15 Jul 2017 09:09:24 +0000 (09:09 +0000)]
[docs] AliasAnalysis: clarify that PartialAlias doesn't enforce
objects to start at the same address

As discussed on the ML, there's consensus that this is what the implementations
do and it seems sensible.

llvm-svn: 308090

7 years ago[Polly] Use Isl c++ for InvalidDomainMap
Tobias Grosser [Sat, 15 Jul 2017 09:01:31 +0000 (09:01 +0000)]
[Polly] Use Isl c++ for InvalidDomainMap

Reviewers: grosser, Meinersbur, bollu

Subscribers: maxf, pollydev

Tags: #polly

Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D35308

llvm-svn: 308089

7 years ago[PM/LCG] Teach the LazyCallGraph to maintain reference edges from every
Chandler Carruth [Sat, 15 Jul 2017 08:08:19 +0000 (08:08 +0000)]
[PM/LCG] Teach the LazyCallGraph to maintain reference edges from every
function to every defined function known to LLVM as a library function.

LLVM can introduce calls to these functions either by replacing other
library calls or by recognizing patterns (such as memset_pattern or
vector math patterns) and replacing those with calls. When these library
functions are actually defined in the module, we need to have reference
edges to them initially so that we visit them during the CGSCC walk in
the right order and can effectively rebuild the call graph afterward.

This was discovered when building code with Fortify enabled as that is
a common case of both inline definitions of library calls and
simplifications of code into calling them.

This can in extreme cases of LTO-ing with libc introduce *many* more
reference edges. I discussed a bunch of different options with folks but
all of them are unsatisfying. They either make the graph operations
substantially more complex even when there are *no* defined libfuncs, or
they introduce some other complexity into the callgraph. So this patch
goes with the simplest possible solution of actual synthetic reference
edges. If this proves to be a memory problem, I'm happy to implement one
of the clever techniques to save memory here.

llvm-svn: 308088

7 years ago[mips] Handle the `long-calls` feature flags in the MIPS backend
Simon Atanasyan [Sat, 15 Jul 2017 07:14:25 +0000 (07:14 +0000)]
[mips] Handle the `long-calls` feature flags in the MIPS backend

If the `long-calls` feature flags is enabled, disable use of the `jal`
instruction. Instead of that call a function by by first loading its
address into a register, and then using the contents of that register.

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

llvm-svn: 308087

7 years agoSystemZCodeGen: Update libdeps. r308024 introduced LoopDataPrefetchPass.
NAKAMURA Takumi [Sat, 15 Jul 2017 06:32:12 +0000 (06:32 +0000)]
SystemZCodeGen: Update libdeps. r308024 introduced LoopDataPrefetchPass.

llvm-svn: 308086

7 years agoClangApplyReplacementsTests: Add clangBasic in libdeps.
NAKAMURA Takumi [Sat, 15 Jul 2017 06:32:10 +0000 (06:32 +0000)]
ClangApplyReplacementsTests: Add clangBasic in libdeps.

r308015 introduced clangBasic to instantiate Diagnostics &c,

llvm-svn: 308085

7 years agoclang/test/FixIt/format.m: Tweak for i686, where ssize_t is int. (r308067)
NAKAMURA Takumi [Sat, 15 Jul 2017 06:14:47 +0000 (06:14 +0000)]
clang/test/FixIt/format.m: Tweak for i686, where ssize_t is int. (r308067)

llvm-svn: 308084

7 years agobpf: fix a compilation bug due to unused variable for release build
Yonghong Song [Sat, 15 Jul 2017 06:08:08 +0000 (06:08 +0000)]
bpf: fix a compilation bug due to unused variable for release build

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

7 years agoAMDGPU: Return correct type during argument lowering
Matt Arsenault [Sat, 15 Jul 2017 05:52:59 +0000 (05:52 +0000)]
AMDGPU: Return correct type during argument lowering

The type needs to be casted back to the original argument type.
Fixes an assert that for some reason is only run when
using -debug.

Includes an additional combine to avoid test regressions
from having conversions mixed with multiple Assert[SZ]ext
nodes. On subtargets where i16 is legal, this was producing an i32
register with an i16 AssertZExt, truncated to i16 with another i8
AssertZExt.

t2: i32,ch = CopyFromReg t0, Register:i32 %vreg0
t3: i16 = truncate t2
t5: i16 = AssertZext t3, ValueType:ch:i8
t6: i8 = truncate t5
t7: i32 = zero_extend t6
llvm-svn: 308082

7 years ago[SLPVectorizer] Add an extra parameter to tryScheduleBundle function, NFCI.
Dinar Temirbulatov [Sat, 15 Jul 2017 05:43:54 +0000 (05:43 +0000)]
[SLPVectorizer] Add an extra parameter to tryScheduleBundle function, NFCI.

llvm-svn: 308081

7 years agobpf: generate better lowering code for certain select/setcc instructions
Yonghong Song [Sat, 15 Jul 2017 05:41:42 +0000 (05:41 +0000)]
bpf: generate better lowering code for certain select/setcc instructions

Currently, for code like below,
===
  inner_map = bpf_map_lookup_elem(outer_map, &port_key);
  if (!inner_map) {
    inner_map = &fallback_map;
  }
===
the compiler generates (pseudo) code like the below:
===
  I1: r1 = bpf_map_lookup_elem(outer_map, &port_key);
  I2: r2 = 0
  I3: if (r1 == r2)
  I4:   r6 = &fallback_map
  I5: ...
===

During kernel verification process, After I1, r1 holds a state
map_ptr_or_null. If I3 condition is not taken
(path [I1, I2, I3, I5]), supposedly r1 should become map_ptr.
Unfortunately, kernel does not recognize this pattern
and r1 remains map_ptr_or_null at insn I5. This will cause
verificaiton failure later on.

Kernel, however, is able to recognize pattern "if (r1 == 0)"
properly and give a map_ptr state to r1 in the above case.

LLVM here generates suboptimal code which causes kernel verification
failure. This patch fixes the issue by changing BPF insn pattern
matching and lowering to generate proper codes if the righthand
parameter of the above condition is a constant. A test case
is also added.

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

7 years agoRequire asserts in new test that uses debug flag
Teresa Johnson [Sat, 15 Jul 2017 05:27:57 +0000 (05:27 +0000)]
Require asserts in new test that uses debug flag

This should fix bot failures from r308078.

llvm-svn: 308079

7 years ago[ThinLTO] Ensure we always select the same function copy to import
Teresa Johnson [Sat, 15 Jul 2017 04:53:05 +0000 (04:53 +0000)]
[ThinLTO] Ensure we always select the same function copy to import

Summary:
Check if the first eligible callee is under the instruction threshold.
Checking this on the first eligible callee ensures that we don't end
up selecting different callees to import when we invoke this routine
with different thresholds due to reaching the callee via paths that
are shallower or hotter (when there are multiple copies, i.e. with
weak or linkonce linkage). We don't want to leave the decision of which
copy to import up to the backend.

Reviewers: mehdi_amini

Subscribers: inglorion, fhahn, llvm-commits

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

llvm-svn: 308078

7 years ago[ODRHash] Revert r307743 which reverted r307720
Richard Trieu [Sat, 15 Jul 2017 02:55:13 +0000 (02:55 +0000)]
[ODRHash] Revert r307743 which reverted r307720

Reapply r307720 to allow processing of constructors and destructors.  Reuse
the diagnostics for CXXMethodDecl for them.

llvm-svn: 308077

7 years ago[TTI] Refine the cost of EXT in getUserCost()
Haicheng Wu [Sat, 15 Jul 2017 02:12:16 +0000 (02:12 +0000)]
[TTI] Refine the cost of EXT in getUserCost()

Now, getUserCost() only checks the src and dst types of EXT to decide it is free
or not. This change first checks the types, then calls isExtFreeImpl(), and
check if EXT can form ExtLoad at last. Currently, only AArch64 has customized
implementation of isExtFreeImpl() to check if EXT can be folded into its use.

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

llvm-svn: 308076

7 years ago[libFuzzer] remove stale code
Kostya Serebryany [Sat, 15 Jul 2017 01:31:40 +0000 (01:31 +0000)]
[libFuzzer] remove stale code

llvm-svn: 308075

7 years ago[Dominators] Fix reachable visitation and reenable a unit test
Jakub Kuderski [Sat, 15 Jul 2017 01:27:16 +0000 (01:27 +0000)]
[Dominators] Fix reachable visitation and reenable a unit test

This fixes a minor bug in insertion to a reachable node that caused
DominatorTree.InsertDeleteExhaustive flakiness. The patch also adds
a new testcase for this exact failure.

llvm-svn: 308074

7 years ago[clang] Fix format test
Alexander Shaposhnikov [Sat, 15 Jul 2017 01:06:59 +0000 (01:06 +0000)]
[clang] Fix format test

This diff makes the test FixIt/format.m more robust.
The issue was caught by the build bot clang-cmake-thumbv7-a15.

Test plan: make check-all

llvm-svn: 308073

7 years ago[compiler-rt] [CMake] Build compiler-rt with no optimizations if the flag says so
George Karpenkov [Sat, 15 Jul 2017 00:30:46 +0000 (00:30 +0000)]
[compiler-rt] [CMake] Build compiler-rt with no optimizations if the flag says so

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

llvm-svn: 308072

7 years agoTry to fix modules build
Matthias Braun [Sat, 15 Jul 2017 00:29:25 +0000 (00:29 +0000)]
Try to fix modules build

Module builds somehow report an ambiguity between clang::Diagnostic and
clang::Tooling::Diagnostic. It seems as if one of the additional headers
brought in by the module brings the clang namespace to the toplevel. I
could not find out the reason for that, so for now I go with the simple
fix to bring the build back to green.

rdar://33321397

llvm-svn: 308071

7 years ago[Dominators] Temporarily disable a flaky unit test
Jakub Kuderski [Fri, 14 Jul 2017 23:49:12 +0000 (23:49 +0000)]
[Dominators] Temporarily disable a flaky unit test

The DominatorTree.InsertDeleteExhaustive uses a RNG with a
constant seed to generate different sequences of updates. The test
fails on some buildbots and this patch disables it for now.

llvm-svn: 308070

7 years ago[libFuzzer] Allow non-fuzzer args after -ignore_remaining_args=1
Justin Bogner [Fri, 14 Jul 2017 23:33:04 +0000 (23:33 +0000)]
[libFuzzer] Allow non-fuzzer args after -ignore_remaining_args=1

With this change, libFuzzer will ignore any arguments after a sigil
argument, but it will preserve these arguments at the end of the
command line when launching subprocesses. Using this, its possible to
handle positional and single-dash arguments to the program under test
by discarding everything up to -ignore_remaining_args=1 in
LLVMFuzzerInitialize.

llvm-svn: 308069

7 years agoAdd missing space to comment
Adrian Prantl [Fri, 14 Jul 2017 23:23:58 +0000 (23:23 +0000)]
Add missing space to comment

llvm-svn: 308068

7 years ago[clang] Fix handling of "%zd" format specifier
Alexander Shaposhnikov [Fri, 14 Jul 2017 22:57:00 +0000 (22:57 +0000)]
[clang] Fix handling of "%zd" format specifier

This diff addresses FIXME in lib/Analysis/PrintfFormatString.cpp
and makes PrintfSpecifier::getArgType return the correct type.
In particular, this change enables Clang to emit a warning on
incorrect using of "%zd"/"%zn" format specifiers.

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

Test plan: make check-all

llvm-svn: 308067

7 years agoAvoid using OutputSections::Sections.
Rafael Espindola [Fri, 14 Jul 2017 22:26:16 +0000 (22:26 +0000)]
Avoid using OutputSections::Sections.

This code runs after clearOutputSections.

llvm-svn: 308066

7 years ago[Dominators] Remove an extra semicolon and add a missing include.
Jakub Kuderski [Fri, 14 Jul 2017 22:24:15 +0000 (22:24 +0000)]
[Dominators] Remove an extra semicolon and add a missing include.

llvm-svn: 308065

7 years ago[Sanitizers] ASan and LSan allocator set errno on failure.
Alex Shlyapnikov [Fri, 14 Jul 2017 22:23:47 +0000 (22:23 +0000)]
[Sanitizers] ASan and LSan allocator set errno on failure.

Summary:
Set proper errno code on alloction failures and change some
implementations to satisfy their man-specified requirements:

LSan: valloc and memalign
ASan: pvalloc, memalign and posix_memalign

Changing both allocators in one patch since LSan depends on ASan allocator in some configurations.

Reviewers: vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 308064

7 years ago[Sanitizers] LSan allocator set errno on failure.
Alex Shlyapnikov [Fri, 14 Jul 2017 22:23:46 +0000 (22:23 +0000)]
[Sanitizers] LSan allocator set errno on failure.

Set proper errno code on alloction failures and change valloc and
memalign implementations to satisfy their man-specified requirements.

llvm-svn: 308063

7 years ago[Dominators] Implement incremental deletions
Jakub Kuderski [Fri, 14 Jul 2017 21:58:53 +0000 (21:58 +0000)]
[Dominators] Implement incremental deletions

Summary:
This patch implements incremental edge deletions.

It also makes DominatorTreeBase store a pointer to the parent function. The parent function is needed to perform full rebuilts during some deletions, but it is also used to verify that inserted and deleted edges come from the same function.

Reviewers: dberlin, davide, grosser, sanjoy, brzycki

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 308062

7 years ago[libFuzzer] fix stats during merge
Kostya Serebryany [Fri, 14 Jul 2017 21:48:19 +0000 (21:48 +0000)]
[libFuzzer] fix stats during merge

llvm-svn: 308061

7 years ago[AArch64] Avoid selecting XZR inline ASM memory operand
Yi Kong [Fri, 14 Jul 2017 21:46:16 +0000 (21:46 +0000)]
[AArch64] Avoid selecting XZR inline ASM memory operand

Restricting register class to PointerRegClass for memory operands.

Also fix the PointerRegClass for AArch64 from GPR64 to GPR64sp, since
XZR cannot hold a memory pointer while SP is.

Fixes PR33134.

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

llvm-svn: 308060

7 years ago[AArch64][Falkor] Avoid HW prefetcher tag collisions (step 1)
Geoff Berry [Fri, 14 Jul 2017 21:44:12 +0000 (21:44 +0000)]
[AArch64][Falkor] Avoid HW prefetcher tag collisions (step 1)

Summary:
This patch is the first step in reducing HW prefetcher instruction tag
collisions in inner loops for Falkor.  It adds a pass that annotates IR
loads with metadata to indicate that they are known to be strided loads,
and adds a target lowering hook that translates this metadata to a
target-specific MachineMemOperand flag.

A follow on change will use this MachineMemOperand flag to re-write
instructions to reduce tag collisions.

Reviewers: mcrosier, t.p.northover

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

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

llvm-svn: 308059

7 years ago[Dominators] Add a missing include
Jakub Kuderski [Fri, 14 Jul 2017 21:38:15 +0000 (21:38 +0000)]
[Dominators] Add a missing include

llvm-svn: 308058

7 years agoPass OutputSectionCommand to getOSThunkSec. NFC.
Rafael Espindola [Fri, 14 Jul 2017 21:37:10 +0000 (21:37 +0000)]
Pass OutputSectionCommand to getOSThunkSec. NFC.

llvm-svn: 308057

7 years agoPass OutputSectionCommand to forEachExecInputSection's callback.
Rafael Espindola [Fri, 14 Jul 2017 21:33:14 +0000 (21:33 +0000)]
Pass OutputSectionCommand to forEachExecInputSection's callback.

NFC, just makes the OutputSectionCommand available.

llvm-svn: 308056

7 years ago[AMDGPU] Throw away more dead code. NFCI.
Davide Italiano [Fri, 14 Jul 2017 21:20:29 +0000 (21:20 +0000)]
[AMDGPU] Throw away more dead code. NFCI.

llvm-svn: 308055

7 years ago[Dominators] Implement incremental insertions
Jakub Kuderski [Fri, 14 Jul 2017 21:17:33 +0000 (21:17 +0000)]
[Dominators] Implement incremental insertions

Summary:
This patch introduces incremental edge insertions based on the Depth Based Search algorithm.

Insertions should work for both dominators and postdominators.

Reviewers: dberlin, grosser, davide, sanjoy, brzycki

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 308054

7 years ago[Sanitizers] Scudo allocator set errno on failure.
Alex Shlyapnikov [Fri, 14 Jul 2017 21:17:16 +0000 (21:17 +0000)]
[Sanitizers] Scudo allocator set errno on failure.

Summary:
Set proper errno code on alloction failure and change pvalloc and
posix_memalign implementation to satisfy their man-specified
requirements.

Reviewers: cryptoad

Subscribers: llvm-commits

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

llvm-svn: 308053

7 years agoFix mixed line terminators. NFC.
Dimitry Andric [Fri, 14 Jul 2017 21:14:58 +0000 (21:14 +0000)]
Fix mixed line terminators. NFC.

llvm-svn: 308052

7 years ago[EarlyCSE] Handle calls with no MemorySSA info.
Geoff Berry [Fri, 14 Jul 2017 20:13:21 +0000 (20:13 +0000)]
[EarlyCSE] Handle calls with no MemorySSA info.

Summary:
When checking for memory dependencies between calls using MemorySSA,
handle cases where the calls have no MemoryAccess associated with them
because the AA analysis being used has determined that the call does not
read/write memory.

Fixes PR33756

Reviewers: dberlin, davide

Subscribers: mcrosier, llvm-commits, Prazek

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

llvm-svn: 308051

7 years ago[JumpThreading] Add a pattern to TryToUnfoldSelectInCurrBB()
Haicheng Wu [Fri, 14 Jul 2017 19:16:47 +0000 (19:16 +0000)]
[JumpThreading] Add a pattern to TryToUnfoldSelectInCurrBB()

Add the following pattern to TryToUnfoldSelectInCurrBB()

bb:
   %p = phi [0, %bb1], [1, %bb2], [0, %bb3], [1, %bb4], ...
   %c = cmp %p, 0
   %s = select %c, trueval, falseval

The Select in the above pattern will be unfolded and then jump-threaded. The
current implementation does not allow CMP in the middle of PHI and Select.

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

llvm-svn: 308050

7 years ago[Hexagon] Replace ISD opcode VPACK with VPACKE/VPACKO, NFC
Krzysztof Parzyszek [Fri, 14 Jul 2017 19:02:32 +0000 (19:02 +0000)]
[Hexagon] Replace ISD opcode VPACK with VPACKE/VPACKO, NFC

This breaks up pack-even and pack-odd into two separate operations.

llvm-svn: 308049

7 years agoFix flag names in @available docs.
Nico Weber [Fri, 14 Jul 2017 18:52:30 +0000 (18:52 +0000)]
Fix flag names in @available docs.

llvm-svn: 308048