oota-llvm.git
12 years agoRevert r160602.
Nick Lewycky [Sat, 21 Jul 2012 09:03:15 +0000 (09:03 +0000)]
Revert r160602.

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

12 years agoTeach globalopt to play nice with leak checkers. This is a reapplication of
Nick Lewycky [Sat, 21 Jul 2012 08:29:45 +0000 (08:29 +0000)]
Teach globalopt to play nice with leak checkers. This is a reapplication of
r160529 that was subsequently reverted. The fix was to not call
GV->eraseFromParent() right before the caller does the same. The existing
testcases already caught this bug if run under valgrind.

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

12 years agoFix Mips long branch pass.
Akira Hatanaka [Sat, 21 Jul 2012 03:30:44 +0000 (03:30 +0000)]
Fix Mips long branch pass.

This pass no longer requires that the global pointer value be saved to the
stack or register since it uses bal instruction to compute branch distance.

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

12 years agoAdd HIGHER and HIGHEST relocations to Mips backend.
Akira Hatanaka [Sat, 21 Jul 2012 03:09:04 +0000 (03:09 +0000)]
Add HIGHER and HIGHEST relocations to Mips backend.

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

12 years agoRevert accidental commit.
Akira Hatanaka [Sat, 21 Jul 2012 02:20:33 +0000 (02:20 +0000)]
Revert accidental commit.

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

12 years agoAdd VK_Mips_HIGHER and VK_Mips_HIGHEST to MCSymbolRefExpr::VariantKind.
Akira Hatanaka [Sat, 21 Jul 2012 02:15:19 +0000 (02:15 +0000)]
Add VK_Mips_HIGHER and VK_Mips_HIGHEST to MCSymbolRefExpr::VariantKind.

Test case will be added later when long branch patch is checked in.

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

12 years agobaby steps toward fixing some problems with inbound GEPs that overflow, as discussed...
Nuno Lopes [Fri, 20 Jul 2012 23:07:40 +0000 (23:07 +0000)]
baby steps toward fixing some problems with inbound GEPs that overflow, as discussed 2 months ago or so.
Make sure we do not emit index computations with NSW flags so that we dont get an undef value if the GEP overflows

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

12 years agomove the bounds checking pass to the instrumentation folder, where it belongs. I...
Nuno Lopes [Fri, 20 Jul 2012 22:39:33 +0000 (22:39 +0000)]
move the bounds checking pass to the instrumentation folder, where it belongs. I dunno why in the world I dropped it in the Scalar folder in the first place.
No functionality change.

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

12 years agoRemove unused private member variables uncovered by the recent changes to clang's...
Benjamin Kramer [Fri, 20 Jul 2012 22:05:57 +0000 (22:05 +0000)]
Remove unused private member variables uncovered by the recent changes to clang's -Wunused-private-field.

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

12 years agoFix few warnings.
Galina Kistanova [Fri, 20 Jul 2012 21:30:52 +0000 (21:30 +0000)]
Fix few warnings.

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

12 years agoAvoid folding loads that are unsafe to move.
Jakob Stoklund Olesen [Fri, 20 Jul 2012 21:29:31 +0000 (21:29 +0000)]
Avoid folding loads that are unsafe to move.

LiveRangeEdit::foldAsLoad() can eliminate a register by folding a load
into its only use. Only do that when the load is safe to move, and it
won't extend any live ranges.

This fixes PR13414.

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

12 years agoFix a dangling StringRef bug in the auto upgrader. In one case, we reset
Chandler Carruth [Fri, 20 Jul 2012 21:09:18 +0000 (21:09 +0000)]
Fix a dangling StringRef bug in the auto upgrader. In one case, we reset
CI's name, and then used the StringRef pointing at its old name. I'm
fixing it by storing the name in a std::string, and hoisting the
renaming logic to happen always. This is nicer anyways as it will allow
the upgraded IR to have the same names as the input IR in more cases.

Another bug found by AddressSanitizer. Woot.

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

12 years agoSplit loop exiting edges more aggressively.
Jakob Stoklund Olesen [Fri, 20 Jul 2012 20:49:53 +0000 (20:49 +0000)]
Split loop exiting edges more aggressively.

PHIElimination splits critical edges when it predicts it can resolve
interference and eliminate copies. It doesn't split the edge if the
interference wouldn't be resolved anyway because the phi-use register is
live in the critical edge anyway.

