platform/upstream/llvm.git
7 years agoNew C++ function name parsing logic
Eugene Zemtsov [Mon, 3 Apr 2017 18:59:34 +0000 (18:59 +0000)]
New C++ function name parsing logic

Current implementation of CPlusPlusLanguage::MethodName::Parse() doesn't
get anywhere close to covering full extent of possible function declarations.
It causes incorrect behavior in avoid-stepping and sometimes messes
printing of thread backtrace.

This change implements more methodical parsing logic based on clang
lexer and simple recursive parser.

Examples:
void std::vector<Class, std::allocator<Class>>::_M_emplace_back_aux<Class const&>(Class const&)
void (*&std::_Any_data::_M_access<void (*)()>())()

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

llvm-svn: 299374

7 years agoFix LLVMBuild.txt typo. NFC
Joel Jones [Mon, 3 Apr 2017 18:21:50 +0000 (18:21 +0000)]
Fix LLVMBuild.txt typo. NFC

llvm-svn: 299373

7 years agoAMDGPU: Remove legacy bfe intrinsics
Matt Arsenault [Mon, 3 Apr 2017 18:08:08 +0000 (18:08 +0000)]
AMDGPU: Remove legacy bfe intrinsics

llvm-svn: 299372

7 years ago[Support] Make printAllJSONValues public, for custom output.
Graydon Hoare [Mon, 3 Apr 2017 18:04:15 +0000 (18:04 +0000)]
[Support] Make printAllJSONValues public, for custom output.

Summary:
This changes the static method TimerGroup::printAllJSONValues from private to
public, to match the static method TimerGroup::printAll. When trying to drive
the reporting machinery by hand, the existing API is _almost_ flexible enough,
but this entrypoint is required to intermix printing timers with other
non-timer output.

The underlying motive here is a Swift change to consolidate the collection of
timers, LLVM statistics and other (non-assert-dependent) counters into JSON
files, which requires a bit of manual intervention in LLVM's stat and timer
output routines. See https://github.com/apple/swift/pull/8477 for details.

Reviewers: MatzeB

Reviewed By: MatzeB

Subscribers: llvm-commits

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

llvm-svn: 299371

7 years agoBitcode: Remove reader support for MODULE_CODE_PURGEVALS.
Peter Collingbourne [Mon, 3 Apr 2017 17:58:48 +0000 (17:58 +0000)]
Bitcode: Remove reader support for MODULE_CODE_PURGEVALS.

Support for writing this module code was removed in r73220, which was well
before the LLVM 3.0 release, so we do not need to be able to understand it
for backwards compatibility.

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

llvm-svn: 299370

7 years ago[InstCombine] Add test cases showing how we fail to fold vector constants into select...
Craig Topper [Mon, 3 Apr 2017 17:49:15 +0000 (17:49 +0000)]
[InstCombine] Add test cases showing how we fail to fold vector constants into selects the way we do with scalars.

llvm-svn: 299369

7 years agoRevert "[DAGCombine] A shuffle of a splat is always the splat itself"
Zvi Rackover [Mon, 3 Apr 2017 17:41:19 +0000 (17:41 +0000)]
Revert "[DAGCombine]  A shuffle of a splat is always the splat itself"

This reverts commit r299047 which is incorrect because the
simplification may result in incorrect propogation of undefs to users of
the folded shuffle.

Thanks to Andrea Di Biagio for pointing this out.

llvm-svn: 299368

7 years ago[Hexagon] Factor out some common code in HexagonEarlyIfConv.cpp, NFC
Krzysztof Parzyszek [Mon, 3 Apr 2017 17:26:40 +0000 (17:26 +0000)]
[Hexagon] Factor out some common code in HexagonEarlyIfConv.cpp, NFC

llvm-svn: 299367

7 years agoRevert r299337 "[InstCombine] Remove redundant combine from visitAnd"
Craig Topper [Mon, 3 Apr 2017 17:22:23 +0000 (17:22 +0000)]
Revert r299337 "[InstCombine] Remove redundant combine from visitAnd"

One of the tsan bots started failing at this commit. I don't see anything obviously wrong with the commit so trying this to see if it recovers.

Failing log: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/6792

llvm-svn: 299366

7 years ago[InstCombine] fix formatting for foldLogOpOfMaskedICmps and related bits; NFCI
Sanjay Patel [Mon, 3 Apr 2017 16:53:12 +0000 (16:53 +0000)]
[InstCombine] fix formatting for foldLogOpOfMaskedICmps and related bits; NFCI

1. Improve enum, function, and variable names.
2. Improve comments.
3. Fix variable capitalization.
4. Run clang-format.

As an existing code comment suggests, this should work with vector types / splat constants too,
so making this look right first will reduce the diffs needed for that change.

llvm-svn: 299365

7 years ago[TargetInfo] Use llvm::alignOf() instead of rewriting it. NFCI.
Davide Italiano [Mon, 3 Apr 2017 16:51:39 +0000 (16:51 +0000)]
[TargetInfo] Use llvm::alignOf() instead of rewriting it. NFCI.

