oota-llvm.git
10 years ago[AlignmentFromAssumptions] Don't divide by zero for unknown starting alignment
Hal Finkel [Wed, 10 Sep 2014 21:05:52 +0000 (21:05 +0000)]
[AlignmentFromAssumptions] Don't divide by zero for unknown starting alignment

The routine that determines an alignment given some SCEV returns zero if the
answer is unknown. In a case where we could determine the increment of an
AddRec but not the starting alignment, we would compute the integer modulus by
zero (which is illegal and traps). Prevent this by returning early if either
the start or increment alignment is unknown (zero).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217544 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[sphinx cleanup]
Dan Liew [Wed, 10 Sep 2014 20:43:03 +0000 (20:43 +0000)]
[sphinx cleanup]
Fix sphinx warning introduced by r217537

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217541 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch64] Revert r216141 for cyclone
Gerolf Hoflehner [Wed, 10 Sep 2014 20:31:57 +0000 (20:31 +0000)]
[AArch64] Revert r216141 for cyclone

The increase of the interleave factor to 4 has side-effects
like performance losses eg. due to reminder loops being executed
more frequently and may increase code size. It requires more
analysis and careful heuristic tuning. Expect double digit gains
in small benchmarks like lowercase.c and losses in puzzle.c.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217540 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[PassManager] Adding Hidden attribute to EnableMLSM option
Gerolf Hoflehner [Wed, 10 Sep 2014 20:24:03 +0000 (20:24 +0000)]
[PassManager] Adding Hidden attribute to EnableMLSM option

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217539 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[MergedLoadStoreMotion] Move pass enabling option to PassManagerBuilder
Gerolf Hoflehner [Wed, 10 Sep 2014 19:55:29 +0000 (19:55 +0000)]
[MergedLoadStoreMotion] Move pass enabling option to PassManagerBuilder

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217538 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix docs reference to inexistent class.
Nico Weber [Wed, 10 Sep 2014 19:50:55 +0000 (19:50 +0000)]
Fix docs reference to inexistent class.

Patch sent via telegraph by TNorthover. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217537 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRemember to eraseFromParent after replaceAllUsesWith.
Rafael Espindola [Wed, 10 Sep 2014 19:39:41 +0000 (19:39 +0000)]
Remember to eraseFromParent after replaceAllUsesWith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217536 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCleanup: Use the appropriate API for accessing the DIVariable of a
Adrian Prantl [Wed, 10 Sep 2014 18:52:29 +0000 (18:52 +0000)]
Cleanup: Use the appropriate API for accessing the DIVariable of a
DBG_VALUE intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217533 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch64] Temporarily desactivate the PBQP test, while I investigate some leaks in...
Arnaud A. de Grandmaison [Wed, 10 Sep 2014 18:40:18 +0000 (18:40 +0000)]
[AArch64] Temporarily desactivate the PBQP test, while I investigate some leaks in the allocator

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217531 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake CallingConv::ID an alias of "unsigned".
Alexey Samsonov [Wed, 10 Sep 2014 18:00:17 +0000 (18:00 +0000)]
Make CallingConv::ID an alias of "unsigned".

Summary:
Make CallingConv::ID a plain unsigned instead of enum with a
fixed set of valus. LLVM IR allows arbitraty calling conventions (you are
free to write cc12345), and loading them as enum is an undefined
behavior. This was reported by UBSan.

Test Plan: llvm regression test suite

Reviewers: nicholas

Reviewed By: nicholas

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217529 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRename getMaximumUnrollFactor -> getMaxInterleaveFactor; also rename option names...
Sanjay Patel [Wed, 10 Sep 2014 17:58:16 +0000 (17:58 +0000)]
Rename getMaximumUnrollFactor -> getMaxInterleaveFactor; also rename option names controlling this variable.

"Unroll" is not the appropriate name for this variable. Clang already uses
the term "interleave" in pragmas and metadata for this.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217528 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRemoved misleading comment.
Gerolf Hoflehner [Wed, 10 Sep 2014 17:54:50 +0000 (17:54 +0000)]
Removed misleading comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217527 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdded missing blank
Gerolf Hoflehner [Wed, 10 Sep 2014 17:52:27 +0000 (17:52 +0000)]
Added missing blank

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217526 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoLangRef: @baz should be @bar in the COMDAT example
Hans Wennborg [Wed, 10 Sep 2014 17:05:08 +0000 (17:05 +0000)]
LangRef: @baz should be @bar in the COMDAT example

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217520 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch64] Address Chad's post commit review comments for r217504 (PBQP experimental...
Arnaud A. de Grandmaison [Wed, 10 Sep 2014 17:03:25 +0000 (17:03 +0000)]
[AArch64] Address Chad's post commit review comments for r217504 (PBQP experimental support)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217518 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agotypo
Sanjay Patel [Wed, 10 Sep 2014 16:58:40 +0000 (16:58 +0000)]
typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217516 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix comments of createReplaceableForwardDecl() and createForwardDecl().
Frederic Riss [Wed, 10 Sep 2014 16:03:14 +0000 (16:03 +0000)]
Fix comments of createReplaceableForwardDecl() and createForwardDecl().

Noticed while trying to understand how the merge of forward decalred types
and defintions work.

