oota-llvm.git
12 years agoPerform partial SROA on the helper hashing structure. I really wish the
Chandler Carruth [Sat, 7 Apr 2012 20:01:31 +0000 (20:01 +0000)]
Perform partial SROA on the helper hashing structure. I really wish the
optimizers could do this for us, but expecting partial SROA of classes
with template methods through cloning is probably expecting too much
heroics. With this change, the begin/end pointer pairs which indicate
the status of each loop iteration are actually passed directly into each
layer of the combine_data calls, and the inliner has a chance to see
when most of the combine_data function could be deleted by inlining.
Similarly for 'length'.

We have to be careful to limit the places where in/out reference
parameters are used as those will also defeat the inliner / optimizers
from properly propagating constants.

With this change, LLVM is able to fully inline and unroll the hash
computation of small sets of values, such as two or three pointers.
These now decompose into essentially straight-line code with no loops or
function calls.

There is still one code quality problem to be solved with the hashing --
LLVM is failing to nuke the alloca. It removes all loads from the
alloca, leaving only lifetime intrinsics and dead(!!) stores to the
alloca. =/ Very unfortunate.

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

12 years agoFix ValueTracking to conclude that debug intrinsics are safe to
Chandler Carruth [Sat, 7 Apr 2012 19:22:18 +0000 (19:22 +0000)]
Fix ValueTracking to conclude that debug intrinsics are safe to
speculate. Without this, loop rotate (among many other places) would
suddenly stop working in the presence of debug info. I found this
looking at loop rotate, and have augmented its tests with a reduction
out of a very hot loop in yacr2 where failing to do this rotation costs
sometimes more than 10% in runtime performance, perturbing numerous
downstream optimizations.

This should have no impact on performance without debug info, but the
change in performance when debug info is enabled can be extreme. As
a consequence (and this how I got to this yak) any profiling of
performance problems should be treated with deep suspicion -- they may
have been wildly innacurate of debug info was enabled for profiling. =/
Just a heads up.

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

12 years agoSCEV: When expanding a GEP the final addition to the base pointer has NUW but not...
Benjamin Kramer [Sat, 7 Apr 2012 17:19:26 +0000 (17:19 +0000)]
SCEV: When expanding a GEP the final addition to the base pointer has NUW but not NSW.

Found by inspection.

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

12 years agoFix Thumb __builtin_longjmp with integrated assembler. <rdar://problem/11203543>
Bob Wilson [Sat, 7 Apr 2012 16:51:59 +0000 (16:51 +0000)]
Fix Thumb __builtin_longjmp with integrated assembler. <rdar://problem/11203543>

The tLDRr instruction with the last register operand set to the zero register
prints in assembly as if no register was specified, and the assembler encodes
it as a tLDRi instruction with a zero immediate.  With the integrated assembler,
that zero register gets emitted as "r0", so we get "ldr rx, [ry, r0]" which
is broken.  Emit the instruction as tLDRi with a zero immediate.  I don't
know if there's a good way to write a testcase for this.  Suggestions welcome.

Opportunities for follow-up work:
1) The asm printer should complain if a non-optional register operand is set
   to the zero register, instead of silently dropping it.
2) The integrated assembler should complain in the same situation, instead of
   silently emitting the operand as "r0".

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

12 years agoRefactor: Use positive field names in VectorizeConfig.
Hongbin Zheng [Sat, 7 Apr 2012 03:56:23 +0000 (03:56 +0000)]
Refactor: Use positive field names in VectorizeConfig.

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

12 years agoTarget/X86/MCTargetDesc/X86MCAsmInfo.cpp: Enable DwarfCFI (aka DW2) on Cygming.
NAKAMURA Takumi [Sat, 7 Apr 2012 02:24:20 +0000 (02:24 +0000)]
Target/X86/MCTargetDesc/X86MCAsmInfo.cpp: Enable DwarfCFI (aka DW2) on Cygming.

Cygwin-1.7 supports dw2. Some recent mingw distros support one, too.
I have confirmed test-suite/SingleSource/Benchmarks/Shootout-C++/except.cpp can pass on Cygwin.

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

12 years agoMake the test for r154235 more platform-independent with a shorter
Sean Hunt [Sat, 7 Apr 2012 01:33:14 +0000 (01:33 +0000)]
Make the test for r154235 more platform-independent with a shorter
string.

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

12 years agoOutput UTF-8-encoded characters as identifier characters into assembly
Sean Hunt [Sat, 7 Apr 2012 00:37:53 +0000 (00:37 +0000)]
Output UTF-8-encoded characters as identifier characters into assembly
by default.