llvm-svn: 299364

7 years agoEnhance -Wshadow to warn when shadowing typedefs or type aliases
Alex Lorenz [Mon, 3 Apr 2017 16:43:21 +0000 (16:43 +0000)]
Enhance -Wshadow to warn when shadowing typedefs or type aliases

Enhance -Wshadow to emit a warning when typedefs or type aliases are shadowed.

Fixes bug https://bugs.llvm.org//show_bug.cgi?id=28676.

Patch by Ahmed Asadi.

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

llvm-svn: 299363

7 years ago[APInt] Move isMask and isShiftedMask out of APIntOps and into the APInt class. Imple...
Craig Topper [Mon, 3 Apr 2017 16:34:59 +0000 (16:34 +0000)]
[APInt] Move isMask and isShiftedMask out of APIntOps and into the APInt class. Implement them without memory allocation for multiword

This moves the isMask and isShiftedMask functions to be class methods. They now use the MathExtras.h function for single word size and leading/trailing zeros/ones or countPopulation for the multiword size. The previous implementation made multiple temorary memory allocations to do the bitwise arithmetic operations to match the MathExtras.h implementation.

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

llvm-svn: 299362

7 years ago[DAGCombiner] Check limits before accessing array element (PR32502)
Simon Pilgrim [Mon, 3 Apr 2017 15:27:49 +0000 (15:27 +0000)]
[DAGCombiner] Check limits before accessing array element (PR32502)

llvm-svn: 299361

7 years ago[PerfMonitor] Use Intrinsics::getDeclaration
Tobias Grosser [Mon, 3 Apr 2017 15:23:08 +0000 (15:23 +0000)]
[PerfMonitor] Use Intrinsics::getDeclaration

Instead of creating the declaration ourselves, we obtain it directly from the
LLVM intrinsic definitions. This addresses a post-review comment for r299359.

Suggested-by: Hongzing Zheng <etherzhhb@gmail.com>
llvm-svn: 299360

7 years ago[CodeGen] Add Performance Monitor
Tobias Grosser [Mon, 3 Apr 2017 14:55:37 +0000 (14:55 +0000)]
[CodeGen] Add Performance Monitor

Add support for -polly-codegen-perf-monitoring. When performance monitoring
is enabled, we emit performance monitoring code during code generation that
prints after program exit statistics about the total number of cycles executed
as well as the number of cycles spent in scops. This gives an estimate on how
useful polyhedral optimizations might be for a given program.

Example output:

  Polly runtime information
  -------------------------
  Total: 783110081637
  Scops: 663718949365

In the future, we might also add functionality to measure how much time is spent
in optimized scops and how many cycles are spent in the fallback code.

Reviewers: bollu,sebpop

Tags: #polly

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

llvm-svn: 299359

7 years agoARMAsmParser: clean up of isImmediate functions
Sjoerd Meijer [Mon, 3 Apr 2017 14:50:04 +0000 (14:50 +0000)]
ARMAsmParser: clean up of isImmediate functions

- we are now using immediate AsmOperands so that the range check functions are
  tablegen'ed.
- Big bonus is that error messages become much more accurate, i.e. instead of a
  useless "invalid operand" error message it will not say that the immediate
  operand must in range [x,y], which is why regression tests needed updating.

More tablegen operand descriptions could probably benefit from using
immediateAsmOperand, but this is a first good step to get rid of most of the
nearly identical range check functions. I will address the remaining immediate
operands in next clean ups.

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

llvm-svn: 299358

7 years ago[test] Fix two testcases. NFC.
Michael Kruse [Mon, 3 Apr 2017 12:37:10 +0000 (12:37 +0000)]
[test] Fix two testcases. NFC.

Trivial fix for two testcases. When Polly isn't linked into opt,
independent of whether it's built in-tree or not, these testcases forget
to load the appropriate library.

Contributed-by: Philip Pfaffe <philip.pfaffe@gmail.com>
Differential Revision: https://reviews.llvm.org/D31596

llvm-svn: 299357

7 years ago[ScopInfo] Fix typos in option description.
Michael Kruse [Mon, 3 Apr 2017 12:03:38 +0000 (12:03 +0000)]
[ScopInfo] Fix typos in option description.

llvm-svn: 299356

7 years ago[ASTImporter] Fix for importing unnamed structs
Gabor Horvath [Mon, 3 Apr 2017 11:57:11 +0000 (11:57 +0000)]
[ASTImporter] Fix for importing unnamed structs

Patch by Peter Szecsi!

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

llvm-svn: 299355

7 years ago[ASTImporter] Lookup SearchName instead of Name
Gabor Horvath [Mon, 3 Apr 2017 09:30:20 +0000 (09:30 +0000)]
[ASTImporter] Lookup SearchName instead of Name

When the SearchName is already calculated we should use that for the lookup.