Reviewers: echristo, dblaikie, aprantl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217514 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoReplace a few virtual with override.
Rafael Espindola [Wed, 10 Sep 2014 15:50:08 +0000 (15:50 +0000)]
Replace a few virtual with override.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217513 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch64] Pacify lld buildbot complaining about an unused static function in release...
Arnaud A. de Grandmaison [Wed, 10 Sep 2014 14:24:02 +0000 (14:24 +0000)]
[AArch64] Pacify lld buildbot complaining about an unused static function in release build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217505 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch64] Add experimental PBQP support
Arnaud A. de Grandmaison [Wed, 10 Sep 2014 14:06:10 +0000 (14:06 +0000)]
[AArch64] Add experimental PBQP support

This adds target specific support for using the PBQP register allocator on the
AArch64, for the A57 cpu.

By default, the PBQP allocator is not used, unless explicitely required
on the command line with "-aarch64-pbqp".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217504 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch 64] Use a constant pool load for weak symbol references when
Asiri Rathnayake [Wed, 10 Sep 2014 13:54:38 +0000 (13:54 +0000)]
[AArch 64] Use a constant pool load for weak symbol references when
using static relocation model and small code model.

Summary: currently we generate GOT based relocations for weak symbol
references regardless of the underlying relocation model. This should
be change so that in static relocation model we use a constant pool
load instead.

Patch from: Keith Walker

Reviewers: Renato Golin, Tim Northover

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217503 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd missing HWEncoding to base register class.
Sid Manning [Wed, 10 Sep 2014 13:09:25 +0000 (13:09 +0000)]
Add missing HWEncoding to base register class.

This change gives tblgen the information needed to fill in the
HexagonRegEncodingTable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217500 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAttempt to pacify buildbots.
David Majnemer [Wed, 10 Sep 2014 13:01:03 +0000 (13:01 +0000)]
Attempt to pacify buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217499 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoARM: don't size-reduce STMs using the LR register.
Tim Northover [Wed, 10 Sep 2014 12:53:28 +0000 (12:53 +0000)]
ARM: don't size-reduce STMs using the LR register.

The only Thumb-1 multi-store capable of using LR is the PUSH instruction, which
translates to STMDB, so we shouldn't convert STMIAs.

Patch by Sergey Dmitrouk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217498 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoObject: Add support for bigobj
David Majnemer [Wed, 10 Sep 2014 12:51:52 +0000 (12:51 +0000)]
Object: Add support for bigobj

This adds support for reading the "bigobj" variant of COFF produced by
cl's /bigobj and mingw's -mbig-obj.

The most significant difference that bigobj brings is more than 2**16
sections to COFF.

bigobj brings a few interesting differences with it:
- It doesn't have a Characteristics field in the file header.
- It doesn't have a SizeOfOptionalHeader field in the file header (it's
  only used in executable files).
- Auxiliary symbol records have the same width as a symbol table entry.
  Since symbol table entries are bigger, so are auxiliary symbol
  records.

Write support will come soon.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217496 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[mips] Remove inverted predicates from MipsSubtarget that were only used by MipsCalli...
Daniel Sanders [Wed, 10 Sep 2014 12:02:27 +0000 (12:02 +0000)]
[mips] Remove inverted predicates from MipsSubtarget that were only used by MipsCallingConv.td

Summary: No functional change

Reviewers: echristo, vmedic

Reviewed By: echristo, vmedic

Subscribers: echristo, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217494 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDon't attempt to run llvm-config in cmake/modules/Makefile when doing
Dan Liew [Wed, 10 Sep 2014 11:09:23 +0000 (11:09 +0000)]
Don't attempt to run llvm-config in cmake/modules/Makefile when doing
``make clean`` because it won't be available.

This is an attempt to unbreak buildbots broken by r217484.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217490 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFunctionPassManager isn't used by the JIT anymore, it is used in
Yaron Keren [Wed, 10 Sep 2014 10:48:06 +0000 (10:48 +0000)]
FunctionPassManager isn't used by the JIT anymore, it is used in
clang EmitAssemblyHelper::CreatePasses() in BackendUtil.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217488 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[mips] Return an ArrayRef from MipsCC::intArgRegs() and remove MipsCC::numIntArgRegs()
Daniel Sanders [Wed, 10 Sep 2014 10:37:03 +0000 (10:37 +0000)]
[mips] Return an ArrayRef from MipsCC::intArgRegs() and remove MipsCC::numIntArgRegs()

Summary: No functional change.

Reviewers: vmedic

Reviewed By: vmedic

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217485 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAttempt to fix PR20884
Dan Liew [Wed, 10 Sep 2014 10:18:59 +0000 (10:18 +0000)]
Attempt to fix PR20884

This fixes the generation of broken LLVMExports.cmake file by
the Autoconf/Makefile build system when --enable-shared is passed to
configure.

When --enable_shared is passed the Makefile.rules does not set the
LLVMConfigLibs variable which cmake/modules/Makefile previously relied
on. Now it runs the llvm-config command itself to get the library names.

This still isn't perfect because the generated LLVM targets refer to the
static libraries and not the shared library but that is much larger
problem to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217484 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMergeFunctions: FunctionPtr has been renamed to FunctionNode.
Stepan Dyatkovskiy [Wed, 10 Sep 2014 10:08:25 +0000 (10:08 +0000)]
MergeFunctions: FunctionPtr has been renamed to FunctionNode.
It's supposed to store additional pass information for current function here.
That was the reason for name change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217483 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[asan-assembly-instrumentation] Added CFI directives to the generated instrumentation...
Yuri Gorshenin [Wed, 10 Sep 2014 09:45:49 +0000 (09:45 +0000)]
[asan-assembly-instrumentation] Added CFI directives to the generated instrumentation code.