Teach PHIElimination to split loop exiting edges with interference, even
if it wouldn't resolve the interference. This removes the necessary
copies from the loop, which is still an improvement from injecting the
copies into the loop.

The test case demonstrates the improvement. Before:

LBB0_1:
  cmpb  $0, (%rdx)
  leaq  1(%rdx), %rdx
  movl  %esi, %eax
  je  LBB0_1

After:

LBB0_1:
  cmpb  $0, (%rdx)
  leaq  1(%rdx), %rdx
  je  LBB0_1

  movl  %esi, %eax

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

12 years agoTry to unbreak the windows build.
Benjamin Kramer [Fri, 20 Jul 2012 19:49:33 +0000 (19:49 +0000)]
Try to unbreak the windows build.

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

12 years agoSourceMgr: Use has_colors() instead of just is_displayed() before trying to use
Daniel Dunbar [Fri, 20 Jul 2012 18:29:44 +0000 (18:29 +0000)]
SourceMgr: Use has_colors() instead of just is_displayed() before trying to use
color.

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

12 years agoraw_ostream: Add a has_colors() method.
Daniel Dunbar [Fri, 20 Jul 2012 18:29:41 +0000 (18:29 +0000)]
raw_ostream: Add a has_colors() method.

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

12 years agoProcess: Add sys::Process::FileDescriptorHasColors().
Daniel Dunbar [Fri, 20 Jul 2012 18:29:38 +0000 (18:29 +0000)]
Process: Add sys::Process::FileDescriptorHasColors().

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

12 years agolit: Use close_fds=True on UNIX, to avoid file descriptor pollution of
Daniel Dunbar [Fri, 20 Jul 2012 18:29:34 +0000 (18:29 +0000)]
lit: Use close_fds=True on UNIX, to avoid file descriptor pollution of
subprocesses.

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

12 years agoFix assertion in jump threading (PR13405).
Richard Osborne [Fri, 20 Jul 2012 10:36:17 +0000 (10:36 +0000)]
Fix assertion in jump threading (PR13405).

GetBestDestForJumpOnUndef() assumes there is at least 1 successor, which isn't
true if the block ends in an indirect branch with no successors. Fix this by
bailing out earlier in this case.

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