Patch by Peter Szecsi!

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

llvm-svn: 299354

7 years agoAdd test case for r299352.
Tobias Grosser [Mon, 3 Apr 2017 07:44:23 +0000 (07:44 +0000)]
Add test case for r299352.

llvm-svn: 299353

7 years ago[PollyIRBuilder] Bound size of alias metadata
Tobias Grosser [Mon, 3 Apr 2017 07:42:50 +0000 (07:42 +0000)]
[PollyIRBuilder] Bound size of alias metadata

No-alias metadata grows quadratic in the size of arrays involved, which can
become very costly for large programs. This commit bounds the number of arrays
for which we construct no-alias information to ten. This is conservatively
correct, as we just provide less information to LLVM and speeds up the compile
time of one of my internal test cases from 'does-not-terminate' to
'finishes-in-less-than-a-minute'. In the future we might try to be more clever
here, but this change should provide a good baseline.

llvm-svn: 299352

7 years ago[InstCombine] Make foldOpWithConstantIntoOperand take a BinaryOperator instead of...
Craig Topper [Mon, 3 Apr 2017 07:08:08 +0000 (07:08 +0000)]
[InstCombine] Make foldOpWithConstantIntoOperand take a BinaryOperator instead of a generic Instruction.

It blindly assumes there are two operands so make it explicit.

llvm-svn: 299351

7 years agoUpdate to isl-0.18-410-gc253447
Tobias Grosser [Mon, 3 Apr 2017 06:46:16 +0000 (06:46 +0000)]
Update to isl-0.18-410-gc253447

This is a regular maintenance update to ensure latest isl changes are tested
in our buildbots.

llvm-svn: 299350

7 years ago[InstCombine] Remove a And transform that should be handled by SimplifyDemandedInstru...
Craig Topper [Mon, 3 Apr 2017 06:02:09 +0000 (06:02 +0000)]
[InstCombine] Remove a And transform that should be handled by SimplifyDemandedInstructionBits. NFCI

llvm-svn: 299349

7 years ago[libc++] Explicitly mark specializations as dllexport
Shoaib Meenai [Mon, 3 Apr 2017 04:04:24 +0000 (04:04 +0000)]
[libc++] Explicitly mark specializations as dllexport

Method specializations don't get exported even if there's an exported
extern template instantiation on Windows. Explicitly mark the methods
for export. They're already exported on Linux and Darwin, so there's no
ABI change on those platforms.

llvm-svn: 299348

7 years ago[AVX-512] Fix a couple more intrinsic macros I missed in r299346.
Craig Topper [Mon, 3 Apr 2017 03:51:57 +0000 (03:51 +0000)]
[AVX-512] Fix a couple more intrinsic macros I missed in r299346.

llvm-svn: 299347

7 years ago[AVX-512] Fix some intrinsic macros that use the wrong macro parameter names and...
Craig Topper [Mon, 3 Apr 2017 03:41:29 +0000 (03:41 +0000)]
[AVX-512] Fix some intrinsic macros that use the wrong macro parameter names and don't have parentheses around them.

Thanks to Matthew Barr for reporting this issue.

llvm-svn: 299346

7 years agoBack out temporary masking of EXC_SYSCALL mach exceptions.
Jason Molenda [Mon, 3 Apr 2017 00:59:47 +0000 (00:59 +0000)]
Back out temporary masking of EXC_SYSCALL mach exceptions.
<rdar://problem/31359720>

llvm-svn: 299345

7 years agoTrailing whitespace.
NAKAMURA Takumi [Sun, 2 Apr 2017 23:57:17 +0000 (23:57 +0000)]
Trailing whitespace.

llvm-svn: 299344

7 years agoReformat.
NAKAMURA Takumi [Sun, 2 Apr 2017 23:57:10 +0000 (23:57 +0000)]
Reformat.

llvm-svn: 299343

7 years ago[APInt] Make use of whichWord and maskBit to simplify some code. NFC
Craig Topper [Sun, 2 Apr 2017 19:35:18 +0000 (19:35 +0000)]
[APInt] Make use of whichWord and maskBit to simplify some code. NFC

llvm-svn: 299342

7 years ago[APInt] Add a public typedef for the internal type of APInt use it instead of integer...
Craig Topper [Sun, 2 Apr 2017 19:17:22 +0000 (19:17 +0000)]
[APInt] Add a public typedef for the internal type of APInt use it instead of integerPart. Make APINT_BITS_PER_WORD and APINT_WORD_SIZE public.

This patch is one step to attempt to unify the main APInt interface and the tc functions used by APFloat.

This patch adds a WordType to APInt and uses that in all the tc functions. I've added temporary typedefs to APFloat to alias it to integerPart to keep the patch size down. I'll work on removing that in a future patch.

In future patches I hope to reuse the tc functions to implement some of the main APInt functionality.

I may remove APINT_ from BITS_PER_WORD and WORD_SIZE constants so that we don't have the repetitive APInt::APINT_ externally.

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

