oota-llvm.git
13 years agoInstcombine: Fix pattern where the sext did not dominate the icmp using it
Tobias Grosser [Sun, 9 Jan 2011 16:00:11 +0000 (16:00 +0000)]
Instcombine: Fix pattern where the sext did not dominate the icmp using it

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

13 years agoDominatorTree->print() now prints the status of the DFSNumbers correctly
Tobias Grosser [Sun, 9 Jan 2011 16:00:09 +0000 (16:00 +0000)]
DominatorTree->print() now prints the status of the DFSNumbers correctly

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

13 years agoRewrite handling of LLVM_ENABLE_PIC. It was being processed after
Oscar Fuentes [Sun, 9 Jan 2011 14:34:39 +0000 (14:34 +0000)]
Rewrite handling of LLVM_ENABLE_PIC. It was being processed after
config.h was generated, so it had no effect on it.

Thanks to arrowdodger for pointing out this and a tentative patch.

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

13 years agoLoopInstSimplify preserves LoopSimplify.
Cameron Zwarich [Sun, 9 Jan 2011 12:35:16 +0000 (12:35 +0000)]
LoopInstSimplify preserves LoopSimplify.

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

13 years agoAnother missed memset in std::vector initialization.
Chandler Carruth [Sun, 9 Jan 2011 11:29:57 +0000 (11:29 +0000)]
Another missed memset in std::vector initialization.

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

13 years agoEliminate some extra hash table lookups.
Cameron Zwarich [Sun, 9 Jan 2011 10:54:21 +0000 (10:54 +0000)]
Eliminate some extra hash table lookups.

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

13 years agoAdd an informative comment.
Cameron Zwarich [Sun, 9 Jan 2011 10:32:30 +0000 (10:32 +0000)]
Add an informative comment.

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

13 years agoFix a cut-paste-o so that the sample code is correct for my last note.
Chandler Carruth [Sun, 9 Jan 2011 10:10:59 +0000 (10:10 +0000)]
Fix a cut-paste-o so that the sample code is correct for my last note.

Also, switch to a more clear 'sink' function with its declaration to
avoid any confusion about 'g'. Thanks for the suggestion Frits.

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

13 years agoAnother missed optimization of trivial vector code.
Chandler Carruth [Sun, 9 Jan 2011 09:58:36 +0000 (09:58 +0000)]
Another missed optimization of trivial vector code.

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

13 years agoAdd a note about vector's size-constructor producing dead stores.
Chandler Carruth [Sun, 9 Jan 2011 09:58:33 +0000 (09:58 +0000)]
Add a note about vector's size-constructor producing dead stores.

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

13 years agoSimplify LiveDebugVariables by storing MachineOperand copies locations instead
Jakob Stoklund Olesen [Sun, 9 Jan 2011 05:33:21 +0000 (05:33 +0000)]
Simplify LiveDebugVariables by storing MachineOperand copies locations instead
of using a Location class with the same information.

When making a copy of a MachineOperand that was already stored in a
MachineInstr, it is necessary to clear the parent pointer on the copy. Otherwise
the register use-def lists become inconsistent.

Add MachineOperand::clearParent() to do that. An alternative would be a custom
MachineOperand copy constructor that cleared ParentMI. I didn't want to do that
because of the performance impact.

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

13 years agoShrink a BitVector that didn't mean to store bits for all physical registers.
Jakob Stoklund Olesen [Sun, 9 Jan 2011 03:45:44 +0000 (03:45 +0000)]
Shrink a BitVector that didn't mean to store bits for all physical registers.

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

13 years agoReplace TargetRegisterInfo::printReg with a PrintReg class that also works without...
Jakob Stoklund Olesen [Sun, 9 Jan 2011 03:05:53 +0000 (03:05 +0000)]
Replace TargetRegisterInfo::printReg with a PrintReg class that also works without a TRI instance.

Print virtual registers numbered from 0 instead of the arbitrary
FirstVirtualRegister. The first virtual register is printed as %vreg0.
TRI::NoRegister is printed as %noreg.

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

13 years agoUse IndexedMap for MachineRegisterInfo as well. No functional change.
Jakob Stoklund Olesen [Sun, 9 Jan 2011 03:05:46 +0000 (03:05 +0000)]
Use IndexedMap for MachineRegisterInfo as well. No functional change.

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