12 years ago[asan] make sure that the crash callbacks do not get merged (Chandler's idea: insert...
Kostya Serebryany [Fri, 20 Jul 2012 09:54:50 +0000 (09:54 +0000)]
[asan] make sure that the crash callbacks do not get merged (Chandler's idea: insert an empty InlineAsm). Change the order in which the new BBs are inserted: the slow path BB is insert between old BBs, the crash BB is inserted at the end. Don't create an empty BB (introduced by recent commits). Update the test. The experimental code that does manual crash callback merge will most likely be deleted later.

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

12 years agoDon't use implicit register operands to calculate L-bit for AVX instructions. Needed...
Craig Topper [Fri, 20 Jul 2012 07:03:46 +0000 (07:03 +0000)]
Don't use implicit register operands to calculate L-bit for AVX instructions. Needed because super reg defs and kills are added as implicit operands on 128-bit instructions. Fixes PR13349. Patch by Jose Fonseca.

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

12 years agoMake RegisterOperand a subclass of DAGOperand so that RegisterOperands can be passed...
Owen Anderson [Fri, 20 Jul 2012 03:38:19 +0000 (03:38 +0000)]
Make RegisterOperand a subclass of DAGOperand so that RegisterOperands can be passed into multiclasses that take DAGOperands as multiclass parameters.

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

12 years agoRevert r160529 due to crashes.
Nick Lewycky [Thu, 19 Jul 2012 23:59:21 +0000 (23:59 +0000)]
Revert r160529 due to crashes.

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

12 years agoFix crash in machine verifier when trying to print the def of a register which has...
Pete Cooper [Thu, 19 Jul 2012 23:40:38 +0000 (23:40 +0000)]
Fix crash in machine verifier when trying to print the def of a register which has no def

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

12 years agoDon't wipe out global variables that are probably storing pointers to heap
Nick Lewycky [Thu, 19 Jul 2012 22:35:28 +0000 (22:35 +0000)]
Don't wipe out global variables that are probably storing pointers to heap
memory. This makes clang play nice with leak checkers.

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

12 years agoReverting r 160419.
Galina Kistanova [Thu, 19 Jul 2012 21:43:55 +0000 (21:43 +0000)]
Reverting r 160419.

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

12 years agoAdds the family codes for the Midview Atom processors so that the
Preston Gurd [Thu, 19 Jul 2012 19:05:37 +0000 (19:05 +0000)]
Adds the family codes for the Midview Atom processors so that the
Atom buildbot will auto-detect Atom.

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

12 years agoFix remaining lit tests which were failing when run on an Atom
Preston Gurd [Thu, 19 Jul 2012 18:53:21 +0000 (18:53 +0000)]
Fix remaining lit tests which were failing when run on an Atom
processor.

Patches by Tyler Nowicki, Andy Zhang, and Preston Gurd!

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

12 years agodefault to use -mv4 when no version of Hexagon has been specified
Sebastian Pop [Thu, 19 Jul 2012 18:24:50 +0000 (18:24 +0000)]
default to use -mv4 when no version of Hexagon has been specified

This fixes a bunch of make check failures of the form:

Unknown Architecture Version.
UNREACHABLE executed at ../lib/Target/Hexagon/HexagonSubtarget.cpp:60!

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

12 years agoreimplement truncate() to make it optimal.
Nuno Lopes [Thu, 19 Jul 2012 16:27:45 +0000 (16:27 +0000)]
reimplement truncate() to make it optimal.
It is optimal at least up to 7 bits (I've tested all such cases)
This change to truncate() allows a little simplification to the multiplication code,
and it also makes multiplication optimal :)

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

12 years agoPull the simple parts of DenseMapInfo<DebugLoc> inline and prune includes.
Benjamin Kramer [Thu, 19 Jul 2012 15:00:34 +0000 (15:00 +0000)]
Pull the simple parts of DenseMapInfo<DebugLoc> inline and prune includes.

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

12 years agotest/DebugInfo/dwarfdump-test.test: Tweak expressions for Win32 to match backslashes...
NAKAMURA Takumi [Thu, 19 Jul 2012 13:40:09 +0000 (13:40 +0000)]
test/DebugInfo/dwarfdump-test.test: Tweak expressions for Win32 to match backslashes. They are still odd, though.

For example, Paths are printed on Win32 as below;

/tmp/dbginfo\def2.cc:4:0
/tmp/dbginfo\include\decl2.h:1:0
/tmp/include\decl.h:5:0

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

12 years agoReplace some explicit compare loops with std::equal.
Benjamin Kramer [Thu, 19 Jul 2012 10:46:05 +0000 (10:46 +0000)]
Replace some explicit compare loops with std::equal.

No functionality change.

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

12 years ago[arm-fast-isel] Add support for vararg function calls.
Jush Lu [Thu, 19 Jul 2012 09:49:00 +0000 (09:49 +0000)]
[arm-fast-isel] Add support for vararg function calls.

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

12 years agoDebugInfo library: add support for fetching absolute paths to source files
Alexey Samsonov [Thu, 19 Jul 2012 07:03:58 +0000 (07:03 +0000)]
DebugInfo library: add support for fetching absolute paths to source files
(instead of basenames) from DWARF. Use this behavior in llvm-dwarfdump tool.

Reviewed by Benjamin Kramer.

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

12 years agoFixed few warnings.
Galina Kistanova [Thu, 19 Jul 2012 04:50:12 +0000 (04:50 +0000)]
Fixed few warnings.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:25:04 +0000 (00:25 +0000)]
Remove tabs.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:23:13 +0000 (00:23 +0000)]
Remove tabs.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:17:40 +0000 (00:17 +0000)]
Remove tabs.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:15:11 +0000 (00:15 +0000)]
Remove tabs.

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

12 years agoTweak prose.
Chad Rosier [Thu, 19 Jul 2012 00:11:45 +0000 (00:11 +0000)]
Tweak prose.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:11:40 +0000 (00:11 +0000)]
Remove tabs.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:06:06 +0000 (00:06 +0000)]
Remove tabs.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:04:14 +0000 (00:04 +0000)]
Remove tabs.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:01:33 +0000 (00:01 +0000)]
Remove tabs.

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

12 years agoRemove tabs.
Bill Wendling [Thu, 19 Jul 2012 00:01:00 +0000 (00:01 +0000)]
Remove tabs.

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