This is a behaviour configurable in the MCAsmInfo. I've decided to turn
it on by default in (possibly optimistic) hopes that most assemblers are
reasonably sane. If this proves a problem, switching to default seems
reasonable.

I'm not sure if this is the opportune place to test, but it seemed good
to make sure it was tested somewhere.

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

12 years agoTidy up. 80 columns.
Jim Grosbach [Fri, 6 Apr 2012 23:43:50 +0000 (23:43 +0000)]
Tidy up. 80 columns.

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

12 years agoARMPat is equivalent to Requires<[IsARM]>.
Jakob Stoklund Olesen [Fri, 6 Apr 2012 21:21:59 +0000 (21:21 +0000)]
ARMPat is equivalent to Requires<[IsARM]>.

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

12 years agoEliminate iOS-specific tail call instructions.
Jakob Stoklund Olesen [Fri, 6 Apr 2012 21:17:42 +0000 (21:17 +0000)]
Eliminate iOS-specific tail call instructions.

After register masks were introdruced to represent the call clobbers, it
is no longer necessary to have duplicate instruction for iOS.

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

12 years agoAdd lines in global-address.ll to test N32 and N64 code generation.
Akira Hatanaka [Fri, 6 Apr 2012 20:23:36 +0000 (20:23 +0000)]
Add lines in global-address.ll to test N32 and N64 code generation.

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

12 years agoThere is no portable std::abs overload for int64_t, use the llvm::abs64
Chandler Carruth [Fri, 6 Apr 2012 20:10:52 +0000 (20:10 +0000)]
There is no portable std::abs overload for int64_t, use the llvm::abs64
which exists for this purpose.

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

12 years agoFixed two leaks in the MC disassembler. The MC
Sean Callanan [Fri, 6 Apr 2012 18:21:09 +0000 (18:21 +0000)]
Fixed two leaks in the MC disassembler.  The MC
disassembler requires a MCSubtargetInfo and a
MCInstrInfo to exist in order to initialize the
instruction printer and disassembler; however,
although the printer and disassembler keep
references to these objects they do not own them.
Previously, the MCSubtargetInfo and MCInstrInfo
objects were just leaked.

I have extended LLVMDisasmContext to own these
objects and delete them when it is destroyed.

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

12 years agoAllow negative immediates in ARM and Thumb2 compares.
Jakob Stoklund Olesen [Fri, 6 Apr 2012 17:45:04 +0000 (17:45 +0000)]
Allow negative immediates in ARM and Thumb2 compares.

ARM and Thumb2 mode can use cmn instructions to compare against negative
immediates. Thumb1 mode can't.

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

12 years agoReintroduce InlineCostAnalyzer::getInlineCost() variant with explicit callee
David Chisnall [Fri, 6 Apr 2012 17:27:41 +0000 (17:27 +0000)]
Reintroduce InlineCostAnalyzer::getInlineCost() variant with explicit callee
parameter until we have a more sensible API for doing the same thing.

Reviewed by Chandler.

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

12 years agoSink the collection of return instructions until after *all*
Chandler Carruth [Fri, 6 Apr 2012 17:21:31 +0000 (17:21 +0000)]
Sink the collection of return instructions until after *all*
simplification has been performed. This is a bit less efficient
(requires another ilist walk of the basic blocks) but shouldn't matter
in practice. More importantly, it's just too much work to keep track of
all the various ways the return instructions can be mutated while
simplifying them. This fixes yet another crasher, reported by Daniel
Dunbar.

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

12 years agoTweak this test to ensure the inliner did indeed fire. Thanks to Richard
Chandler Carruth [Fri, 6 Apr 2012 17:21:28 +0000 (17:21 +0000)]
Tweak this test to ensure the inliner did indeed fire. Thanks to Richard
Smith for pointing this out in review.

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

12 years agoMake GVN's propagateEquality non-recursive. No intended functionality change.
Duncan Sands [Fri, 6 Apr 2012 15:31:09 +0000 (15:31 +0000)]
Make GVN's propagateEquality non-recursive.  No intended functionality change.
The modifications are a lot more trivial than they appear to be in the diff!

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

12 years agoTest case for PR12413
Craig Topper [Fri, 6 Apr 2012 14:38:25 +0000 (14:38 +0000)]
Test case for PR12413

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

12 years agoFix narrowing conversion.
Benjamin Kramer [Fri, 6 Apr 2012 13:33:52 +0000 (13:33 +0000)]
Fix narrowing conversion.

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