Summary: [asan-assembly-instrumentation] Added CFI directives to the generated instrumentation code.

Reviewers: eugenis

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217482 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDrop the W postfix on the 16-bit registers.
Job Noorman [Wed, 10 Sep 2014 06:58:14 +0000 (06:58 +0000)]
Drop the W postfix on the 16-bit registers.

This ensures the inline assembly register constraints are properly recognised in
TargetLowering::getRegForInlineAsmConstraint.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217479 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-cov: Remove an overly system specific test
Justin Bogner [Wed, 10 Sep 2014 06:35:38 +0000 (06:35 +0000)]
llvm-cov: Remove an overly system specific test

It appears that the -filename-equivalence option for testing llvm-cov
doesn't work correctly with -show-expansions. I'm reverting this test
to get the bots green while I look into fixing that.

This partially reverts r217476

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217478 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[MIPS] Add aliases for sync instruction used by Octeon CPU
Kai Nacke [Wed, 10 Sep 2014 06:10:24 +0000 (06:10 +0000)]
[MIPS] Add aliases for sync instruction used by Octeon CPU

This commit adds aliases for the sync instruction (synciobdma,
syncs, syncw, syncws) which are used by the Octeon CPU.

Reviewed by D. Sanders

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217477 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-cov: Fix a misuse of ArrayRef::slice I introduced in r217430
Justin Bogner [Wed, 10 Sep 2014 06:06:07 +0000 (06:06 +0000)]
llvm-cov: Fix a misuse of ArrayRef::slice I introduced in r217430

It appears this code was completely untested, so using ArrayRef wrong
didn't break anything obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217476 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUse cast to MVT instead of EVT on a couple calls to getSizeInBits.
Craig Topper [Wed, 10 Sep 2014 04:51:36 +0000 (04:51 +0000)]
Use cast to MVT instead of EVT on a couple calls to getSizeInBits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217473 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[MCJIT] Remove redundant architecture check from RuntimeDyldMachOI386.
Lang Hames [Wed, 10 Sep 2014 00:13:42 +0000 (00:13 +0000)]
[MCJIT] Remove redundant architecture check from RuntimeDyldMachOI386.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217470 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSink PrevCU updating into DwarfUnit::addRange to ensure consistency
David Blaikie [Tue, 9 Sep 2014 23:13:01 +0000 (23:13 +0000)]
Sink PrevCU updating into DwarfUnit::addRange to ensure consistency

So that the two operations in DwarfDebug couldn't get separated (because
I accidentally separated them in some work in progress), put them
together. While we're here, move DwarfUnit::addRange to
DwarfCompileUnit, since it's not relevant to type units.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217468 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRemove DwarfDebug::PrevSection, PrevCU is sufficient for handling address range holes.
David Blaikie [Tue, 9 Sep 2014 22:56:36 +0000 (22:56 +0000)]
Remove DwarfDebug::PrevSection, PrevCU is sufficient for handling address range holes.

PrevSection/PrevCU are used to detect holes in the address range of a CU
to ensure the DW_AT_ranges does not include those holes. When we see a
function with no debug info, though it may be in the same range as the
prior and subsequent functions, there should be a gap in the CU's
ranges. By setting PrevCU to null in that case, the range would not be
extended to cover the gap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217466 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSampleProfile.cpp: Prune a stray \param added in r217437. [-Wdocumentation]
NAKAMURA Takumi [Tue, 9 Sep 2014 22:44:30 +0000 (22:44 +0000)]
SampleProfile.cpp: Prune a stray \param added in r217437. [-Wdocumentation]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217465 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoHandle common linkage correctly in the gold plugin.
Rafael Espindola [Tue, 9 Sep 2014 20:08:22 +0000 (20:08 +0000)]
Handle common linkage correctly in the gold plugin.

This is the plugin version of pr20882.

This handles the case of every common symbol being in the IR. We will need some
support from gold to handle the case where some symbols are in ELF and some in
the IR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217458 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd a scheduling model for AMD 16H Jaguar (btver2).
Sanjay Patel [Tue, 9 Sep 2014 20:07:07 +0000 (20:07 +0000)]
Add a scheduling model for AMD 16H Jaguar (btver2).

This is a first pass at a scheduling model for Jaguar.
It's structured largely on the existing SandyBridge and SLM sched models.

Using this model, in addition to turning on the PostRA scheduler, results in
some perf wins on internal and 3rd party benchmarks. There's not much difference
in LLVM's test-suite benchmarking subset of tests.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217457 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMerge alignment of common GlobalValue.
Rafael Espindola [Tue, 9 Sep 2014 17:48:18 +0000 (17:48 +0000)]
Merge alignment of common GlobalValue.

Fixes pr20882.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217455 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoUse armv6k default for FreeBSD/ARM
Ed Maste [Tue, 9 Sep 2014 17:47:24 +0000 (17:47 +0000)]
Use armv6k default for FreeBSD/ARM

Patch by Andrew Turner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217454 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd a test for hoisting instructions with metadata out of then/else blocks
Bjorn Steinbrink [Tue, 9 Sep 2014 17:10:21 +0000 (17:10 +0000)]
Add a test for hoisting instructions with metadata out of then/else blocks