13 years agoteach SCEV analysis of PHI nodes that PHI recurences formed
Chris Lattner [Sun, 9 Jan 2011 02:28:48 +0000 (02:28 +0000)]
teach SCEV analysis of PHI nodes that PHI recurences formed
with GEP instructions are always NUW, because PHIs cannot wrap
the end of the address space.

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

13 years agoreduce indentation. Print <nuw> and <nsw> when dumping SCEV AddRec's
Chris Lattner [Sun, 9 Jan 2011 02:16:18 +0000 (02:16 +0000)]
reduce indentation.  Print <nuw> and <nsw> when dumping SCEV AddRec's
that have the bit set.

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

13 years agoAdd a note about a missed memset optimization from std::fill.
Chandler Carruth [Sun, 9 Jan 2011 01:32:55 +0000 (01:32 +0000)]
Add a note about a missed memset optimization from std::fill.

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

13 years agoFix the last virtual register enumerations.
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:11:11 +0000 (23:11 +0000)]
Fix the last virtual register enumerations.

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

13 years agoFix VirtRegMap to use TRI::index2VirtReg and TRI::virtReg2Index instead of
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:11:07 +0000 (23:11 +0000)]
Fix VirtRegMap to use TRI::index2VirtReg and TRI::virtReg2Index instead of
depending on TRI::FirstVirtualRegister.

Also use TRI::printReg instead of printing virtual registers directly.

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

13 years agoFix a MachineVerifier loop that probably didn't mean to skip the last two
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:11:02 +0000 (23:11 +0000)]
Fix a MachineVerifier loop that probably didn't mean to skip the last two
virtual registers.

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

13 years agoDon't document exactly how virtual registers are represented as integers. Code
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:10:59 +0000 (23:10 +0000)]
Don't document exactly how virtual registers are represented as integers. Code
shouldn't depend directly on that.

Give an example of how to iterate over all virtual registers in a function
without depending on the representation.

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

13 years agoUse an IndexedMap for LiveVariables::VirtRegInfo.
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:10:57 +0000 (23:10 +0000)]
Use an IndexedMap for LiveVariables::VirtRegInfo.

Provide MRI::getNumVirtRegs() and TRI::index2VirtReg() functions to allow
iteration over virtual registers without depending on the representation of
virtual register numbers.

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

13 years agoDo not talk about TargetRegisterInfo::FirstVirtualRegister.
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:10:53 +0000 (23:10 +0000)]
Do not talk about TargetRegisterInfo::FirstVirtualRegister.

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

13 years agoUse an IndexedMap for LiveOutRegInfo to hide its dependence on TargetRegisterInfo...
Jakob Stoklund Olesen [Sat, 8 Jan 2011 23:10:50 +0000 (23:10 +0000)]
Use an IndexedMap for LiveOutRegInfo to hide its dependence on TargetRegisterInfo::FirstVirtualRegister.

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

13 years agoFix coding style.
Cameron Zwarich [Sat, 8 Jan 2011 22:36:53 +0000 (22:36 +0000)]
Fix coding style.

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

13 years agofix a latent bug in memcpyoptimizer that my recent patches exposed: it wasn't
Chris Lattner [Sat, 8 Jan 2011 22:19:21 +0000 (22:19 +0000)]
fix a latent bug in memcpyoptimizer that my recent patches exposed: it wasn't
updating memdep when fusing stores together.  This fixes the crash optimizing
the bullet benchmark.

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

13 years agotryMergingIntoMemset can only handle constant length memsets.
Chris Lattner [Sat, 8 Jan 2011 22:11:56 +0000 (22:11 +0000)]
tryMergingIntoMemset can only handle constant length memsets.

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

13 years agoMerge memsets followed by neighboring memsets and other stores into
Chris Lattner [Sat, 8 Jan 2011 21:19:19 +0000 (21:19 +0000)]
Merge memsets followed by neighboring memsets and other stores into
larger memsets.  Among other things, this fixes rdar://8760394 and
allows us to handle "Example 2" from http://blog.regehr.org/archives/320,
compiling it into a single 4096-byte memset:

_mad_synth_mute:                        ## @mad_synth_mute
## BB#0:                                ## %entry
pushq %rax
movl $4096, %esi             ## imm = 0x1000
callq ___bzero
popq %rax
ret

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

13 years agofix an issue in IsPointerOffset that prevented us from recognizing that
Chris Lattner [Sat, 8 Jan 2011 21:07:56 +0000 (21:07 +0000)]
fix an issue in IsPointerOffset that prevented us from recognizing that
P and P+1 are relative to the same base pointer.

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

13 years agoenhance memcpyopt to merge a store and a subsequent
Chris Lattner [Sat, 8 Jan 2011 20:54:51 +0000 (20:54 +0000)]
enhance memcpyopt to merge a store and a subsequent
memset into a single larger memset.

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

13 years agofit in 80 cols
Chris Lattner [Sat, 8 Jan 2011 20:53:41 +0000 (20:53 +0000)]
fit in 80 cols

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

13 years agomerge two tests and filecheckify
Chris Lattner [Sat, 8 Jan 2011 20:27:22 +0000 (20:27 +0000)]
merge two tests and filecheckify

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

13 years agoconstify TargetData references.
Chris Lattner [Sat, 8 Jan 2011 20:24:01 +0000 (20:24 +0000)]
constify TargetData references.
Split memset formation logic out into its own
"tryMergingIntoMemset" helper function.

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

13 years agoWhen loop rotation happens, it is *very* common for the duplicated condbr
Chris Lattner [Sat, 8 Jan 2011 19:59:06 +0000 (19:59 +0000)]
When loop rotation happens, it is *very* common for the duplicated condbr
to be foldable into an uncond branch.  When this happens, we can make a
much simpler CFG for the loop, which is important for nested loop cases
where we want the outer loop to be aggressively optimized.

Handle this case more aggressively.  For example, previously on
phi-duplicate.ll we would get this:

define void @test(i32 %N, double* %G) nounwind ssp {
entry:
  %cmp1 = icmp slt i64 1, 1000
  br i1 %cmp1, label %bb.nph, label %for.end

bb.nph:                                           ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %bb.nph, %for.cond
  %j.02 = phi i64 [ 1, %bb.nph ], [ %inc, %for.cond ]
  %arrayidx = getelementptr inbounds double* %G, i64 %j.02
  %tmp3 = load double* %arrayidx
  %sub = sub i64 %j.02, 1
  %arrayidx6 = getelementptr inbounds double* %G, i64 %sub
  %tmp7 = load double* %arrayidx6
  %add = fadd double %tmp3, %tmp7
  %arrayidx10 = getelementptr inbounds double* %G, i64 %j.02
  store double %add, double* %arrayidx10
  %inc = add nsw i64 %j.02, 1
  br label %for.cond

for.cond:                                         ; preds = %for.body
  %cmp = icmp slt i64 %inc, 1000
  br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge

for.cond.for.end_crit_edge:                       ; preds = %for.cond
  br label %for.end

for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry
  ret void
}

Now we get the much nicer:

define void @test(i32 %N, double* %G) nounwind ssp {
entry:
  br label %for.body

for.body:                                         ; preds = %entry, %for.body
  %j.01 = phi i64 [ 1, %entry ], [ %inc, %for.body ]
  %arrayidx = getelementptr inbounds double* %G, i64 %j.01
  %tmp3 = load double* %arrayidx
  %sub = sub i64 %j.01, 1
  %arrayidx6 = getelementptr inbounds double* %G, i64 %sub
  %tmp7 = load double* %arrayidx6
  %add = fadd double %tmp3, %tmp7
  %arrayidx10 = getelementptr inbounds double* %G, i64 %j.01
  store double %add, double* %arrayidx10
  %inc = add nsw i64 %j.01, 1
  %cmp = icmp slt i64 %inc, 1000
  br i1 %cmp, label %for.body, label %for.end

for.end:                                          ; preds = %for.body
  ret void
}

With all of these recent changes, we are now able to compile:

void foo(char *X) {
 for (int i = 0; i != 100; ++i)
   for (int j = 0; j != 100; ++j)
     X[j+i*100] = 0;
}

into a single memset of 10000 bytes.  This series of changes
should also be helpful for other nested loop scenarios as well.

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