llvm-svn: 299341

7 years agoFixes for modernize-use-using check:
Krystyna Gajczyk [Sun, 2 Apr 2017 19:12:20 +0000 (19:12 +0000)]
Fixes for modernize-use-using check:
- removed unnessacary namespaces
- added option to print warning in macros
- no fix for typedef with array
- removed "void" word from functions with 0 parameters

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

llvm-svn: 299340

7 years ago[InstCombine] Make InstCombiner::OptAndOp take a BinaryOperator instead of an Instruc...
Craig Topper [Sun, 2 Apr 2017 17:57:30 +0000 (17:57 +0000)]
[InstCombine] Make InstCombiner::OptAndOp take a BinaryOperator instead of an Instruction.

The callers have already performed the necessary cast before calling. This allows us to remove a comment that says the instruction must be a BinaryOperator and make it explicit in the argument type.

Had to add a default case to the switch because BinaryOperator::getOpcode() returns a BinaryOps enum.

llvm-svn: 299339

7 years ago[X86][MMX] Improve support for folding fptosi from XMM to MMX
Simon Pilgrim [Sun, 2 Apr 2017 17:45:41 +0000 (17:45 +0000)]
[X86][MMX] Improve support for folding fptosi from XMM to MMX

llvm-svn: 299338

7 years ago[InstCombine] Remove redundant combine from visitAnd
Craig Topper [Sun, 2 Apr 2017 17:34:30 +0000 (17:34 +0000)]
[InstCombine] Remove redundant combine from visitAnd

As far as I can tell this combine is fully handled by SimplifyDemandedInstructionBits.

I was only looking at this because it is the only user of APIntOps::isShiftedMask which is itself broken. As demonstrated by r299187. I was going to fix isShiftedMask and needed to make sure we had coverage for the new cases it would expose to this combine. But looks like we can nuke it instead.

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

llvm-svn: 299337

7 years ago[X86][MMX] Simplify tablegen patterns by always combining MOVDQ2Q from v2i64
Simon Pilgrim [Sun, 2 Apr 2017 16:20:34 +0000 (16:20 +0000)]
[X86][MMX] Simplify tablegen patterns by always combining MOVDQ2Q from v2i64

llvm-svn: 299336

7 years ago[X86][MMX] Added support for subvector extraction to MMX register
Simon Pilgrim [Sun, 2 Apr 2017 15:52:28 +0000 (15:52 +0000)]
[X86][MMX] Added support for subvector extraction to MMX register

llvm-svn: 299335

7 years agoAPInt.h: Prune \param(s) in \returns. [-Wdocumentation]
NAKAMURA Takumi [Sun, 2 Apr 2017 15:05:18 +0000 (15:05 +0000)]
APInt.h: Prune \param(s) in \returns. [-Wdocumentation]

llvm-svn: 299334

7 years agoRegenerate test with codegen. NFCI.
Simon Pilgrim [Sun, 2 Apr 2017 14:21:14 +0000 (14:21 +0000)]
Regenerate test with codegen. NFCI.

llvm-svn: 299333

7 years agoRegenerate test with codegen. NFCI.
Simon Pilgrim [Sun, 2 Apr 2017 13:59:37 +0000 (13:59 +0000)]
Regenerate test with codegen. NFCI.

llvm-svn: 299332

7 years agoRegenerate test. NFCI.
Simon Pilgrim [Sun, 2 Apr 2017 13:50:44 +0000 (13:50 +0000)]
Regenerate test. NFCI.

llvm-svn: 299331

7 years agoNewGVN: Handle coercion of constant stores, loads, memory insts.
Daniel Berlin [Sun, 2 Apr 2017 13:23:44 +0000 (13:23 +0000)]
NewGVN: Handle coercion of constant stores, loads, memory insts.

Summary:
Depends on D30928.

This adds support for coercion of stores and memory instructions that do not require insertion to process.
Another few tests down.
I added the relevant tests from rle.ll

Reviewers: davide

Subscribers: llvm-commits, Prazek

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

llvm-svn: 299330

7 years ago[BypassSlowDivision] Do not bypass division of hash-like values
Nikolai Bozhenov [Sun, 2 Apr 2017 13:14:30 +0000 (13:14 +0000)]
[BypassSlowDivision] Do not bypass division of hash-like values

Disable bypassing if one of the operands looks like a hash value. Slow
division often occurs in hashtable implementations and fast division is
never taken there because a hash value is extremely unlikely to have
enough upper bits set to zero.

A value is considered to be hash-like if it is produced by

1) XOR operation
2) Multiplication by a constant wider than the shorter type
3) PHI node with all incoming values being hash-like

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

llvm-svn: 299329

7 years ago[X86][MMX] Add generic fptosi 4f32-4i32 test
Simon Pilgrim [Sun, 2 Apr 2017 13:10:20 +0000 (13:10 +0000)]
[X86][MMX] Add generic fptosi 4f32-4i32 test