12 years agoDenseMap: Perform the pod-like object optimization when the value type is POD-like...
Benjamin Kramer [Fri, 6 Apr 2012 10:43:44 +0000 (10:43 +0000)]
DenseMap: Perform the pod-like object optimization when the value type is POD-like, not the DenseMapInfo for it.

Purge now unused template arguments. This has been broken since r91421. Patch by Lubos Lunak!

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

12 years agoAllow 256-bit shuffles to be split if a 128-bit lane contains elements from a single...
Craig Topper [Fri, 6 Apr 2012 07:45:23 +0000 (07:45 +0000)]
Allow 256-bit shuffles to be split if a 128-bit lane contains elements from a single source. This is a rewrite of the 256-bit shuffle splitting code based on similar code from legalize types. Fixes PR12413.

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

12 years agoAdd the tests that were supposed to go with r153935 that I forgot svn add
Craig Topper [Fri, 6 Apr 2012 07:09:59 +0000 (07:09 +0000)]
Add the tests that were supposed to go with r153935 that I forgot svn add

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

12 years agoActually finish this sentence in the comment the way I intended. Thanks
Chandler Carruth [Fri, 6 Apr 2012 01:19:38 +0000 (01:19 +0000)]
Actually finish this sentence in the comment the way I intended. Thanks
Matt for pointing this out.

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

12 years agoSink the return instruction collection until after we're done deleting
Chandler Carruth [Fri, 6 Apr 2012 01:11:52 +0000 (01:11 +0000)]
Sink the return instruction collection until after we're done deleting
dead code, including dead return instructions in some cases. Otherwise,
we end up having a bogus poniter to a return instruction that blows up
much further down the road.

It turns out that this pattern is both simpler to code, easier to update
in the face of enhancements to the inliner cleanup, and likely cheaper
given that it won't add dead instructions to the list.

Thanks to John Regehr's numerous test cases for teasing this out.

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

12 years agoDeduplicate ARM call-related instructions.
Jakob Stoklund Olesen [Fri, 6 Apr 2012 00:04:58 +0000 (00:04 +0000)]
Deduplicate ARM call-related instructions.

We had special instructions for iOS because r9 is call-clobbered, but
that is represented dynamically by the register mask operands now, so
there is no need for the pseudo-instructions.

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

12 years agoARM: Don't form a t2LDRi8 or t2STRi8 with an offset of zero.
Jim Grosbach [Thu, 5 Apr 2012 23:51:24 +0000 (23:51 +0000)]
ARM: Don't form a t2LDRi8 or t2STRi8 with an offset of zero.

The load/store optimizer splits LDRD/STRD into two instructions when the
register pairing doesn't work out. For negative offsets in Thumb2, it uses
t2STRi8 to do that. That's fine, except for the case when the offset is in
the range [-4,-1]. In that case, we'll also form a second t2STRi8 with
the original offset plus 4, resulting in a t2STRi8 with a non-negative
offset, which ends up as if it were an STRT, which is completely bogus.
Similarly for loads.

No testcase, unfortunately, as any I've been able to construct is both large
and extremely fragile.

rdar://11193937

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

12 years agoFix the build breakage introduced by r154131.
Kaelyn Uhrain [Thu, 5 Apr 2012 23:06:17 +0000 (23:06 +0000)]
Fix the build breakage introduced by r154131.

The empty 1-argument operator delete is for the benefit of the
destructor. A couple of spot checks of running yaml-bench under
valgrind against a few of the files under test/YAMLParser did
not reveal any leaks introduced by this change.

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

12 years agoReally fix -Wnon-virtual-dtor warnings; gcc needs the dtors to be
Kaelyn Uhrain [Thu, 5 Apr 2012 22:11:12 +0000 (22:11 +0000)]
Really fix -Wnon-virtual-dtor warnings; gcc needs the dtors to be
explicitly marked as virtual.

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

12 years agoThe internalize pass can be dangerous for LTO.
Bill Wendling [Thu, 5 Apr 2012 21:26:44 +0000 (21:26 +0000)]
The internalize pass can be dangerous for LTO.

Consider the following program:

$ cat main.c
void foo(void) { }

int main(int argc, char *argv[]) {
    foo();
    return 0;
}
$ cat bundle.c
extern void foo(void);

void bar(void) {
     foo();
}
$ clang -o main main.c
$ clang -o bundle.so bundle.c -bundle -bundle_loader ./main
$ nm -m bundle.so
0000000000000f40 (__TEXT,__text) external _bar
                 (undefined) external _foo (from executable)
                 (undefined) external dyld_stub_binder (from libSystem)