Test for the bug fixed in r215723.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217453 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoWhen merging two common GlobalValues, keep the largest.
Rafael Espindola [Tue, 9 Sep 2014 15:59:12 +0000 (15:59 +0000)]
When merging two common GlobalValues, keep the largest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217451 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake this input file pass the verifier.
Rafael Espindola [Tue, 9 Sep 2014 15:40:12 +0000 (15:40 +0000)]
Make this input file pass the verifier.

This was not noticed before because llvm-link only runs the verifier on the
result and these globals were not present in the result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217450 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMove some logic to ModuleLinker::shouldLinkFromSource. NFC.
Rafael Espindola [Tue, 9 Sep 2014 15:21:00 +0000 (15:21 +0000)]
Move some logic to  ModuleLinker::shouldLinkFromSource. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217449 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoScalarOpts/LLVMBuild.txt: Prune unused dependency to IPA.
NAKAMURA Takumi [Tue, 9 Sep 2014 15:00:38 +0000 (15:00 +0000)]
ScalarOpts/LLVMBuild.txt: Prune unused dependency to IPA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217448 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoScalarOpts/LLVMBuild.txt: Reorder.
NAKAMURA Takumi [Tue, 9 Sep 2014 15:00:26 +0000 (15:00 +0000)]
ScalarOpts/LLVMBuild.txt: Reorder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217447 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoLLVMProfileData: Update LLVMBuild.txt corresponding to r217437.
NAKAMURA Takumi [Tue, 9 Sep 2014 15:00:13 +0000 (15:00 +0000)]
LLVMProfileData: Update LLVMBuild.txt corresponding to r217437.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217446 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix a use of an undefined value (the linkage).
Rafael Espindola [Tue, 9 Sep 2014 14:52:27 +0000 (14:52 +0000)]
Fix a use of an undefined value (the linkage).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217445 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoPrefer common over weak linkage when linking.
Rafael Espindola [Tue, 9 Sep 2014 14:27:09 +0000 (14:27 +0000)]
Prefer common over weak linkage when linking.

This matches the behavior of ELF linkers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217443 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSimplify ModuleLinker::getLinkageResult. NFC.
Rafael Espindola [Tue, 9 Sep 2014 14:07:40 +0000 (14:07 +0000)]
Simplify ModuleLinker::getLinkageResult. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217441 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[mips] Add assembler support for .set mips0 directive.
Toma Tabacu [Tue, 9 Sep 2014 12:52:14 +0000 (12:52 +0000)]
[mips] Add assembler support for .set mips0 directive.

Summary:
This directive is used to reset the assembler options to their initial values.
Assembly programmers use it in conjunction with the ".set mipsX" directives.