llvm-svn: 299328

7 years agoAdd another interesting shufflevector test case for InstSimplify. NFC.
Zvi Rackover [Sun, 2 Apr 2017 10:42:21 +0000 (10:42 +0000)]
Add another interesting shufflevector test case for InstSimplify. NFC.

Test case shows opportunity to constant fold a shuffle with one variable
input vector operand.

llvm-svn: 299327

7 years ago[X86] Use tcAdd/tcSubtract to implement the slow case of operator+=/operator-=.
Craig Topper [Sun, 2 Apr 2017 06:59:43 +0000 (06:59 +0000)]
[X86] Use tcAdd/tcSubtract to implement the slow case of operator+=/operator-=.

llvm-svn: 299326

7 years ago[APInt] Combine declaration and initialization. NFC
Craig Topper [Sun, 2 Apr 2017 06:59:41 +0000 (06:59 +0000)]
[APInt] Combine declaration and initialization. NFC

llvm-svn: 299325

7 years ago[APInt] Simplify some code by using operator+=(uint64_t) instead of doing a more...
Craig Topper [Sun, 2 Apr 2017 06:59:38 +0000 (06:59 +0000)]
[APInt] Simplify some code by using operator+=(uint64_t) instead of doing a more complex assignment into a temporary APInt just to use the APInt operator+=.

llvm-svn: 299324

7 years ago[APInt] Fix typo in comment. NFC
Craig Topper [Sun, 2 Apr 2017 06:59:36 +0000 (06:59 +0000)]
[APInt] Fix typo in comment. NFC

llvm-svn: 299323

7 years agoMemorySSA: Add support for caching clobbering access in stores
Daniel Berlin [Sun, 2 Apr 2017 05:09:15 +0000 (05:09 +0000)]
MemorySSA: Add support for caching clobbering access in stores

Summary:
This enables us to cache the clobbering access for stores, despite the
fact that we can't rewrite the use-def chains themselves.

Early testing shows that, after this change, for larger testcases, it will be a significant net positive (memory and time) to remove the walker caching.

Reviewers: george.burgess.iv, davide

Subscribers: Prazek, llvm-commits

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

llvm-svn: 299322