12 years agoRemove tabs.
Bill Wendling [Wed, 18 Jul 2012 23:58:37 +0000 (23:58 +0000)]
Remove tabs.

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

12 years agoMove around some enum elements so that lastMRM corrects gets assigned 56, which
Richard Trieu [Wed, 18 Jul 2012 23:04:22 +0000 (23:04 +0000)]
Move around some enum elements so that lastMRM corrects gets assigned 56, which
is one more that MRM_DF which is 55.  Previously, it held value 45, the same
as MRM_D0.

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

12 years agoTblGen: Tweak to pretty-print DAGISel.inc a bit better.
Jim Grosbach [Wed, 18 Jul 2012 22:41:03 +0000 (22:41 +0000)]
TblGen: Tweak to pretty-print DAGISel.inc a bit better.

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

12 years agoAllow PointerIntPairs to be created from const void *.
Jordan Rose [Wed, 18 Jul 2012 21:58:49 +0000 (21:58 +0000)]
Allow PointerIntPairs to be created from const void *.

For a measure of safety, this conversion is only permitted if the
stored pointer type can also be created from a const void *.

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

12 years agoX86: remove redundant cmp against zero.
Manman Ren [Wed, 18 Jul 2012 21:40:01 +0000 (21:40 +0000)]
X86: remove redundant cmp against zero.

Updated OptimizeCompare in peephole to remove redundant cmp against zero.
We only remove Compare if CF and OF are not used.

rdar://11855129

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

12 years agoThis patch fixes 8 out of 20 unexpected failures in "make check"
Preston Gurd [Wed, 18 Jul 2012 20:49:17 +0000 (20:49 +0000)]
This patch fixes 8 out of 20 unexpected failures in "make check"
when run on an Intel Atom processor. The failures have arisen due
to changes elsewhere in the trunk over the past 8 weeks or so.

These failures were not detected by the Atom buildbot because the
CPU on the Atom buildbot was not being detected as an Atom CPU.
The fix for this problem is in Host.cpp and X86Subtarget.cpp, but
shall remain commented out until the current set of Atom test failures
are fixed.

Patch by Andy Zhang and Tyler Nowicki!

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

12 years agoAdding some debug information to PassManager
Victor Oliveira [Wed, 18 Jul 2012 19:59:29 +0000 (19:59 +0000)]
Adding some debug information to PassManager

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

12 years agoWhitespace.
Chad Rosier [Wed, 18 Jul 2012 19:35:16 +0000 (19:35 +0000)]
Whitespace.

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

12 years agoFix a somewhat nasty crasher in PR13378. This crashes inside of
Chandler Carruth [Wed, 18 Jul 2012 18:58:22 +0000 (18:58 +0000)]
Fix a somewhat nasty crasher in PR13378. This crashes inside of
LiveIntervals due to the two-addr pass generating bogus MI code.

The crux of the issue was a loop nesting problem. The intent of the code
which attempts to transform instructions before converting them to
two-addr form is to defer and reprocess any transformed instructions as
the second processing is likely to have more opportunities to coalesce
copies, etc. Unfortunately, there was one section of processing that was
not deferred -- the INSERT_SUBREG rewriting. Due to quirks of how this
rewriting proceeded, not only did it occur early, it removed the bits of
information needed for the deferred processing to correctly generate the
necessary two address form (specifically inserting a copy), but didn't
trigger any immediate assertions and produced what appeared to be
already valid two-address from code. Thus, the assertion only fired much
later in the pipeline.

The fix is to hoist the transformation logic up layer to where it can
more firmly defer all further processing, and to teach the normal
processing to handle an edge case previously handled as part of the
transformation logic. This edge case (already matched tied register
operands) needs to *not* defer any steps.

As has been brought up repeatedly in the process: wow does this code
need refactoring. I *may* squeeze in some time to at least bring sanity
to this loop... but wow... =]

Thanks to Jakob for helpful hints on the way here, and the review.

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

12 years agoFix ARMTargetLowering::isLegalAddImmediate to consider thumb encodings.
Andrew Trick [Wed, 18 Jul 2012 18:34:27 +0000 (18:34 +0000)]
Fix ARMTargetLowering::isLegalAddImmediate to consider thumb encodings.

Based on Evan's suggestion without a commitable test.

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

12 years agowhitespace
Andrew Trick [Wed, 18 Jul 2012 18:34:24 +0000 (18:34 +0000)]
whitespace

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