$ clang -o main main.c -O4
$ clang -o bundle.so bundle.c -bundle -bundle_loader ./main
Undefined symbols for architecture x86_64:
  "_foo", referenced from:
      _bar in bundle-elQN6d.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The linker was told that the 'foo' in 'main' was 'internal' and had no uses, so
it was dead stripped.

Another situation is something like:

define void @foo() {
  ret void
}

define void @bar() {
  call asm volatile "call _foo" ...
  ret void
}

The only use of 'foo' is inside of an inline ASM call. Since we don't look
inside those for uses of functions, we don't specify this as a "use."

Get around this by not invoking the 'internalize' pass by default. This is an
admitted hack for LTO correctness.
<rdar://problem/11185386>

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

12 years agoARM assembly aliases for add negative immediates using sub.
Jim Grosbach [Thu, 5 Apr 2012 20:57:13 +0000 (20:57 +0000)]
ARM assembly aliases for add negative immediates using sub.

'add r2, #-1024' should just use 'sub r2, #1024' rather than erroring out.
Thumb1 aliases for adding a negative immediate to the stack pointer,
also.

rdar://11192734

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

12 years agoReapply test case in 154038, this time with triple to prevent the backend
Akira Hatanaka [Thu, 5 Apr 2012 20:44:35 +0000 (20:44 +0000)]
Reapply test case in 154038, this time with triple to prevent the backend
from emitting gp_rel relocation.

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

12 years agoPatch to set is_stmt a little better for prologue lines in a function.
Eric Christopher [Thu, 5 Apr 2012 20:39:05 +0000 (20:39 +0000)]
Patch to set is_stmt a little better for prologue lines in a function.
This enables debuggers to see what are interesting lines for a
breakpoint rather than any line that starts a function.

rdar://9852092

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

12 years agoDon't break the IV update in TLI::SimplifySetCC().
Jakob Stoklund Olesen [Thu, 5 Apr 2012 20:30:20 +0000 (20:30 +0000)]
Don't break the IV update in TLI::SimplifySetCC().

LSR always tries to make the ICmp in the loop latch use the incremented
induction variable. This allows the induction variable to be kept in a
single register.

When the induction variable limit is equal to the stride,
SimplifySetCC() would break LSR's hard work by transforming:

   (icmp (add iv, stride), stride) --> (cmp iv, 0)

This forced us to use lea for the IC update, preventing the simpler
incl+cmp.

<rdar://problem/7643606>
<rdar://problem/11184260>

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

12 years agoFix accidentally inverted logic from r152803, and make the
Dan Gohman [Thu, 5 Apr 2012 20:27:21 +0000 (20:27 +0000)]
Fix accidentally inverted logic from r152803, and make the
testcase slightly less trivial. This fixes rdar://11171718.

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

12 years agoFix a problem in the target detection for Debian GNU/HURD
Sylvestre Ledru [Thu, 5 Apr 2012 19:34:15 +0000 (19:34 +0000)]
Fix a problem in the target detection for Debian GNU/HURD

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

12 years agoFix a problem in the target detection for Debian GNU/kFreeBSD
Sylvestre Ledru [Thu, 5 Apr 2012 18:53:09 +0000 (18:53 +0000)]
Fix a problem in the target detection for Debian GNU/kFreeBSD

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

12 years agoTreat f16 the same as f80/f128 for the purposes of generating constants during instru...
Owen Anderson [Thu, 5 Apr 2012 18:50:32 +0000 (18:50 +0000)]
Treat f16 the same as f80/f128 for the purposes of generating constants during instruction selection.

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

12 years agoAdded support for unpredictable ADC/SBC instructions on ARM, and also fixed some...
Silviu Baranga [Thu, 5 Apr 2012 16:19:29 +0000 (16:19 +0000)]
Added support for unpredictable ADC/SBC instructions on ARM, and also fixed some corner cases involving the PC register as an operand for these instructions.

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

12 years agoAdded support for handling unpredictable arithmetic instructions on ARM.
Silviu Baranga [Thu, 5 Apr 2012 16:13:15 +0000 (16:13 +0000)]
Added support for handling unpredictable arithmetic instructions on ARM.

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

12 years agoBBVectorize: Add the const modifier to the VectorizeConfig because we won't
Hongbin Zheng [Thu, 5 Apr 2012 16:07:49 +0000 (16:07 +0000)]
BBVectorize: Add the const modifier to the VectorizeConfig because we won't
  modify it.

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