7 years ago[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound...
Craig Topper [Sun, 2 Apr 2017 03:02:53 +0000 (03:02 +0000)]
[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals when compiled for with earlier language standards enabled.

Fixes PR32491.

llvm-svn: 299321

7 years ago[APInt] Use conditional operator to simplify some code. NFC
Craig Topper [Sat, 1 Apr 2017 21:50:10 +0000 (21:50 +0000)]
[APInt] Use conditional operator to simplify some code. NFC

llvm-svn: 299320

7 years ago[APInt] Implement flipAllBitsSlowCase with tcComplement. NFCI
Craig Topper [Sat, 1 Apr 2017 21:50:08 +0000 (21:50 +0000)]
[APInt] Implement flipAllBitsSlowCase with tcComplement. NFCI

llvm-svn: 299319

7 years ago[APInt] Fix indentation. NFC
Craig Topper [Sat, 1 Apr 2017 21:50:06 +0000 (21:50 +0000)]
[APInt] Fix indentation. NFC

llvm-svn: 299318

7 years ago[APInt] Implement AndAssignSlowCase using tcAnd. Do the same for Or and Xor. NFCI
Craig Topper [Sat, 1 Apr 2017 21:50:03 +0000 (21:50 +0000)]
[APInt] Implement AndAssignSlowCase using tcAnd. Do the same for Or and Xor. NFCI

llvm-svn: 299317

7 years ago[NFC, Scoped Enum] Convert Sema::ExpressionEvaluationContext into a scoped Enum
Faisal Vali [Sat, 1 Apr 2017 21:30:49 +0000 (21:30 +0000)]
[NFC, Scoped Enum] Convert Sema::ExpressionEvaluationContext into a scoped Enum

- also replace direct equality checks against the ConstantEvaluated enumerator  with isConstantEvaluted(), in anticipation of adding finer granularity to the various ConstantEvaluated contexts and reinstating certain restrictions on where lambda expressions can occur in C++17.

- update the clang tablegen backend that uses these Enumerators, and add the relevant scope where needed.

llvm-svn: 299316

7 years ago[Driver] Don't crash on invalid values of -mrelocation-model=.
Davide Italiano [Sat, 1 Apr 2017 21:07:07 +0000 (21:07 +0000)]
[Driver] Don't crash on invalid values of -mrelocation-model=.

This is handled in a similar way we handle invalid -mcode-model.

PR: 31840
llvm-svn: 299315

7 years ago[APInt] Allow GreatestCommonDivisor to take rvalue inputs efficiently. Use moves...
Craig Topper [Sat, 1 Apr 2017 20:30:57 +0000 (20:30 +0000)]
[APInt] Allow GreatestCommonDivisor to take rvalue inputs efficiently. Use moves instead of copies in the loop.

Summary:
GreatestComonDivisor currently makes a copy of both its inputs. Then in the loop we do one move and two copies, plus any allocation the urem call does.

This patch changes it to take its inputs by value so that we can do a move of any rvalue inputs instead of copying. Then in the loop we do 3 move assignments and no copies. This way the only possible allocations we have in the loop is from the urem call.

Reviewers: dblaikie, RKSimon, hans

Reviewed By: dblaikie

Subscribers: llvm-commits

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

llvm-svn: 299314

7 years ago[WASM] Remove other comparison of unsigned expression >= 0.
Davide Italiano [Sat, 1 Apr 2017 19:47:52 +0000 (19:47 +0000)]
[WASM] Remove other comparison of unsigned expression >= 0.

This should finally fix the GCC 7 build with -Werror.

llvm-svn: 299313

7 years ago[WASM] Remove a set but never used variable.
Davide Italiano [Sat, 1 Apr 2017 19:40:51 +0000 (19:40 +0000)]
[WASM] Remove a set but never used variable.

llvm-svn: 299312

7 years ago[WASM] Remove an assertion that can never fire.
Davide Italiano [Sat, 1 Apr 2017 19:37:15 +0000 (19:37 +0000)]
[WASM] Remove an assertion that can never fire.

uint* is by definition always >=0.

llvm-svn: 299311

7 years ago[AMDGPU] Garbage collect now unused dead code. NFCI.
Davide Italiano [Sat, 1 Apr 2017 19:30:17 +0000 (19:30 +0000)]
[AMDGPU] Garbage collect now unused dead code. NFCI.

llvm-svn: 299310

7 years ago[InstSimplify] add constant folding for fdiv/frem
Sanjay Patel [Sat, 1 Apr 2017 19:05:11 +0000 (19:05 +0000)]
[InstSimplify] add constant folding for fdiv/frem

Also, add a helper function so we don't have to repeat this code for each binop.

llvm-svn: 299309

7 years ago[InstSimplify] add tests for missed constant folding; NFC
Sanjay Patel [Sat, 1 Apr 2017 18:44:03 +0000 (18:44 +0000)]
[InstSimplify] add tests for missed constant folding; NFC

llvm-svn: 299308

7 years agofix formatting; NFC
Sanjay Patel [Sat, 1 Apr 2017 18:40:30 +0000 (18:40 +0000)]
fix formatting; NFC

llvm-svn: 299307

7 years ago[ObjC++] Use the correct EH personality in GNU mode
Benjamin Kramer [Sat, 1 Apr 2017 17:59:01 +0000 (17:59 +0000)]
[ObjC++] Use the correct EH personality in GNU mode

Previously, it would just always use the ObjC DWARF personality, even with SjLj
or SEH exceptions.

Patch by Jonathan Schleifer, test case by me.

llvm-svn: 299306

7 years agofix formatting; NFC
Sanjay Patel [Sat, 1 Apr 2017 15:53:12 +0000 (15:53 +0000)]
fix formatting; NFC

llvm-svn: 299305

7 years ago[DAGCombiner] enable vector transforms for any/all {sign} bits set/clear
Sanjay Patel [Sat, 1 Apr 2017 15:05:54 +0000 (15:05 +0000)]
[DAGCombiner] enable vector transforms for any/all {sign} bits set/clear

The code already allowed vector types in via "isInteger" (which might want
a more specific name), so use splat-friendly constant predicates to match
those types.

llvm-svn: 299304

7 years ago[PowerPC, x86] add vector tests for any/all {sign} bits set/clear; NFC
Sanjay Patel [Sat, 1 Apr 2017 14:32:18 +0000 (14:32 +0000)]
[PowerPC, x86] add vector tests for any/all {sign} bits set/clear; NFC

llvm-svn: 299303

7 years agoMemorySSA: Update expensive checking version of def_chain_iterator for templating...
Daniel Berlin [Sat, 1 Apr 2017 10:04:28 +0000 (10:04 +0000)]
MemorySSA: Update expensive checking version of def_chain_iterator for templating changes

llvm-svn: 299301

7 years agoNewGVN: Don't try to kill off the stored value of stores when
Daniel Berlin [Sat, 1 Apr 2017 09:44:33 +0000 (09:44 +0000)]
NewGVN: Don't try to kill off the stored value of stores when
processing the congruence class of the store.
Because we use the stored value of a store as the def, it isn't dead
just because it appears as a def when it comes from a store.

Note: I have not hit any cases with the memory code as it is where
this breaks anything, just because of what memory congruences we
actually allow.  In a followup that improves memory congruence,
this bug actually breaks real stuff (but the verifier catches it).

llvm-svn: 299300

7 years agoNewGVN: Clean up GVNExpression memory hierarchy, restructure hash computation a bit...
Daniel Berlin [Sat, 1 Apr 2017 09:44:29 +0000 (09:44 +0000)]
NewGVN: Clean up GVNExpression memory hierarchy, restructure hash computation a bit so we don't have to redefine it for loads, stores, and calls

llvm-svn: 299299

7 years agoNewGVN: Use def_chain iterator in singleReachablePhiPath instead of recursion
Daniel Berlin [Sat, 1 Apr 2017 09:44:24 +0000 (09:44 +0000)]
NewGVN: Use def_chain iterator in singleReachablePhiPath instead of recursion

llvm-svn: 299298

7 years agoMove def_chain iterator to MemorySSA.h so it can be reused
Daniel Berlin [Sat, 1 Apr 2017 09:44:19 +0000 (09:44 +0000)]
Move def_chain iterator to MemorySSA.h so it can be reused

llvm-svn: 299297

7 years agoMemorySSA.h - make clang-format happy
Daniel Berlin [Sat, 1 Apr 2017 09:44:14 +0000 (09:44 +0000)]
MemorySSA.h - make clang-format happy

llvm-svn: 299296

7 years agoMemorySSA: Push const correctness further.
Daniel Berlin [Sat, 1 Apr 2017 09:01:12 +0000 (09:01 +0000)]
MemorySSA: Push const correctness further.

llvm-svn: 299295

7 years agoMemorySSA: Kill the WalkTargetCache now that we have getBlockDefs.
Daniel Berlin [Sat, 1 Apr 2017 08:59:45 +0000 (08:59 +0000)]
MemorySSA: Kill the WalkTargetCache now that we have getBlockDefs.

llvm-svn: 299294

7 years ago[APInt] Implement operator! using operator==(uint64_t). NFCI
Craig Topper [Sat, 1 Apr 2017 06:50:00 +0000 (06:50 +0000)]
[APInt] Implement operator! using operator==(uint64_t). NFCI

llvm-svn: 299293

7 years ago[APInt] Remove the mul/urem/srem/udiv/sdiv functions from the APIntOps namespace...
Craig Topper [Sat, 1 Apr 2017 05:08:57 +0000 (05:08 +0000)]
[APInt] Remove the mul/urem/srem/udiv/sdiv functions from the APIntOps namespace. Replace the few usages with calls to the class methods. NFC

llvm-svn: 299292

7 years ago[DAGCombiner] Fix fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf A, B, Mask...
Craig Topper [Sat, 1 Apr 2017 04:26:20 +0000 (04:26 +0000)]
[DAGCombiner] Fix fold (or (shuf A, V_0, MA), (shuf B, V_0, MB)) -> (shuf A, B, Mask) to explicitly ensure that only one of the inputs of each shuffle is a zero vector.

This can only happen when we have a mix of zero and undef elements and the two vectors have a different arrangement of zeros/undefs. The shuffle should eventually be constant folded to all zeros.

Fixes PR32484.

llvm-svn: 299291

7 years agostring: Remove always_inline from basic_string::__init
Duncan P. N. Exon Smith [Sat, 1 Apr 2017 03:20:48 +0000 (03:20 +0000)]
string: Remove always_inline from basic_string::__init

This is effectively a partial revert of r278356, which started inlining
basic_string::__init.  Even if we want to help the compiler along with
an inlinehint, we shouldn't hamstring it by forcing it to inline all the
time.

Libc++ uses always_inline widely as a limit-the-ABI-hack, but since
__init is already on the dylib boundary, it makes no sense here and just
harms the debugging experience at -O0.

rdar://problem/31013102

llvm-svn: 299290

7 years agoChange the error format to report corrupted .eh_frame.
Rui Ueyama [Sat, 1 Apr 2017 01:42:20 +0000 (01:42 +0000)]
Change the error format to report corrupted .eh_frame.

llvm-svn: 299289

7 years agoRevert "Feature generic option to setup start/stop-after/before"
Quentin Colombet [Sat, 1 Apr 2017 01:26:24 +0000 (01:26 +0000)]
Revert "Feature generic option to setup start/stop-after/before"

This reverts commit r299282.

Didn't intend to commit this :(

llvm-svn: 299288

7 years agoRevert "Localizer fun"
Quentin Colombet [Sat, 1 Apr 2017 01:26:21 +0000 (01:26 +0000)]
Revert "Localizer fun"

This reverts commit r299283.

Didn't intend to commit this :(

llvm-svn: 299287

7 years agoRevert "Instrument SDISel C++ patterns"
Quentin Colombet [Sat, 1 Apr 2017 01:26:17 +0000 (01:26 +0000)]
Revert "Instrument SDISel C++ patterns"

This reverts commit r299284.

Didn't intend to commit this :(

llvm-svn: 299286

7 years ago[RegBankSelect] Support REG_SEQUENCE for generic mapping
Quentin Colombet [Sat, 1 Apr 2017 01:26:14 +0000 (01:26 +0000)]
[RegBankSelect] Support REG_SEQUENCE for generic mapping

REG_SEQUENCE falls into the same category as COPY for operands mapping:
- They don't have MCInstrDesc with register constraints
- The input variable could use whatever register classes
- It is possible to have register class already assigned to the operands

In particular, given REG_SEQUENCE are always target specific because of
the subreg indices. Those indices must apply to the register class of
the definition of the REG_SEQUENCE and therefore, the target must set a
register class to that definition. As a result, the generic code can
always use that register class to derive a valid mapping for a
REG_SEQUENCE.

llvm-svn: 299285

7 years agoInstrument SDISel C++ patterns
Quentin Colombet [Sat, 1 Apr 2017 01:21:32 +0000 (01:21 +0000)]
Instrument SDISel C++ patterns

llvm-svn: 299284

7 years agoLocalizer fun
Quentin Colombet [Sat, 1 Apr 2017 01:21:28 +0000 (01:21 +0000)]
Localizer fun

WIP

llvm-svn: 299283

7 years agoFeature generic option to setup start/stop-after/before
Quentin Colombet [Sat, 1 Apr 2017 01:21:24 +0000 (01:21 +0000)]
Feature generic option to setup start/stop-after/before

This patch refactors the code used in llc such that all the users of the
addPassesToEmitFile API have access to a homogeneous way of handling
start/stop-after/before options right out of the box.

Previously each user would have needed to duplicate this logic and set
up its own options.

NFC

llvm-svn: 299282

7 years ago[coroutines] Add cleanup for compiler injected objects/allocations in coroutine body
Gor Nishanov [Sat, 1 Apr 2017 00:22:47 +0000 (00:22 +0000)]
[coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

Summary:
* Use pushCleanup to emit freeing coroutine memory on normal and EH exits.
* Surround emitted code with CodeGenFunction::RunCleanupsScope.

Reviewers: rsmith, rnk, EricWF

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 299281

7 years agoChange the error message format for duplicate symbols.
Rui Ueyama [Fri, 31 Mar 2017 23:40:21 +0000 (23:40 +0000)]
Change the error message format for duplicate symbols.

This patch is intended to improve readability of "duplicate symbol"
error messages.

Without this patch:

  /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Relocations.cpp:1054: duplicate symbol 'lld::elf::demangle(llvm::StringRef)'
  /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Strings.cpp:93: previous definition was here

With this patch:

  /ssd/clang/bin/ld.lld: error: duplicate symbol: lld::elf::demangle(llvm::StringRef)
  >>> defined at Strings.cpp:93 (/ssd/llvm-project/lld/ELF/Strings.cpp:93)
  >>>            Strings.cpp.o:(lld::elf::demangle(llvm::StringRef)) in archive lib/liblldELF.a
  >>> defined at Relocations.cpp:1054 (/ssd/llvm-project/lld/ELF/Relocations.cpp:1054)
  >>>            Relocations.cpp.o:(.text+0x4C30) in archive lib/liblldELF.a

Discussion thread:
http://lists.llvm.org/pipermail/llvm-dev/2017-March/111459.html

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

llvm-svn: 299280

7 years agoFix a test to check assembly output instead of bitcode.
Peter Collingbourne [Fri, 31 Mar 2017 23:22:19 +0000 (23:22 +0000)]
Fix a test to check assembly output instead of bitcode.

llvm-svn: 299279

7 years agoReduce the number of times we query the subtarget for the same information.
Eric Christopher [Fri, 31 Mar 2017 23:12:27 +0000 (23:12 +0000)]
Reduce the number of times we query the subtarget for the same information.

llvm-svn: 299278

7 years agoSmall cleanup to remove extraneous cast.
Eric Christopher [Fri, 31 Mar 2017 23:12:24 +0000 (23:12 +0000)]
Small cleanup to remove extraneous cast.

llvm-svn: 299277

7 years agoDisassembleRange can return an empty DisassemblerSP
Jim Ingham [Fri, 31 Mar 2017 22:39:55 +0000 (22:39 +0000)]
DisassembleRange can return an empty DisassemblerSP
check for it.

<rdar://problem/31379799>

llvm-svn: 299276

7 years agoAMDGPU/llvm-readobj: Rename RuntimeMDNoteType -> CodeObjectMetadataNoteType to
Konstantin Zhuravlyov [Fri, 31 Mar 2017 22:36:39 +0000 (22:36 +0000)]
AMDGPU/llvm-readobj: Rename RuntimeMDNoteType -> CodeObjectMetadataNoteType to
match the new metadata. NFC.

llvm-svn: 299275

7 years ago[ThinLTO] Handle -emit-llvm* in ThinLTO backends
Teresa Johnson [Fri, 31 Mar 2017 22:35:47 +0000 (22:35 +0000)]
[ThinLTO] Handle -emit-llvm* in ThinLTO backends

Summary:
Use PreCodeGenModuleHook to invoke the correct writer when emitting LLVM
IR, returning false to skip codegen from within thinBackend.

Reviewers: pcc, mehdi_amini

Subscribers: Prazek, cfe-commits

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

llvm-svn: 299274