12 years agoAdded unit test for PR13361: LSR + SCEV "hangs" on reasonably sized test.
Andrew Trick [Wed, 18 Jul 2012 18:07:52 +0000 (18:07 +0000)]
Added unit test for PR13361: LSR + SCEV "hangs" on reasonably sized test.

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

12 years agotest commit
Victor Oliveira [Wed, 18 Jul 2012 17:53:05 +0000 (17:53 +0000)]
test commit

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

12 years agoAdd some missed ELF constants definitions:
Simon Atanasyan [Wed, 18 Jul 2012 14:12:32 +0000 (14:12 +0000)]
Add some missed ELF constants definitions:
- section types
- dynamic table entries tags
- state flags for DT_FLAGS_1 entry

The patch reviewed by Rafael Espindola.

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

12 years agoUpdate config.h.cmake corresponding to config.h.in.
NAKAMURA Takumi [Wed, 18 Jul 2012 09:17:02 +0000 (09:17 +0000)]
Update config.h.cmake corresponding to config.h.in.

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

12 years agoThe vbroadcast family of instructions has 'fallback patterns' in case where the
Nadav Rotem [Wed, 18 Jul 2012 08:14:48 +0000 (08:14 +0000)]
The vbroadcast family of instructions has 'fallback patterns' in case where the
load source operand is used by multiple nodes. The v2i64 broadcast was emulated
by shuffling the two lower i32 elements to the upper two.
We had a bug in the immediate used for the broadcast.
Replacing 0 to 0x44.
0x44 means [01|00|01|00] which corresponds to the correct lane.

Patch by Michael Kuperstein.

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

12 years agoMips specific inline asm operand modifier 'M':
Jack Carter [Wed, 18 Jul 2012 06:41:36 +0000 (06:41 +0000)]
Mips specific inline asm operand modifier 'M':

Print the high order register of a double word register operand.

In 32 bit mode, a 64 bit double word integer will be represented
by 2 32 bit registers. This modifier causes the high order register
to be used in the asm expression. It is useful if you are using
doubles in assembler and continue to control register to variable
relationships.

This patch also fixes a related bug in a previous patch:

    case 'D': // Second part of a double word register operand
    case 'L': // Low order register of a double word register operand
    case 'M': // High order register of a double word register operand

I got 'D' and 'M' confused. The second part of a double word operand
will only match 'M' for one of the endianesses. I had 'L' and 'D'
be the opposite twins when 'L' and 'M' are.

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

12 years agoSCEVTraversal: Add a visited set.
Andrew Trick [Wed, 18 Jul 2012 05:14:03 +0000 (05:14 +0000)]
SCEVTraversal: Add a visited set.

Expression trees may be DAGs. Make sure traversal has linear complexity.

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

12 years agoRemove tab characters.
Craig Topper [Wed, 18 Jul 2012 04:59:16 +0000 (04:59 +0000)]
Remove tab characters.

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

12 years agoFix typo in error message and remove some tab characters.
Craig Topper [Wed, 18 Jul 2012 04:36:35 +0000 (04:36 +0000)]
Fix typo in error message and remove some tab characters.

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

12 years agoindvars: drive by heuristics fix.
Andrew Trick [Wed, 18 Jul 2012 04:35:13 +0000 (04:35 +0000)]
indvars: drive by heuristics fix.

Minor oversight noticed by inspection. Sorry no unit test.

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

12 years agoindvars: Linear function test replace should avoid reusing undef.
Andrew Trick [Wed, 18 Jul 2012 04:35:10 +0000 (04:35 +0000)]
indvars: Linear function test replace should avoid reusing undef.

Fixes PR13371: indvars pass incorrectly substitutes 'undef' values.

I do not like this fix. It's needed until/unless the meaning of undef
changes. It attempts to be complete according to the IR spec, but I
don't have much confidence in the implementation given the difficulty
testing undefined behavior. Worse, this invalidates some of my
hard-fought work on indvars and LSR to optimize pointer induction
variables. It results benchmark regressions, which I'll track
internally. On x86_64 no LTO I see:

-3% huffbench
-3% 400.perlbench
-8% fhourstones

My only suggestion for recovering is to change the meaning of
undef. If we could trust an arbitrary instruction to produce a some
real value that can be manipulated (e.g. incremented) according to
non-undef rules, then this case could be easily handled with SCEV.

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