12 years agoIntroduce the VectorizeConfig class, with which we can control the behavior
Hongbin Zheng [Thu, 5 Apr 2012 15:46:55 +0000 (15:46 +0000)]
Introduce the VectorizeConfig class, with which we can control the behavior
  of the BBVectorizePass without using command line option. As pointed out
  by Hal, we can ask the TargetLoweringInfo for the architecture specific
  VectorizeConfig to perform vectorizing with architecture specific
  information.

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

12 years agoAn oversight when applying the patches for r150956 and r150957 to a vanilla tree...
James Molloy [Thu, 5 Apr 2012 10:01:12 +0000 (10:01 +0000)]
An oversight when applying the patches for r150956 and r150957 to a vanilla tree meant I forgot to svn add these testcases.

Noticed while investigating PR12274!

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

12 years agoAdd the function "vectorizeBasicBlock" which allow users vectorize a
Hongbin Zheng [Thu, 5 Apr 2012 08:05:16 +0000 (08:05 +0000)]
Add the function "vectorizeBasicBlock" which allow users vectorize a
 BasicBlock in other passes, e.g. we can call vectorizeBasicBlock in the
 loop unroll pass right after the loop is unrolled.

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

12 years agoARM assembly aliases for two-operand V[R]SHR instructions.
Jim Grosbach [Thu, 5 Apr 2012 07:23:53 +0000 (07:23 +0000)]
ARM assembly aliases for two-operand V[R]SHR instructions.

rdar://11189467

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

12 years agoIn MemoryBuffer::getOpenFile() make sure that the buffer is null-terminated if
Argyrios Kyrtzidis [Thu, 5 Apr 2012 04:23:56 +0000 (04:23 +0000)]
In MemoryBuffer::getOpenFile() make sure that the buffer is null-terminated if
the caller requested a null-terminated one.

When mapping the file there could be a racing issue that resulted in the file being larger
than the FileSize passed by the caller. We already have an assertion
for this in MemoryBuffer::init() but have a runtime guarantee that
the buffer will be null-terminated, so do a copy that adds a null-terminator.

Protects against crash of rdar://11161822.

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

12 years agoARM assembly parsing for 'msr' plain 'cpsr' operand.
Jim Grosbach [Thu, 5 Apr 2012 03:17:53 +0000 (03:17 +0000)]
ARM assembly parsing for 'msr' plain 'cpsr' operand.

Plain 'cpsr' is an alias for 'cpsr_fc'.

rdar://11153753

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

12 years agoPass the right sign to TLI->isLegalICmpImmediate.
Jakob Stoklund Olesen [Thu, 5 Apr 2012 03:10:56 +0000 (03:10 +0000)]
Pass the right sign to TLI->isLegalICmpImmediate.

LSR can fold three addressing modes into its ICmpZero node:

  ICmpZero BaseReg + Offset      => ICmp BaseReg, -Offset
  ICmpZero -1*ScaleReg + Offset  => ICmp ScaleReg, Offset
  ICmpZero BaseReg + -1*ScaleReg => ICmp BaseReg, ScaleReg

The first two cases are only used if TLI->isLegalICmpImmediate() likes
the offset.

Make sure the right Offset sign is passed to this method in the second
case. The ARM version is not symmetric.

<rdar://problem/11184260>

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

12 years agoDo not include multiple -arch options in CPPFLAGS.
Bob Wilson [Thu, 5 Apr 2012 00:35:55 +0000 (00:35 +0000)]
Do not include multiple -arch options in CPPFLAGS.

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

12 years agoFix -Wnon-virtual-dtor warnings.
Michael J. Spencer [Wed, 4 Apr 2012 22:34:55 +0000 (22:34 +0000)]
Fix -Wnon-virtual-dtor warnings.

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

12 years agoReapply 154038 without the failing test.
Akira Hatanaka [Wed, 4 Apr 2012 22:16:36 +0000 (22:16 +0000)]
Reapply 154038 without the failing test.

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

12 years agoRevert r154038. It was causing make check failures.
Owen Anderson [Wed, 4 Apr 2012 21:18:58 +0000 (21:18 +0000)]
Revert r154038.  It was causing make check failures.

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

12 years agoREG_SEQUENCE expansion to COPY instructions wasn't taking account of sub register...
Pete Cooper [Wed, 4 Apr 2012 21:03:25 +0000 (21:03 +0000)]
REG_SEQUENCE expansion to COPY instructions wasn't taking account of sub register indices on the source registers.  No simple test case

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

12 years agoFix a C++11 UDL conflict.
Benjamin Kramer [Wed, 4 Apr 2012 20:33:56 +0000 (20:33 +0000)]
Fix a C++11 UDL conflict.