This patch depends on the .set push/pop directive (http://reviews.llvm.org/D4821).

Contains work done by Matheus Almeida.

Reviewers: dsanders

Reviewed By: dsanders

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217438 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoRe-factor sample profile reader into lib/ProfileData.
Diego Novillo [Tue, 9 Sep 2014 12:40:50 +0000 (12:40 +0000)]
Re-factor sample profile reader into lib/ProfileData.

Summary:
This patch moves the profile reading logic out of the Sample Profile
transformation into a generic profile reader facility in
lib/ProfileData.

The intent is to use this new reader to implement a sample profile
reader/writer that can be used to convert sample profiles from external
sources into LLVM.

This first patch introduces no functional changes. It moves the profile
reading code from lib/Transforms/SampleProfile.cpp into
lib/ProfileData/SampleProfReader.cpp.

In subsequent patches I will:

- Add a bitcode format for sample profiles to allow for more efficient
  encoding of the profile.
- Add a writer for both text and bitcode format profiles.
- Add a 'convert' command to llvm-profdata to be able to convert between
  the two (and serve as entry point for other sample profile formats).

Reviewers: bogner, echristo

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217437 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[mips] Move MipsTargetLowering::MipsCC::regSize() to MipsSubtarget::getGPRSizeInBytes()
Daniel Sanders [Tue, 9 Sep 2014 12:11:16 +0000 (12:11 +0000)]
[mips] Move MipsTargetLowering::MipsCC::regSize() to MipsSubtarget::getGPRSizeInBytes()

Summary:
The GPR size is more a property of the subtarget than that of the ABI so move
this information to the MipsSubtarget.

No functional change.

Reviewers: vmedic

Reviewed By: vmedic

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217436 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[x32] Emit callq for CALLpcrel32
Pavel Chupin [Tue, 9 Sep 2014 11:54:12 +0000 (11:54 +0000)]
[x32] Emit callq for CALLpcrel32

Summary:
In AT&T annotation for both x86_64 and x32 calls should be printed as
callq in assembly. It's only a matter of correct mnemonic, object output
is ok.

Test Plan: trivial test added

Reviewers: nadav, dschuff, craig.topper

Subscribers: llvm-commits, zinovy.nis

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217435 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[mips] Don't cache IsO32 and IsFP64 in MipsTargetLowering::MipsCC
Daniel Sanders [Tue, 9 Sep 2014 10:46:48 +0000 (10:46 +0000)]
[mips] Don't cache IsO32 and IsFP64 in MipsTargetLowering::MipsCC

Summary:
Use a MipsSubtarget reference instead.

No functional change.

Reviewers: vmedic

Reviewed By: vmedic

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217434 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-objdump: don't crash when __compact_unwind has no relocs.
Tim Northover [Tue, 9 Sep 2014 10:45:06 +0000 (10:45 +0000)]
llvm-objdump: don't crash when __compact_unwind has no relocs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217433 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[mips] Add assembler support for .set push/pop directive.
Toma Tabacu [Tue, 9 Sep 2014 10:15:38 +0000 (10:15 +0000)]
[mips] Add assembler support for .set push/pop directive.

Summary:
These directives are used to save the current assembler options (in the case of ".set push") and restore the previously saved options (in the case of ".set pop").

Contains work done by Matheus Almeida.

Reviewers: dsanders

Reviewed By: dsanders

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217432 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoARM: Negative offset support problem
Renato Golin [Tue, 9 Sep 2014 09:57:59 +0000 (09:57 +0000)]
ARM: Negative offset support problem

This patch is to permit a negative offset usage for a non frame access.

Patch by Igor Oblakov.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217431 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-cov: Use ArrayRef::slice (NFC)
Justin Bogner [Tue, 9 Sep 2014 09:15:52 +0000 (09:15 +0000)]
llvm-cov: Use ArrayRef::slice (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217430 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[MachineSinking] Conservatively clear kill flags after coalescing.
Patrik Hagglund [Tue, 9 Sep 2014 07:47:00 +0000 (07:47 +0000)]
[MachineSinking] Conservatively clear kill flags after coalescing.

This solves the problem of having a kill flag inside a loop
with a definition of the register prior to the loop:

%vreg368<def> ...

Inside loop:

        %vreg520<def> = COPY %vreg368
        %vreg568<def,tied1> = add %vreg341<tied0>, %vreg520<kill>

=> was coalesced into =>

        %vreg568<def,tied1> = add %vreg341<tied0>, %vreg368<kill>

MachineVerifier then complained:
*** Bad machine code: Virtual register killed in block, but needed live out. ***

The kill flag for %vreg368 is incorrect, and is cleared by this patch.

This is similar to the clearing done at the end of
MachineSinking::SinkInstruction().

Patch provided by Jonas Paulsson.

Reviewed by Quentin Colombet and Juergen Ributzka.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217427 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-cov: Combine two types that were nearly identical (NFC)
Justin Bogner [Tue, 9 Sep 2014 05:32:18 +0000 (05:32 +0000)]
llvm-cov: Combine two types that were nearly identical (NFC)

llvm-cov had a SourceRange type that was nearly identical to a
CountedRegion except that it shaved off a couple of fields. There
aren't likely to be enough of these for the minor memory savings to be
worth the extra complexity here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217417 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-cov: Rename MappingRegion to coverage::CountedRegion (NFC)
Justin Bogner [Tue, 9 Sep 2014 05:32:14 +0000 (05:32 +0000)]
llvm-cov: Rename MappingRegion to coverage::CountedRegion (NFC)

This name was too similar to CoverageMappingRegion, and the type
really belongs in the coverage library anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217416 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSet trunc store action to Expand for all X86 targets.
Bob Wilson [Tue, 9 Sep 2014 01:13:36 +0000 (01:13 +0000)]
Set trunc store action to Expand for all X86 targets.

When compiling without SSE2, isTruncStoreLegal(F64, F32) would return Legal, whereas with SSE2 it would return Expand. And since the Target doesn't seem to actually handle a truncstore for double -> float, it would just output a store of a full double in the space for a float hence overwriting other bits on the stack.

Patch by Luqman Aden!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217410 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-cov: Try to appease MSVC after r217404
Justin Bogner [Mon, 8 Sep 2014 21:31:43 +0000 (21:31 +0000)]
llvm-cov: Try to appease MSVC after r217404

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217406 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix type error in insertvalue example in LangRef. %agg1 is of type {i32,
Dan Liew [Mon, 8 Sep 2014 21:19:46 +0000 (21:19 +0000)]
Fix type error in insertvalue example in LangRef. %agg1 is of type {i32,
float} and thus cannot be used where a type {i32, {float}} is expected.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217405 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-cov: Use ErrorOr rather than an error_code* (NFC)
Justin Bogner [Mon, 8 Sep 2014 21:04:00 +0000 (21:04 +0000)]
llvm-cov: Use ErrorOr rather than an error_code* (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217404 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFast-ISel: Remove dead code after falling back from selecting call instructions ...
Hans Wennborg [Mon, 8 Sep 2014 20:24:10 +0000 (20:24 +0000)]
Fast-ISel: Remove dead code after falling back from selecting call instructions (PR20863)

Previously, fast-isel would not clean up after failing to select a call
instruction, because it would have called flushLocalValueMap() which moves
the insertion point, making SavedInsertPt in selectInstruction() invalid.

Fixing this by making SavedInsertPt a member variable, and having
flushLocalValueMap() update it.

This removes some redundant code at -O0, and more importantly fixes PR20863.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217401 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoGroup unsafe fmul math folds together for easier reading. No functional change.
Sanjay Patel [Mon, 8 Sep 2014 20:16:42 +0000 (20:16 +0000)]
Group unsafe fmul math folds together for easier reading. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217399 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agollvm-cov: Remove dead code
Justin Bogner [Mon, 8 Sep 2014 19:51:21 +0000 (19:51 +0000)]
llvm-cov: Remove dead code

FunctionCoverageMapping::PrettyName was from a version of the tool
during review, and isn't actually used currently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217398 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDon't static_cast invalid pointers
Hal Finkel [Mon, 8 Sep 2014 19:31:25 +0000 (19:31 +0000)]
Don't static_cast invalid pointers

UBSan complained about using static_cast on the invalid (tombstone, etc.)
pointers used by DenseMap. Use a reinterpret_cast instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217397 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoBe more careful in parsing Module::ModFlagBehavior value
Alexey Samsonov [Mon, 8 Sep 2014 19:16:28 +0000 (19:16 +0000)]
Be more careful in parsing Module::ModFlagBehavior value
to make sure we don't do invalid load of an enum. Share the
conversion code between llvm::Module implementation and the
verifier.

This bug was reported by UBSan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217395 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoFix the FIXME that was just added in r217390 - remove a bunch of redundant fold permu...
Sanjay Patel [Mon, 8 Sep 2014 18:22:51 +0000 (18:22 +0000)]
Fix the FIXME that was just added in r217390 - remove a bunch of redundant fold permutations.

The testcases for these folds already exist in test/CodeGen/X86/fp-fast.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217393 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agogroup unsafe math folds together for easier reading
Sanjay Patel [Mon, 8 Sep 2014 17:32:19 +0000 (17:32 +0000)]
group unsafe math folds together for easier reading

Also added a FIXME regarding redundant folds for non-canonicalized constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217390 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch64] Enabled AA support for Cortex-A57.
Chad Rosier [Mon, 8 Sep 2014 15:34:16 +0000 (15:34 +0000)]
[AArch64] Enabled AA support for Cortex-A57.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217381 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoR600/SI: Fix assertion from copying a TargetGlobalAddress
Matt Arsenault [Mon, 8 Sep 2014 15:07:33 +0000 (15:07 +0000)]
R600/SI: Fix assertion from copying a TargetGlobalAddress

Assert in scheduler from an inserted copy_to_regclass from
a constant.

This only seems to break sometimes when a constant initializer
address is forced into VGPRs in a non-entry block. No test
since the only case I've managed to hit only happens with a future
patch, and that case will also not be a problem once scalar instructions
are used in non-entry blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217380 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoR600/SI: Replace LDS atomics with no return versions
Matt Arsenault [Mon, 8 Sep 2014 15:07:31 +0000 (15:07 +0000)]
R600/SI: Replace LDS atomics with no return versions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217379 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoR600/SI: Add InstrMapping for noret atomics.
Matt Arsenault [Mon, 8 Sep 2014 15:07:27 +0000 (15:07 +0000)]
R600/SI: Add InstrMapping for noret atomics.

Only handles LDS atomics for now, and will be used
to replace atomics with no uses with the no return
versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217378 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch64] Improve AA to remove unneeded edges in the AA MI scheduling graph.
Chad Rosier [Mon, 8 Sep 2014 14:43:48 +0000 (14:43 +0000)]
[AArch64] Improve AA to remove unneeded edges in the AA MI scheduling graph.

Patch by Sanjin Sijaric <ssijaric@codeaurora.org>!
Phabricator Review: http://reviews.llvm.org/D5103

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217371 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[AArch64] Enabled AA support for Cortex-A53.
Chad Rosier [Mon, 8 Sep 2014 14:31:49 +0000 (14:31 +0000)]
[AArch64] Enabled AA support for Cortex-A53.

Patch by Sanjin Sijaric <ssijaric@codeaurora.org>!
Phabricator Review: http://reviews.llvm.org/D5103

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217370 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd .clang-tidy configuration file to provide LLVM-optimized defaults for
Alexander Kornienko [Mon, 8 Sep 2014 13:30:00 +0000 (13:30 +0000)]
Add .clang-tidy configuration file to provide LLVM-optimized defaults for
clang-tidy.

Reviewers: chandlerc, djasper

Reviewed By: djasper

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217365 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoSpelling correction
Sid Manning [Mon, 8 Sep 2014 13:05:23 +0000 (13:05 +0000)]
Spelling correction

Another trivial spelling change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217364 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd a comment to getNewAlignmentDiff.
Andrew Trick [Sun, 7 Sep 2014 23:16:24 +0000 (23:16 +0000)]
Add a comment to getNewAlignmentDiff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217350 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake use @llvm.assume for loop guards in ScalarEvolution
Hal Finkel [Sun, 7 Sep 2014 21:37:59 +0000 (21:37 +0000)]
Make use @llvm.assume for loop guards in ScalarEvolution

This adds a basic (but important) use of @llvm.assume calls in ScalarEvolution.
When SE is attempting to validate a condition guarding a loop (such as whether
or not the loop count can be zero), this check should also include dominating
assumptions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217348 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoCheck for all known bits on ret in InstCombine
Hal Finkel [Sun, 7 Sep 2014 21:28:34 +0000 (21:28 +0000)]
Check for all known bits on ret in InstCombine

From a combination of @llvm.assume calls (and perhaps through other means, such
as range metadata), it is possible that all bits of a return value might be
known. Previously, InstCombine did not check for this (which is understandable
given assumptions of constant propagation), but means that we'd miss simple
cases where assumptions are involved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217346 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake use of @llvm.assume from LazyValueInfo
Hal Finkel [Sun, 7 Sep 2014 20:29:59 +0000 (20:29 +0000)]
Make use of @llvm.assume from LazyValueInfo

This change teaches LazyValueInfo to use the @llvm.assume intrinsic. Like with
the known-bits change (r217342), this requires feeding a "context" instruction
pointer through many functions. Aside from a little refactoring to reuse the
logic that turns predicates into constant ranges in LVI, the only new code is
that which can 'merge' the range from an assumption into that otherwise
computed. There is also a small addition to JumpThreading so that it can have
LVI use assumptions in the same block as the comparison feeding a conditional
branch.

With this patch, we can now simplify this as expected:
int foo(int a) {
  __builtin_assume(a > 5);
  if (a > 3) {
    bar();
    return 1;
  }
  return 0;
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217345 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd an AlignmentFromAssumptions Pass
Hal Finkel [Sun, 7 Sep 2014 20:05:11 +0000 (20:05 +0000)]
Add an AlignmentFromAssumptions Pass

This adds a ScalarEvolution-powered transformation that updates load, store and
memory intrinsic pointer alignments based on invariant((a+q) & b == 0)
expressions. Many of the simple cases we can get with ValueTracking, but we
still need something like this for the more complicated cases (such as those
with an offset) that require some algebra. Note that gcc's
__builtin_assume_aligned's optional third argument provides exactly for this
kind of 'misalignment' offset for which this kind of logic is necessary.

The primary motivation is to fixup alignments for vector loads/stores after
vectorization (and unrolling). This pass is added to the optimization pipeline
just after the SLP vectorizer runs (which, admittedly, does not preserve SE,
although I imagine it could).  Regardless, I actually don't think that the
preservation matters too much in this case: SE computes lazily, and this pass
won't issue any SE queries unless there are any assume intrinsics, so there
should be no real additional cost in the common case (SLP does preserve DT and
LoopInfo).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217344 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd additional patterns for @llvm.assume in ValueTracking
Hal Finkel [Sun, 7 Sep 2014 19:21:07 +0000 (19:21 +0000)]
Add additional patterns for @llvm.assume in ValueTracking

This builds on r217342, which added the infrastructure to compute known bits
using assumptions (@llvm.assume calls). That original commit added only a few
patterns (to catch common cases related to determining pointer alignment); this
change adds several other patterns for simple cases.

r217342 contained that, for assume(v & b = a), bits in the mask
that are known to be one, we can propagate known bits from the a to v. It also
had a known-bits transfer for assume(a = b). This patch adds:

assume(~(v & b) = a) : For those bits in the mask that are known to be one, we
                       can propagate inverted known bits from the a to v.

assume(v | b = a) :    For those bits in b that are known to be zero, we can
                       propagate known bits from the a to v.

assume(~(v | b) = a):  For those bits in b that are known to be zero, we can
                       propagate inverted known bits from the a to v.

assume(v ^ b = a) :    For those bits in b that are known to be zero, we can
       propagate known bits from the a to v. For those bits in
       b that are known to be one, we can propagate inverted
                       known bits from the a to v.

assume(~(v ^ b) = a) : For those bits in b that are known to be zero, we can
       propagate inverted known bits from the a to v. For those
       bits in b that are known to be one, we can propagate
                       known bits from the a to v.

assume(v << c = a) :   For those bits in a that are known, we can propagate them
                       to known bits in v shifted to the right by c.

assume(~(v << c) = a) : For those bits in a that are known, we can propagate
                        them inverted to known bits in v shifted to the right by c.

assume(v >> c = a) :   For those bits in a that are known, we can propagate them
                       to known bits in v shifted to the right by c.

assume(~(v >> c) = a) : For those bits in a that are known, we can propagate
                        them inverted to known bits in v shifted to the right by c.

assume(v >=_s c) where c is non-negative: The sign bit of v is zero

assume(v >_s c) where c is at least -1: The sign bit of v is zero

assume(v <=_s c) where c is negative: The sign bit of v is one

assume(v <_s c) where c is non-positive: The sign bit of v is one

assume(v <=_u c): Transfer the known high zero bits

assume(v <_u c): Transfer the known high zero bits (if c is know to be a power
                 of 2, transfer one more)

A small addition to InstCombine was necessary for some of the test cases. The
problem is that when InstCombine was simplifying and, or, etc. it would fail to
check the 'do I know all of the bits' condition before checking less specific
conditions and would not fully constant-fold the result. I'm not sure how to
trigger this aside from using assumptions, so I've just included the change
here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217343 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoMake use of @llvm.assume in ValueTracking (computeKnownBits, etc.)
Hal Finkel [Sun, 7 Sep 2014 18:57:58 +0000 (18:57 +0000)]
Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.)

This change, which allows @llvm.assume to be used from within computeKnownBits
(and other associated functions in ValueTracking), adds some (optional)
parameters to computeKnownBits and friends. These functions now (optionally)
take a "context" instruction pointer, an AssumptionTracker pointer, and also a
DomTree pointer, and most of the changes are just to pass this new information
when it is easily available from InstSimplify, InstCombine, etc.

As explained below, the significant conceptual change is that known properties
of a value might depend on the control-flow location of the use (because we
care that the @llvm.assume dominates the use because assumptions have
control-flow dependencies). This means that, when we ask if bits are known in a
value, we might get different answers for different uses.

The significant changes are all in ValueTracking. Two main changes: First, as
with the rest of the code, new parameters need to be passed around. To make
this easier, I grouped them into a structure, and I made internal static
versions of the relevant functions that take this structure as a parameter. The
new code does as you might expect, it looks for @llvm.assume calls that make
use of the value we're trying to learn something about (often indirectly),
attempts to pattern match that expression, and uses the result if successful.
By making use of the AssumptionTracker, the process of finding @llvm.assume
calls is not expensive.

Part of the structure being passed around inside ValueTracking is a set of
already-considered @llvm.assume calls. This is to prevent a query using, for
example, the assume(a == b), to recurse on itself. The context and DT params
are used to find applicable assumptions. An assumption needs to dominate the
context instruction, or come after it deterministically. In this latter case we
only handle the specific case where both the assumption and the context
instruction are in the same block, and we need to exclude assumptions from
being used to simplify their own ephemeral values (those which contribute only
to the assumption) because otherwise the assumption would prove its feeding
comparison trivial and would be removed.

This commit adds the plumbing and the logic for a simple masked-bit propagation
(just enough to write a regression test). Future commits add more patterns
(and, correspondingly, more regression tests).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217342 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoDebugInfo: Do not use DW_FORM_GNU_addr_index in skeleton CUs, GDB 7.8 errors on this.
David Blaikie [Sun, 7 Sep 2014 17:31:42 +0000 (17:31 +0000)]
DebugInfo: Do not use DW_FORM_GNU_addr_index in skeleton CUs, GDB 7.8 errors on this.

It's probably not a huge deal to not do this - if we could, maybe the
address could be reused by a subprogram low_pc and avoid an extra
relocation, but it's just one per CU at best.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217338 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd functions for finding ephemeral values
Hal Finkel [Sun, 7 Sep 2014 13:49:57 +0000 (13:49 +0000)]
Add functions for finding ephemeral values

This adds a set of utility functions for collecting 'ephemeral' values. These
are LLVM IR values that are used only by @llvm.assume intrinsics (directly or
indirectly), and thus will be removed prior to code generation, implying that
they should be considered free for certain purposes (like inlining). The
inliner's cost analysis, and a few other passes, have been updated to account
for ephemeral values using the provided functionality.

This functionality is important for the usability of @llvm.assume, because it
limits the "non-local" side-effects of adding llvm.assume on inlining, loop
unrolling, etc. (these are hints, and do not generate code, so they should not
directly contribute to estimates of execution cost).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217335 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoAdd an Assumption-Tracking Pass
Hal Finkel [Sun, 7 Sep 2014 12:44:26 +0000 (12:44 +0000)]
Add an Assumption-Tracking Pass

This adds an immutable pass, AssumptionTracker, which keeps a cache of
@llvm.assume call instructions within a module. It uses callback value handles
to keep stale functions and intrinsics out of the map, and it relies on any
code that creates new @llvm.assume calls to notify it of the new instructions.
The benefit is that code needing to find @llvm.assume intrinsics can do so
directly, without scanning the function, thus allowing the cost of @llvm.assume
handling to be negligible when none are present.

The current design is intended to be lightweight. We don't keep track of
anything until we need a list of assumptions in some function. The first time
this happens, we scan the function. After that, we add/remove @llvm.assume
calls from the cache in response to registration calls and ValueHandle
callbacks.

There are no new direct test cases for this pass, but because it calls it
validation function upon module finalization, we'll pick up detectable
inconsistencies from the other tests that touch @llvm.assume calls.

This pass will be used by follow-up commits that make use of @llvm.assume.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217334 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[x86] Revert my over-eager commit in r217332.
Chandler Carruth [Sun, 7 Sep 2014 12:37:11 +0000 (12:37 +0000)]
[x86] Revert my over-eager commit in r217332.

I hadn't actually run all the tests yet and these combines have somewhat
surprisingly far reaching effects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217333 91177308-0d34-0410-b5e6-96231b3b80d8

10 years ago[x86] Tweak the rules surrounding 0,0 and 1,1 v2f64 shuffles and add
Chandler Carruth [Sun, 7 Sep 2014 12:02:14 +0000 (12:02 +0000)]
[x86] Tweak the rules surrounding 0,0 and 1,1 v2f64 shuffles and add
support for MOVDDUP which is really important for matrix multiply style
operations that do lots of non-vector-aligned load and splats.

The original motivation was to add support for MOVDDUP as the lack of it
regresses matmul_f64_4x4 by 5% or so. However, all of the rules here
were somewhat suspicious.

First, we should always be using the floating point domain shuffles,
regardless of how many copies we have to make as a movapd is *crazy*
faster than the domain switching cost on some chips. (Mostly because
movapd is crazy cheap.) Because SHUFPD can't do the copy-for-free trick
of the PSHUF instructions, there is no need to avoid canonicalizing on
UNPCK variants, so do that canonicalizing. This also ensures we have the
chance to form MOVDDUP. =]

Second, we assume SSE2 support when doing any vector lowering, and given
that we should just use UNPCKLPD and UNPCKHPD as they can operate on
registers or memory. If vectors get spilled or come from memory at all
this is going to allow the load to be folded into the operation. If we
want to optimize for encoding size (the only difference, and only
a 2 byte difference) it should be done *much* later, likely after RA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217332 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoTry to unflake AllocatorTest.TestAlignmentPastSlab
Hans Wennborg [Sun, 7 Sep 2014 05:14:29 +0000 (05:14 +0000)]
Try to unflake AllocatorTest.TestAlignmentPastSlab

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217331 91177308-0d34-0410-b5e6-96231b3b80d8

10 years agoBumpPtrAllocator: do the size check without moving any pointers
Hans Wennborg [Sun, 7 Sep 2014 04:24:31 +0000 (04:24 +0000)]
BumpPtrAllocator: do the size check without moving any pointers

Instead of aligning and moving the CurPtr forward, and then comparing
with End, simply calculate how much space is needed, and compare that
to how much is available.

Hopefully this avoids any doubts about comparing addresses possibly
derived from past the end of the slab array, overflowing, etc.

Also add a test where aligning CurPtr would move it past End.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217330 91177308-0d34-0410-b5e6-96231b3b80d8