12 years agoMake x86 asm parser to check for xmm vs ymm for index register in gather instructions...
Craig Topper [Wed, 18 Jul 2012 04:11:12 +0000 (04:11 +0000)]
Make x86 asm parser to check for xmm vs ymm for index register in gather instructions. Also fix Intel syntax for gather instructions to use 'DWORD PTR' or 'QWORD PTR' to match gas.

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

12 years agoFixed few warnings.
Galina Kistanova [Wed, 18 Jul 2012 04:06:49 +0000 (04:06 +0000)]
Fixed few warnings.

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

12 years agoignore 'invoke @llvm.donothing', but still keep the edge to the continuation BB
Nuno Lopes [Wed, 18 Jul 2012 00:07:17 +0000 (00:07 +0000)]
ignore 'invoke @llvm.donothing', but still keep the edge to the continuation BB

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

12 years agoMore replacing of target-dependent intrinsics with target-indepdent
Joel Jones [Wed, 18 Jul 2012 00:02:16 +0000 (00:02 +0000)]
More replacing of  target-dependent intrinsics with target-indepdent
intrinsics.  The second instruction(s) to be handled are the vector versions
of count set bits (ctpop).

The changes here are to clang so that it generates a target independent
vector ctpop when it sees an ARM dependent vector bits set count.  The changes
in llvm are to match the target independent vector ctpop and in
VMCore/AutoUpgrade.cpp to update any existing bc files containing ARM
dependent vector pop counts with target-independent ctpops.  There are also
changes to an existing test case in llvm for ARM vector count instructions and
to a test for the bitcode upgrade.

<rdar://problem/11892519>

There is deliberately no test for the change to clang, as so far as I know, no
consensus has been reached regarding how to test neon instructions in clang;
q.v. <rdar://problem/8762292>

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

12 years agoApparently it's possible to do an 'invoke asm'.
Nuno Lopes [Tue, 17 Jul 2012 23:51:33 +0000 (23:51 +0000)]
Apparently it's possible to do an 'invoke asm'.
Update the language reference to reflect that.

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

12 years agoClean up Mips16InstrFormats.td and Mips16InstrInfo.td.
Akira Hatanaka [Tue, 17 Jul 2012 22:55:34 +0000 (22:55 +0000)]
Clean up Mips16InstrFormats.td and Mips16InstrInfo.td.

Patch by Reed Kotler.

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

12 years agoAdd test case for r160387
Evan Cheng [Tue, 17 Jul 2012 19:40:05 +0000 (19:40 +0000)]
Add test case for r160387

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

12 years agoBack out r160101 and instead implement a dag combine to recover from instcombine...
Evan Cheng [Tue, 17 Jul 2012 18:54:11 +0000 (18:54 +0000)]
Back out r160101 and instead implement a dag combine to recover from instcombine transformation.

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

12 years agoTableGen: Pattern<> references to null_frag are a nop.
Jim Grosbach [Tue, 17 Jul 2012 18:39:36 +0000 (18:39 +0000)]
TableGen: Pattern<> references to null_frag are a nop.

A standalone pattern defined in a multiclass expansion should handle
null_frag references just like patterns on instructions. Follow-up to
r160333.

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

12 years agoFix broken ipo_ext_iterator constructors.
Jakob Stoklund Olesen [Tue, 17 Jul 2012 17:57:25 +0000 (17:57 +0000)]
Fix broken ipo_ext_iterator constructors.

These functions have obviously never been used before.
They should be identical to the idf_ext_iterator counterparts.

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

12 years agoAdd some trace output to TwoAddressInstructionPass.
Jakob Stoklund Olesen [Tue, 17 Jul 2012 17:57:23 +0000 (17:57 +0000)]
Add some trace output to TwoAddressInstructionPass.

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

12 years agoRemove unused variable.
Benjamin Kramer [Tue, 17 Jul 2012 17:00:11 +0000 (17:00 +0000)]
Remove unused variable.

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

12 years agosimplify getSetSize() per Duncan's comments
Nuno Lopes [Tue, 17 Jul 2012 15:43:59 +0000 (15:43 +0000)]
simplify getSetSize() per Duncan's comments

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