Still not fixed in the standard ;)

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

12 years agof16 FREM can now be legalized by promoting to f32
Pete Cooper [Wed, 4 Apr 2012 19:36:31 +0000 (19:36 +0000)]
f16 FREM can now be legalized by promoting to f32

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

12 years agoFix LowerGlobalAddress to produce instructions with the correct relocation
Akira Hatanaka [Wed, 4 Apr 2012 19:02:38 +0000 (19:02 +0000)]
Fix LowerGlobalAddress to produce instructions with the correct relocation
types for N32 ABI. Add new test case and update existing ones.

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

12 years agoFix LowerJumpTable to produce instructions with the correct relocation
Akira Hatanaka [Wed, 4 Apr 2012 18:31:32 +0000 (18:31 +0000)]
Fix LowerJumpTable to produce instructions with the correct relocation
types for N32 ABI. Test case will be updated after the patch that fixes
TargetLowering::getPICJumpTableRelocBase is checked in.

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

12 years agoFix LowerConstantPool to produce instructions with the correct relocation
Akira Hatanaka [Wed, 4 Apr 2012 18:26:12 +0000 (18:26 +0000)]
Fix LowerConstantPool to produce instructions with the correct relocation
types for N32 ABI and update test case.

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

12 years agoImplement ARMBaseInstrInfo::commuteInstruction() for MOVCCr.
Jakob Stoklund Olesen [Wed, 4 Apr 2012 18:23:42 +0000 (18:23 +0000)]
Implement ARMBaseInstrInfo::commuteInstruction() for MOVCCr.

A MOVCCr instruction can be commuted by inverting the condition. This
can help reduce register pressure and remove unnecessary copies in some
cases.

<rdar://problem/11182914>

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

12 years agoRemove spurious debug output.
Jakob Stoklund Olesen [Wed, 4 Apr 2012 18:23:38 +0000 (18:23 +0000)]
Remove spurious debug output.

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

12 years agoFix LowerBlockAddress to produce instructions with the correct relocation
Akira Hatanaka [Wed, 4 Apr 2012 18:22:53 +0000 (18:22 +0000)]
Fix LowerBlockAddress to produce instructions with the correct relocation
types for N32 ABI and update test case.

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

12 years agoAdd testcase for r154007, when a function has the optsize attribute,
Hongbin Zheng [Wed, 4 Apr 2012 13:24:40 +0000 (13:24 +0000)]
Add testcase for r154007, when a function has the optsize attribute,
  the loop should be unrolled according the value of OptSizeUnrollThreshold.

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

12 years agoAlways compute all the bits in ComputeMaskedBits.
Rafael Espindola [Wed, 4 Apr 2012 12:51:34 +0000 (12:51 +0000)]
Always compute all the bits in ComputeMaskedBits.
This allows us to keep passing reduced masks to SimplifyDemandedBits, but
know about all the bits if SimplifyDemandedBits fails. This allows instcombine
to simplify cases like the one in the included testcase.

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

12 years agoLoopUnrollPass: Use variable "Threshold" instead of "CurrentThreshold" when
Hongbin Zheng [Wed, 4 Apr 2012 11:44:08 +0000 (11:44 +0000)]
LoopUnrollPass: Use variable "Threshold" instead of "CurrentThreshold" when
  reducing unroll count, otherwise the reduced unroll count is not taking
  the "OptimizeForSize" attribute into account.

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

12 years agoMove yaml::Stream's dtor out of line so it can see Scanner's dtor.
Benjamin Kramer [Wed, 4 Apr 2012 08:53:34 +0000 (08:53 +0000)]
Move yaml::Stream's dtor out of line so it can see Scanner's dtor.

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

12 years agoImplement DwarfLLVMRegPair::operator< without violating asymmetry.
Benjamin Kramer [Wed, 4 Apr 2012 08:24:08 +0000 (08:24 +0000)]
Implement DwarfLLVMRegPair::operator< without violating asymmetry.

MSVC8 verifies this.

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

12 years agoConvert assert(false) followed by a return to llvm_unreachable
Craig Topper [Wed, 4 Apr 2012 04:55:46 +0000 (04:55 +0000)]
Convert assert(false) followed by a return to llvm_unreachable

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

12 years agoRemove default case from switch that was already covering all cases.
Craig Topper [Wed, 4 Apr 2012 04:42:42 +0000 (04:42 +0000)]
Remove default case from switch that was already covering all cases.

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