13 years agomake domtree verification print something useful on failure.
Chris Lattner [Sat, 8 Jan 2011 19:55:55 +0000 (19:55 +0000)]
make domtree verification print something useful on failure.

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

13 years agosplit ssa updating code out to its own helper function. Don't bother
Chris Lattner [Sat, 8 Jan 2011 19:26:33 +0000 (19:26 +0000)]
split ssa updating code out to its own helper function.  Don't bother
moving the OrigHeader block anymore: we just merge it away anyway so
its code layout doesn't matter.

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

13 years agoImplement a TODO: Enhance loopinfo to merge away the unconditional branch
Chris Lattner [Sat, 8 Jan 2011 19:10:28 +0000 (19:10 +0000)]
Implement a TODO: Enhance loopinfo to merge away the unconditional branch
that it was leaving in loops after rotation (between the original latch
block and the original header.

With this change, it is possible for rotated loops to have just a single
basic block, which is useful.

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

13 years agovarious code cleanups, enhance MergeBlockIntoPredecessor to preserve
Chris Lattner [Sat, 8 Jan 2011 19:08:40 +0000 (19:08 +0000)]
various code cleanups, enhance MergeBlockIntoPredecessor to preserve
loop info.

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

13 years agoinline preserveCanonicalLoopForm now that it is simple.
Chris Lattner [Sat, 8 Jan 2011 18:55:50 +0000 (18:55 +0000)]
inline preserveCanonicalLoopForm now that it is simple.

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

13 years agoThree major changes:
Chris Lattner [Sat, 8 Jan 2011 18:52:51 +0000 (18:52 +0000)]
Three major changes:
1. Rip out LoopRotate's domfrontier updating code.  It isn't
   needed now that LICM doesn't use DF and it is super complex
   and gross.
2. Make DomTree updating code a lot simpler and faster.  The
   old loop over all the blocks was just to find a block??
3. Change the code that inserts the new preheader to just use
   SplitCriticalEdge instead of doing an overcomplex
   reimplementation of it.

No behavior change, except for the name of the inserted preheader.

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

13 years agoreduce nesting.
Chris Lattner [Sat, 8 Jan 2011 18:47:43 +0000 (18:47 +0000)]
reduce nesting.

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

13 years agoOn Windows, replace each occurrence of '\' by '\\' on the replacement string. This...
Francois Pichet [Sat, 8 Jan 2011 18:09:48 +0000 (18:09 +0000)]
On Windows, replace each occurrence of '\' by '\\' on the replacement string. This is necessary to prevent re.sub from replacing escape sequences occurring in path.

For example:

llvm\tools\clang\test
was replaced by
llvm <tab> ools\clang <tab> est

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

13 years agoLoopRotate requires canonical loop form, so it always has preheaders
Chris Lattner [Sat, 8 Jan 2011 18:06:22 +0000 (18:06 +0000)]
LoopRotate requires canonical loop form, so it always has preheaders
and latch blocks.  Reorder entry conditions to make hte pass faster
and more logical.

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

13 years agouse the LI ivar.
Chris Lattner [Sat, 8 Jan 2011 17:49:51 +0000 (17:49 +0000)]
use the LI ivar.

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

13 years agosome cleanups: remove dead arguments and eliminate ivars
Chris Lattner [Sat, 8 Jan 2011 17:48:33 +0000 (17:48 +0000)]
some cleanups: remove dead arguments and eliminate ivars
that are just passed to one function.

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

13 years agofix an issue duncan pointed out, which could cause loop rotate
Chris Lattner [Sat, 8 Jan 2011 17:38:45 +0000 (17:38 +0000)]
fix an issue duncan pointed out, which could cause loop rotate
to violate LCSSA form

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

13 years agoFix coding style issues.
Cameron Zwarich [Sat, 8 Jan 2011 17:07:11 +0000 (17:07 +0000)]
Fix coding style issues.

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

13 years agoMake more passes preserve dominators (or state that they preserve dominators if
Cameron Zwarich [Sat, 8 Jan 2011 17:01:52 +0000 (17:01 +0000)]
Make more passes preserve dominators (or state that they preserve dominators if
they all ready do). This removes two dominator recomputations prior to isel,
which is a 1% improvement in total llc time for 403.gcc.

The only potentially suspect thing is making GCStrategy recompute dominators if
it used a custom lowering strategy.

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

13 years agoFirst step in fixing PR8927:
Rafael Espindola [Sat, 8 Jan 2011 16:42:36 +0000 (16:42 +0000)]
First step in fixing PR8927:

Add a unnamed_addr bit to global variables and functions. This will be used
to indicate that the address is not significant and therefore the constant
or function can be merged with others.

If an optimization pass can show that an address is not used, it can set this.

Examples of things that can have this set by the FE are globals created to
hold string literals and C++ constructors.

Adding unnamed_addr to a non-const global should have no effect unless
an optimization can transform that global into a constant.

Aliases are not allowed to have unnamed_addr since I couldn't figure
out any use for it.

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

13 years agoContract subloop bodies. However, it is still important to visit the phis at the
Cameron Zwarich [Sat, 8 Jan 2011 15:52:22 +0000 (15:52 +0000)]
Contract subloop bodies. However, it is still important to visit the phis at the
top of subloop headers, as the phi uses logically occur outside of the subloop.

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

13 years agoFix a bug in r123034 (trying to sext/zext non-integers) and clean up a little.
Frits van Bommel [Sat, 8 Jan 2011 10:51:36 +0000 (10:51 +0000)]
Fix a bug in r123034 (trying to sext/zext non-integers) and clean up a little.

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

13 years agoHave loop-rotate simplify instructions (yay instsimplify!) as it clones
Chris Lattner [Sat, 8 Jan 2011 08:24:46 +0000 (08:24 +0000)]
Have loop-rotate simplify instructions (yay instsimplify!) as it clones
them into the loop preheader, eliminating silly instructions like
"icmp i32 0, 100" in fixed tripcount loops.  This also better exposes the
bigger problem with loop rotate that I'd like to fix: once this has been
folded, the duplicated conditional branch *often* turns into an uncond branch.

Not aggressively handling this is pessimizing later loop optimizations
somethin' fierce by making "dominates all exit blocks" checks fail.

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

13 years agomake this file properly self contained.
Chris Lattner [Sat, 8 Jan 2011 08:19:49 +0000 (08:19 +0000)]
make this file properly self contained.

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

13 years agoRevamp the ValueMapper interfaces in a couple ways:
Chris Lattner [Sat, 8 Jan 2011 08:15:20 +0000 (08:15 +0000)]
Revamp the ValueMapper interfaces in a couple ways:

1. Take a flags argument instead of a bool.  This makes
   it more clear to the reader what it is used for.
2. Add a flag that says that "remapping a value not in the
   map is ok".
3. Reimplement MapValue to share a bunch of code and be a lot
   more efficient.  For lookup failures, don't drop null values
   into the map.
4. Using the new flag a bunch of code can vaporize in LinkModules
   and LoopUnswitch, kill it.

No functionality change.

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

13 years agotwo minor changes: switch to the standard ValueToValueMapTy
Chris Lattner [Sat, 8 Jan 2011 07:21:31 +0000 (07:21 +0000)]
two minor changes: switch to the standard ValueToValueMapTy
map from ValueMapper.h (giving us access to its utilities)
and add a fastpath in the loop rotation code, avoiding expensive
ssa updator manipulation for values with nothing to update.

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

13 years agoI don't think I could find a 10.2.x box if I tried.
Eric Christopher [Sat, 8 Jan 2011 01:52:20 +0000 (01:52 +0000)]
I don't think I could find a 10.2.x box if I tried.

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

13 years agoRecognize inline asm 'rev /bin/bash, ' as a bswap intrinsic call.
Evan Cheng [Sat, 8 Jan 2011 01:24:27 +0000 (01:24 +0000)]
Recognize inline asm 'rev /bin/bash, ' as a bswap intrinsic call.

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

13 years agoDo not model all INLINEASM instructions as having unmodelled side effects.
Evan Cheng [Fri, 7 Jan 2011 23:50:32 +0000 (23:50 +0000)]
Do not model all INLINEASM instructions as having unmodelled side effects.
Instead encode llvm IR level property "HasSideEffects" in an operand (shared
with IsAlignStack). Added MachineInstrs::hasUnmodeledSideEffects() to check
the operand when the instruction is an INLINEASM.

This allows memory instructions to be moved around INLINEASM instructions.

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

13 years agoUse __builtin_shufflevector to implement vget_low and vget_high intrinsics.
Bob Wilson [Fri, 7 Jan 2011 23:40:49 +0000 (23:40 +0000)]
Use __builtin_shufflevector to implement vget_low and vget_high intrinsics.
This was suggested by Edmund Grimley Evans in pr8411.

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

13 years agoAdd an explanatory message for an assertion.
Bob Wilson [Fri, 7 Jan 2011 23:40:46 +0000 (23:40 +0000)]
Add an explanatory message for an assertion.

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

13 years agoEliminate variable only used in debug builds.
Matt Beaumont-Gay [Fri, 7 Jan 2011 22:34:58 +0000 (22:34 +0000)]
Eliminate variable only used in debug builds.

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

13 years agoSpeculatively revert r123032.
Devang Patel [Fri, 7 Jan 2011 22:33:41 +0000 (22:33 +0000)]
Speculatively revert r123032.

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

13 years agoDo not include DataTypes.h in llvm-c/lto.h.
Devang Patel [Fri, 7 Jan 2011 22:26:25 +0000 (22:26 +0000)]
Do not include DataTypes.h in llvm-c/lto.h.
This means avoid using uint32_t. This patch reverts r112200 and fixes original  problem by fixing argument type in lto.cpp.

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

13 years agoFix comment. INLINEASM node operand #3 is IsAlignStack bit.
Evan Cheng [Fri, 7 Jan 2011 21:38:59 +0000 (21:38 +0000)]
Fix comment. INLINEASM node operand #3 is IsAlignStack bit.

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

13 years agoLower some BUILD_VECTORS using VEXT+shuffle.
Bob Wilson [Fri, 7 Jan 2011 21:37:30 +0000 (21:37 +0000)]
Lower some BUILD_VECTORS using VEXT+shuffle.
Patch by Tim Northover.

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

13 years agoInstCombine: Match min/max hidden by sext/zext
Tobias Grosser [Fri, 7 Jan 2011 21:33:14 +0000 (21:33 +0000)]
InstCombine: Match min/max hidden by sext/zext

X = sext x; x >s c ? X : C+1 --> X = sext x; X <s C+1 ? C+1 : X
X = sext x; x <s c ? X : C-1 --> X = sext x; X >s C-1 ? C-1 : X
X = zext x; x >u c ? X : C+1 --> X = zext x; X <u C+1 ? C+1 : X
X = zext x; x <u c ? X : C-1 --> X = zext x; X >u C-1 ? C-1 : X
X = sext x; x >u c ? X : C+1 --> X = sext x; X <u C+1 ? C+1 : X
X = sext x; x <u c ? X : C-1 --> X = sext x; X >u C-1 ? C-1 : X

Instead of calculating this with mixed types promote all to the
larger type. This enables scalar evolution to analyze this
expression. PR8866

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

13 years agoSome whitespace fixes
Tobias Grosser [Fri, 7 Jan 2011 21:33:13 +0000 (21:33 +0000)]
Some whitespace fixes

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

13 years agoAppropriately truncate debug info range in dwarf output.
Devang Patel [Fri, 7 Jan 2011 21:30:41 +0000 (21:30 +0000)]
Appropriately truncate debug info range in dwarf output.
Enable live debug variables pass.

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

13 years agoDBG_VALUE does not have any side effects; it also makes no sense to mark it cheap...
Evan Cheng [Fri, 7 Jan 2011 21:08:26 +0000 (21:08 +0000)]
DBG_VALUE does not have any side effects; it also makes no sense to mark it cheap as a copy.

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

13 years agoRevert 122959, it needs more thought. Add it back to README.txt with additional notes.
Benjamin Kramer [Fri, 7 Jan 2011 20:42:20 +0000 (20:42 +0000)]
Revert 122959, it needs more thought. Add it back to README.txt with additional notes.

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

13 years agoDon't use -O3 on Mingw, as people report it as unreliable. Use -O2
Oscar Fuentes [Fri, 7 Jan 2011 20:31:03 +0000 (20:31 +0000)]
Don't use -O3 on Mingw, as people report it as unreliable. Use -O2
instead.

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

13 years agoSimplify the allocation and freeing of Users' operand lists, now that
Jay Foad [Fri, 7 Jan 2011 20:29:02 +0000 (20:29 +0000)]
Simplify the allocation and freeing of Users' operand lists, now that
every BranchInst has a fixed number of operands.

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

13 years agoRemove the "ugly" method BranchInst::setUnconditionalDest().
Jay Foad [Fri, 7 Jan 2011 20:26:51 +0000 (20:26 +0000)]
Remove the "ugly" method BranchInst::setUnconditionalDest().

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

13 years agoRemove all uses of the "ugly" method BranchInst::setUnconditionalDest().
Jay Foad [Fri, 7 Jan 2011 20:25:56 +0000 (20:25 +0000)]
Remove all uses of the "ugly" method BranchInst::setUnconditionalDest().

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

13 years agoRevert r122955. It seems using movups to lower memcpy can cause massive regression...
Evan Cheng [Fri, 7 Jan 2011 19:35:30 +0000 (19:35 +0000)]
Revert r122955. It seems using movups to lower memcpy can cause massive regression (even on Nehalem) in edge cases. I also didn't see any real performance benefit.

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

13 years agoRename lisp-like functions as suggested by Gabor Greif as loooong time
David Greene [Fri, 7 Jan 2011 17:05:37 +0000 (17:05 +0000)]
Rename lisp-like functions as suggested by Gabor Greif as loooong time
ago.  This is both easier to learn and easier to read.

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

13 years agoTry to unbreak the arm buildbot.
Benjamin Kramer [Fri, 7 Jan 2011 11:35:21 +0000 (11:35 +0000)]
Try to unbreak the arm buildbot.

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

13 years agoAdd testcases for PR8411 (vget_low and vget_high implemented as shuffles).
Bob Wilson [Fri, 7 Jan 2011 06:44:14 +0000 (06:44 +0000)]
Add testcases for PR8411 (vget_low and vget_high implemented as shuffles).

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

13 years agoAdd ARM patterns to match EXTRACT_SUBVECTOR nodes.
Bob Wilson [Fri, 7 Jan 2011 04:59:04 +0000 (04:59 +0000)]
Add ARM patterns to match EXTRACT_SUBVECTOR nodes.
Also fix an off-by-one in SelectionDAGBuilder that was preventing shuffle
vectors from being translated to EXTRACT_SUBVECTOR.
Patch by Tim Northover.

The test changes are needed to keep those spill-q tests from testing aligned
spills and restores.  If the only aligned stack objects are spill slots, we
no longer realign the stack frame.  Prior to this patch, an EXTRACT_SUBVECTOR
was legalized by loading from the stack, which created an aligned frame index.
Now, however, there is nothing except the spill slot in the stack frame, so
I added an aligned alloca.

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

13 years agoFix a comment typo.
Bob Wilson [Fri, 7 Jan 2011 04:58:58 +0000 (04:58 +0000)]
Fix a comment typo.

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

13 years agoChange EXTRACT_SUBVECTOR to require a constant index.
Bob Wilson [Fri, 7 Jan 2011 04:58:56 +0000 (04:58 +0000)]
Change EXTRACT_SUBVECTOR to require a constant index.
We were never generating any of these nodes with variable indices, and there
was one legalizer function asserting on a non-constant index.  If we ever have
a need to support variable indices, we can add this back again.

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

13 years agoEarly exit if we don't have invokes. The 'Unwinds' vector isn't modified unless
Bill Wendling [Fri, 7 Jan 2011 02:54:45 +0000 (02:54 +0000)]
Early exit if we don't have invokes. The 'Unwinds' vector isn't modified unless
we have invokes, so there is no functionality change here.

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

13 years agoFix the other problem reported in PR8582. Testcase and patch by
Duncan Sands [Thu, 6 Jan 2011 23:45:22 +0000 (23:45 +0000)]
Fix the other problem reported in PR8582.  Testcase and patch by
Nadav Rotem.

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

13 years agoAdd a testcase for PR8582, which mysteriously fixed itself, in case the problem
Duncan Sands [Thu, 6 Jan 2011 23:04:29 +0000 (23:04 +0000)]
Add a testcase for PR8582, which mysteriously fixed itself, in case the problem
comes back some day.

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

13 years agoAdd some fairly duplicated code to let type legalization split illegal
Eric Christopher [Thu, 6 Jan 2011 22:28:56 +0000 (22:28 +0000)]
Add some fairly duplicated code to let type legalization split illegal
typed atomics. This will lower exclusively to libcalls at the moment.

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

13 years agoWith Benjamin's recent amazing patches, we should be able to do even better things :)
Chris Lattner [Thu, 6 Jan 2011 22:25:00 +0000 (22:25 +0000)]
With Benjamin's recent amazing patches, we should be able to do even better things :)

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

13 years agouse isNullValue() to simplify code, add an assert.
Chris Lattner [Thu, 6 Jan 2011 22:24:29 +0000 (22:24 +0000)]
use isNullValue() to simplify code, add an assert.

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

13 years agoEmit 128 bit constant.
Devang Patel [Thu, 6 Jan 2011 21:39:25 +0000 (21:39 +0000)]
Emit 128 bit constant.
This fixes PR 8913 crash.

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

13 years agoPR8921: LDM/POP do not support interworking prior to v5t.
Bob Wilson [Thu, 6 Jan 2011 19:24:41 +0000 (19:24 +0000)]
PR8921: LDM/POP do not support interworking prior to v5t.

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

13 years agoRemove extra whitespace.
Bob Wilson [Thu, 6 Jan 2011 19:24:36 +0000 (19:24 +0000)]
Remove extra whitespace.

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

13 years agoFix comment typo.
Bob Wilson [Thu, 6 Jan 2011 19:24:32 +0000 (19:24 +0000)]
Fix comment typo.

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

13 years agoAdd a note from llvmdev, this time with more info.
Benjamin Kramer [Thu, 6 Jan 2011 17:35:50 +0000 (17:35 +0000)]
Add a note from llvmdev, this time with more info.

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

13 years agoFixed parsing of hex floats.
Abramo Bagnara [Thu, 6 Jan 2011 16:55:14 +0000 (16:55 +0000)]
Fixed parsing of hex floats.

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

13 years agoCorrectly disassemble truncated asm.
Rafael Espindola [Thu, 6 Jan 2011 16:48:42 +0000 (16:48 +0000)]
Correctly disassemble truncated asm.

Patch by Richard Simth.

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

13 years agoInstCombine: Turn _chk functions into the "unsafe" variant if length and max langth...
Benjamin Kramer [Thu, 6 Jan 2011 14:22:52 +0000 (14:22 +0000)]
InstCombine: Turn _chk functions into the "unsafe" variant if length and max langth are equal.

This happens when we take the (non-constant) length from a malloc.

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

13 years agoEarlyCSE does this now (and GVN always did it).
Benjamin Kramer [Thu, 6 Jan 2011 13:19:46 +0000 (13:19 +0000)]
EarlyCSE does this now (and GVN always did it).

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

13 years agoInstCombine: If we call llvm.objectsize on a malloc call we can replace it with the...
Benjamin Kramer [Thu, 6 Jan 2011 13:11:05 +0000 (13:11 +0000)]
InstCombine: If we call llvm.objectsize on a malloc call we can replace it with the size passed to malloc.

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

13 years agoInstCombine: Teach llvm.objectsize folding to look through GEPs.
Benjamin Kramer [Thu, 6 Jan 2011 13:07:49 +0000 (13:07 +0000)]
InstCombine: Teach llvm.objectsize folding to look through GEPs.

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

13 years agoRemove dead code and silence warnings.
Benjamin Kramer [Thu, 6 Jan 2011 13:01:02 +0000 (13:01 +0000)]
Remove dead code and silence warnings.

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

13 years agoUse movups to lower memcpy and memset even if it's not fast (like corei7).
Evan Cheng [Thu, 6 Jan 2011 07:58:36 +0000 (07:58 +0000)]
Use movups to lower memcpy and memset even if it's not fast (like corei7).
The theory is it's still faster than a pair of movq / a quad of movl. This
will probably hurt older chips like P4 but should run faster on current
and future Intel processors. rdar://8817010

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