12 years agollvm/test/Transforms/LoopRotate/PhiRename-1.ll: FileCheck-ize. It fixes PR13301.
NAKAMURA Takumi [Tue, 17 Jul 2012 15:43:17 +0000 (15:43 +0000)]
llvm/test/Transforms/LoopRotate/PhiRename-1.ll: FileCheck-ize. It fixes PR13301.

It began choking since Chandler's r159547, possibly due to improper expression on grep from TclParser to ShParser.

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

12 years agoAllow for customized graph edge pruning in PostOrderIterator.h
Jakob Stoklund Olesen [Tue, 17 Jul 2012 15:35:40 +0000 (15:35 +0000)]
Allow for customized graph edge pruning in PostOrderIterator.h

Make it possible to prune individual graph edges from a post-order
traversal by specializing the po_iterator_storage template. Previously,
it was only possible to prune full graph nodes. Edge pruning makes it
possible to remove loop back-edges, for example.

Also replace the existing DFSetTraits customization hook with a
po_iterator_storage method for observing the post-order. DFSetTraits was
only used by LoopIterator.h which now provides a po_iterator_storage
specialization.

Thanks to Sean and Chandler for reviewing.

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

12 years agoImprove behavior of DebugInfoEntryMinimal::getSubprogramName() introduced in r159512.
Alexey Samsonov [Tue, 17 Jul 2012 15:28:35 +0000 (15:28 +0000)]
Improve behavior of DebugInfoEntryMinimal::getSubprogramName() introduced in r159512.
To fetch a subprogram name we should not only inspect the DIE for this subprogram, but optionally inspect
its specification, or its abstract origin (even if there is no inlining), or even specification of an abstract origin.

Reviewed by Benjamin Kramer.

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

12 years ago[asan] more code to merge crash callbacks. Doesn't fully work yet, but allows to...
Kostya Serebryany [Tue, 17 Jul 2012 11:04:12 +0000 (11:04 +0000)]
[asan] more code to merge crash callbacks. Doesn't fully work yet, but allows to hold performance experiments

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

12 years agoFix a crash in the legalization of large vectors.
Nadav Rotem [Tue, 17 Jul 2012 09:07:37 +0000 (09:07 +0000)]
Fix a crash in the legalization of large vectors.
When truncating a result of a vector that is split we need
to use the result of the split vector, and not re-split the dead node.

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

12 years agoImplement r160312 as target indepedenet dag combine.
Evan Cheng [Tue, 17 Jul 2012 08:31:11 +0000 (08:31 +0000)]
Implement r160312 as target indepedenet dag combine.

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

12 years agoRevert commit r160307. We decide to move builtins selection to the backend.
Simon Atanasyan [Tue, 17 Jul 2012 08:14:45 +0000 (08:14 +0000)]
Revert commit r160307. We decide to move builtins selection to the backend.

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

12 years agoMake sure constant bitwidth is <= 64 bit before calling getSExtValue().
Evan Cheng [Tue, 17 Jul 2012 07:47:50 +0000 (07:47 +0000)]
Make sure constant bitwidth is <= 64 bit before calling getSExtValue().

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

12 years agoThis is another case where instcombine demanded bits optimization created
Evan Cheng [Tue, 17 Jul 2012 06:53:39 +0000 (06:53 +0000)]
This is another case where instcombine demanded bits optimization created
large immediates. Add dag combine logic to recover in case the large
immediates doesn't fit in cmp immediate operand field.

int foo(unsigned long l) {
  return (l>> 47) == 1;
}

we produce

  %shr.mask = and i64 %l, -140737488355328
  %cmp = icmp eq i64 %shr.mask, 140737488355328
  %conv = zext i1 %cmp to i32
  ret i32 %conv

which codegens to

movq    $0xffff800000000000,%rax
andq    %rdi,%rax
movq    $0x0000800000000000,%rcx
cmpq    %rcx,%rax
sete    %al
movzbl    %al,%eax
ret

TargetLowering::SimplifySetCC would transform
(X & -256) == 256 -> (X >> 8) == 1
if the immediate fails the isLegalICmpImmediate() test. For x86,
that's immediates which are not a signed 32-bit immediate.

Based on a patch by Eli Friedman.

PR10328
rdar://9758774

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

12 years agoReapply r160340. LSR: Limit CollectSubexprs.
Andrew Trick [Tue, 17 Jul 2012 05:30:37 +0000 (05:30 +0000)]
Reapply r160340. LSR: Limit CollectSubexprs.