12 years agoRemoved useless switch for default case when switch was covering all the enum values
Pete Cooper [Wed, 4 Apr 2012 00:53:04 +0000 (00:53 +0000)]
Removed useless switch for default case when switch was covering all the enum values

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

12 years agoFix the install location for the Embedded makefile target.
Bob Wilson [Tue, 3 Apr 2012 23:44:39 +0000 (23:44 +0000)]
Fix the install location for the Embedded makefile target.

svn r145378 inadvertently changed the destination for the Embedded target
in the makefile.  Add a "/Developer" suffix to DSTROOT to compensate.

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

12 years agoSorry about that. MSVC seems to accept just about any random string you give it ;/
Michael J. Spencer [Tue, 3 Apr 2012 23:36:44 +0000 (23:36 +0000)]
Sorry about that. MSVC seems to accept just about any random string you give it ;/

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

12 years agoRemove dead code for installing libLTO when building llvmCore.
Bob Wilson [Tue, 3 Apr 2012 23:13:26 +0000 (23:13 +0000)]
Remove dead code for installing libLTO when building llvmCore.

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

12 years agoAdd YAML parser to Support.
Michael J. Spencer [Tue, 3 Apr 2012 23:09:22 +0000 (23:09 +0000)]
Add YAML parser to Support.

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

12 years agoAdd VSELECT to LegalizeVectorTypes::ScalariseVectorResult. Previously it would crash...
Pete Cooper [Tue, 3 Apr 2012 22:57:55 +0000 (22:57 +0000)]
Add VSELECT to LegalizeVectorTypes::ScalariseVectorResult.  Previously it would crash if it encountered a 1 element VSELECT.  Solution is slightly more complicated than just creating a SELET as we have to mask or sign extend the vector condition if it had different boolean contents from the scalar condition.  Fixes <rdar://problem/11178095>

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

12 years agoRemoved one last bad continue statement meant to be removed in r153914.
Pete Cooper [Tue, 3 Apr 2012 22:18:49 +0000 (22:18 +0000)]
Removed one last bad continue statement meant to be removed in r153914.

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

12 years agoWhen building llvmCore, pass the SDKROOT and -arch setting to configure.
Bob Wilson [Tue, 3 Apr 2012 21:50:26 +0000 (21:50 +0000)]
When building llvmCore, pass the SDKROOT and -arch setting to configure.

So far all of configure tests have been run against the default SDK and
architecture, regardless of what is actually being built.  We've gotten
lucky until now.  <rdar://problem/11112479>

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

12 years agoRemove a reference to the C backend.
Bob Wilson [Tue, 3 Apr 2012 21:50:24 +0000 (21:50 +0000)]
Remove a reference to the C backend.

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

12 years agoFix an issue in SimplifySetCC() specific to vector comparisons.
Chad Rosier [Tue, 3 Apr 2012 20:11:24 +0000 (20:11 +0000)]
Fix an issue in SimplifySetCC() specific to vector comparisons.

When folding X == X we need to check getBooleanContents() to determine if the
result is a vector of ones or a vector of negative ones.

I tried creating a test case, but the problem seems to only be exposed on a
much older version of clang (around r144500).
rdar://10923049

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

12 years agoSet soname for FreeBSD as well.
Anton Korobeynikov [Tue, 3 Apr 2012 19:48:31 +0000 (19:48 +0000)]
Set soname for FreeBSD as well.
Patch by Bernard Cafarelli!

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

12 years agoFix thinko check for number of operands to be the one that actually
Eric Christopher [Tue, 3 Apr 2012 17:55:42 +0000 (17:55 +0000)]
Fix thinko check for number of operands to be the one that actually
might have more than 19 operands. Add a testcase to make sure I
never screw that up again.

Part of rdar://11026482

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

12 years agoMatrix simplification in PBQP may push infinite costs onto register options.
Lang Hames [Tue, 3 Apr 2012 16:27:16 +0000 (16:27 +0000)]
Matrix simplification in PBQP may push infinite costs onto register options.
The colorability heuristic should count these as denied registers.

No test case - this exposed a bug on an out-of-tree target.

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

12 years agoARMDisassembler: drop bogus dependency on ARMCodeGen
Dylan Noblesmith [Tue, 3 Apr 2012 15:48:14 +0000 (15:48 +0000)]
ARMDisassembler: drop bogus dependency on ARMCodeGen

And indirectly, a dependency on most of the core LLVM optimization
libraries.

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

12 years agoObject: drop bogus VMCore dependency
Dylan Noblesmith [Tue, 3 Apr 2012 15:48:10 +0000 (15:48 +0000)]
Object: drop bogus VMCore dependency

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

12 years agoThe speedup doesn't appear to have been from this, but was an anomaly of my testing...
Bill Wendling [Tue, 3 Apr 2012 11:19:21 +0000 (11:19 +0000)]
The speedup doesn't appear to have been from this, but was an anomaly of my testing machine.

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

12 years agoReserve space for the eventual filling of the vector. This gives a small speedup.
Bill Wendling [Tue, 3 Apr 2012 10:50:09 +0000 (10:50 +0000)]
Reserve space for the eventual filling of the vector. This gives a small speedup.

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

12 years agoAdd an additional testcase which checks ops with multiple users.
Nadav Rotem [Tue, 3 Apr 2012 07:39:36 +0000 (07:39 +0000)]
Add an additional testcase which checks ops with multiple users.

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

12 years agoMake PPCCompilationCallbackC function to be static, so there will be no need to issue...
Anton Korobeynikov [Tue, 3 Apr 2012 06:59:28 +0000 (06:59 +0000)]
Make PPCCompilationCallbackC function to be static, so there will be no need to issue call via
PLT when LLVM is built as shared library. This mimics the X86 backend towards the approach.

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

12 years agoTidy up spacing in some tablegen outputs.
Craig Topper [Tue, 3 Apr 2012 06:52:47 +0000 (06:52 +0000)]
Tidy up spacing in some tablegen outputs.

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

12 years agoAdd support for AVX enhanced comparison predicates. Patch from Kay Tiong Khoo.
Craig Topper [Tue, 3 Apr 2012 05:20:24 +0000 (05:20 +0000)]
Add support for AVX enhanced comparison predicates. Patch from Kay Tiong Khoo.

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

12 years agoReformatting. No functionality change.
Bill Wendling [Tue, 3 Apr 2012 03:56:52 +0000 (03:56 +0000)]
Reformatting. No functionality change.

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

12 years agoAs Eric pointed out, even a Debug build should be equal. Leave the flag that can...
Bill Wendling [Tue, 3 Apr 2012 03:27:43 +0000 (03:27 +0000)]
As Eric pointed out, even a Debug build should be equal. Leave the flag that can turn off comparisons though.

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

12 years agoRevert r153924. Delete test/MC/Disassembler/Mips and lib/Target/Mips/Disassembler.
Akira Hatanaka [Tue, 3 Apr 2012 03:01:13 +0000 (03:01 +0000)]
Revert r153924. Delete test/MC/Disassembler/Mips and lib/Target/Mips/Disassembler.

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

12 years agoRevert r153924. There were buildbot failures.
Akira Hatanaka [Tue, 3 Apr 2012 02:51:09 +0000 (02:51 +0000)]
Revert r153924. There were buildbot failures.

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

12 years agoMIPS disassembler support.
Akira Hatanaka [Tue, 3 Apr 2012 02:20:58 +0000 (02:20 +0000)]
MIPS disassembler support.

Patch by Vladimir Medic.

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

12 years agoCleanup set_union usage. The same thing but a bit cleaner now.
Andrew Trick [Tue, 3 Apr 2012 01:35:52 +0000 (01:35 +0000)]
Cleanup set_union usage. The same thing but a bit cleaner now.

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

12 years agoUse std::set_union instead of nasty custom code.
Andrew Trick [Tue, 3 Apr 2012 00:47:23 +0000 (00:47 +0000)]
Use std::set_union instead of nasty custom code.

I just noticed Jakob's examples of the proper application of
std::set... routines.

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

12 years agoAdd a line number for the scope of the function (starting at the first
Eric Christopher [Tue, 3 Apr 2012 00:43:49 +0000 (00:43 +0000)]
Add a line number for the scope of the function (starting at the first
brace) so that we get more accurate line number information about the
declaration of a given function and the line where the function
first starts.

Part of rdar://11026482

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

12 years agoFixes to r153903. Added missing explanation of behaviour when the VirtRegMap is...
Pete Cooper [Tue, 3 Apr 2012 00:28:46 +0000 (00:28 +0000)]
Fixes to r153903.  Added missing explanation of behaviour when the VirtRegMap is NULL.  Also changed it in this case to just avoid updating the map, but live ranges or intervals will still get updated and created

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

12 years agoCompare the .o files only for release builds. Add an option to bypass the comparison...
Bill Wendling [Mon, 2 Apr 2012 23:27:43 +0000 (23:27 +0000)]
Compare the .o files only for release builds. Add an option to bypass the comparison altogether.

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