Speculatively fix crashes by code inspection. Can't reproduce them yet.

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

12 years agoRevert "LSR: try not to blow up solving combinatorial problems brute force."
Andrew Trick [Tue, 17 Jul 2012 05:05:21 +0000 (05:05 +0000)]
Revert "LSR: try not to blow up solving combinatorial problems brute force."

Some units tests crashed on a different platform.

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

12 years agoLSR: try not to blow up solving combinatorial problems brute force.
Andrew Trick [Tue, 17 Jul 2012 05:00:56 +0000 (05:00 +0000)]
LSR: try not to blow up solving combinatorial problems brute force.

This places limits on CollectSubexprs to constrains the number of
reassociation possibilities. It limits the recursion depth and skips
over chains of nested recurrences outside the current loop.

Fixes PR13361. Although underlying SCEV behavior is still potentially bad.

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

12 years agoTableGen: Allow conditional instruction pattern in multiclass.
Jim Grosbach [Tue, 17 Jul 2012 00:47:06 +0000 (00:47 +0000)]
TableGen: Allow conditional instruction pattern in multiclass.

Define a 'null_frag' SDPatternOperator node, which if referenced in an
instruction Pattern, results in the pattern being collapsed to be as-if
'[]' had been specified instead. This allows supporting a multiclass
definition where some instaniations have ISel patterns associated and
others do not.

For example,
multiclass myMulti<RegisterClass rc, SDPatternOperator OpNode = null_frag> {
  def _x : myI<(outs rc:), (ins rc:), []>;
  def _r : myI<(outs rc:), (ins rc:), [(set rc:, (OpNode rc:))]>;
}

defm foo : myMulti<GRa, not>;
defm bar : myMulti<GRb>;

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

12 years agoFix function select_cc_f32 in test/CodeGen/Mips/selectcc.ll.
Akira Hatanaka [Mon, 16 Jul 2012 23:56:51 +0000 (23:56 +0000)]
Fix function select_cc_f32 in test/CodeGen/Mips/selectcc.ll.

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

12 years agoDefer checking for registers in the MC AsmMatcher until the after user-defined match...
Owen Anderson [Mon, 16 Jul 2012 23:20:09 +0000 (23:20 +0000)]
Defer checking for registers in the MC AsmMatcher until the after user-defined match classes have been checked.  This allows the creation of MatchClass's that are supersets of a register class.

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

12 years agofix PR13339 (remove the predecessor from the unwind BB when removing an invoke)
Nuno Lopes [Mon, 16 Jul 2012 22:49:40 +0000 (22:49 +0000)]
fix PR13339 (remove the predecessor from the unwind BB when removing an invoke)

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

12 years agoteach ConstantRange that zero times X is always zero
Nuno Lopes [Mon, 16 Jul 2012 20:47:16 +0000 (20:47 +0000)]
teach ConstantRange that zero times X is always zero

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

12 years agoFor something like
Evan Cheng [Mon, 16 Jul 2012 19:35:43 +0000 (19:35 +0000)]
For something like
uint32_t hi(uint64_t res)
{
        uint_32t hi = res >> 32;
        return !hi;
}

llvm IR looks like this:
define i32 @hi(i64 %res) nounwind uwtable ssp {
entry:
  %lnot = icmp ult i64 %res, 4294967296
  %lnot.ext = zext i1 %lnot to i32
  ret i32 %lnot.ext
}

The optimizer has optimize away the right shift and truncate but the resulting
constant is too large to fit in the 32-bit immediate field. The resulting x86
code is worse as a result:
        movabsq $4294967296, %rax       ## imm = 0x100000000
        cmpq    %rax, %rdi
        sbbl    %eax, %eax
        andl    $1, %eax

This patch teaches the x86 lowering code to handle ult against a large immediate
with trailing zeros. It will issue a right shift and a truncate followed by
a comparison against a shifted immediate.
        shrq    $32, %rdi
        testl   %edi, %edi
        sete    %al
        movzbl  %al, %eax

It also handles a ugt comparison against a large immediate with trailing bits
set. i.e. X >  0x0ffffffff -> (X >> 32) >= 1

rdar://11866926

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

12 years agoMinor cleanup and docs.
Nadav Rotem [Mon, 16 Jul 2012 18:56:39 +0000 (18:56 +0000)]
Minor cleanup and docs.

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