History log of /external/llvm/lib/CodeGen/BranchFolding.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cd81d94322a39503e4a3e87b6ee03d4fcb3465fb 21-Jul-2014 Stephen Hines <srhines@google.com> Update LLVM for rebase to r212749.

Includes a cherry-pick of:
r212948 - fixes a small issue with atomic calls

Change-Id: Ib97bd980b59f18142a69506400911a6009d9df18
/external/llvm/lib/CodeGen/BranchFolding.cpp
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
/external/llvm/lib/CodeGen/BranchFolding.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/CodeGen/BranchFolding.cpp
f7b5e016363b664461f33a4a391b27bea637209d 24-Jun-2013 Andrew Trick <atrick@apple.com> Fix tail merging to assign the (more) correct BasicBlock when splitting.

This makes it possible to write unit tests that are less susceptible
to minor code motion, particularly copy placement. block-placement.ll
covers this case with -pre-RA-sched=source which will soon be
default. One incorrectly named block is already fixed, but without
this fix, enabling new coalescing and scheduling would cause more
failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
62c320a755ac27ac2b7f64e927892249e0f486e0 23-May-2013 Chad Rosier <mcrosier@apple.com> Simplify logic now that r182490 is in place. No functional change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
0b8c9a80f20772c3793201ab5b251d3520b9cea3 02-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
831737d329a727f53a1fb0572f7b7a8127208881 30-Dec-2012 Bill Wendling <isanbard@gmail.com> Remove the Function::getFnAttributes method in favor of using the AttributeSet
directly.

This is in preparation for removing the use of the 'Attribute' class as a
collection of attributes. That will shift to the AttributeSet class instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
034b94b17006f51722886b0f2283fb6fb19aca1f 19-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d04a8d4b33ff316ca4cf961e06c9e312eff8e64f 03-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Use the new script to sort the includes of every file under lib.

Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
df22702db0b74c14782e00e36e9e9c5df56182b6 27-Nov-2012 Jakub Staszak <kubastaszak@gmail.com> Remove unneeded #include.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168670 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6765834754cbb3cb0f15b4b15e98c5e73fa50066 09-Oct-2012 Bill Wendling <isanbard@gmail.com> Create enums for the different attributes.

We use the enums to query whether an Attributes object has that attribute. The
opaque layer is responsible for knowing where that specific attribute is stored.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
14ce91cc2720da9547bff1ac199697b6d157d348 07-Oct-2012 Craig Topper <craig.topper@gmail.com> Fix indentation. Remove 'else' after return. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165381 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
2c189061184925c6a8ecbb5a19e648b230a41c0e 26-Sep-2012 Bill Wendling <isanbard@gmail.com> Remove the `hasFnAttr' method from Function.

The hasFnAttr method has been replaced by querying the Attributes explicitly. No
intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
05d96f98cbd96dab7f4ea1ea4ebe4285597e7e88 22-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Reduce duplicated hash map lookups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162362 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d9b0b025612992a0b724eeca8bdf10b1d7a5c355 02-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com> Fix typos found by http://github.com/lyda/misspell-check

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
396618b43a85e12d290a90b181c6af5d7c0c5f11 02-Jun-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Switch all register list clients to the new MC*Iterator interface.

No functional change intended.

Sorry for the churn. The iterator classes are supposed to help avoid
giant commits like this one in the future. The TableGen-produced
register lists are getting quite large, and it may be necessary to
change the table representation.

This makes it possible to do so without changing all clients (again).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157854 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
f152fe8d487c46873bbdd4abab43200f783e978b 01-Jun-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Switch some getAliasSet clients to MCRegAliasIterator.

MCRegAliasIterator can optionally visit the register itself, allowing
for simpler code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157837 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
dbb4e57a3c7fb18d5ff2d9504c5cacb5df20fab4 24-May-2012 Bill Wendling <isanbard@gmail.com> Forgot to reverse conditional.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157349 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
20350db44807f6863c3c00345934d45763ed21d3 24-May-2012 Bill Wendling <isanbard@gmail.com> Reduce indentation by early detection of 'continue'. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157348 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6a8c7bf8e72338e55f0f9583e1828f62da165d4a 23-Apr-2012 Preston Gurd <preston.gurd@intel.com> This patch fixes a problem which arose when using the Post-RA scheduler
on X86 Atom. Some of our tests failed because the tail merging part of
the BranchFolding pass was creating new basic blocks which did not
contain live-in information. When the anti-dependency code in the Post-RA
scheduler ran, it would sometimes rename the register containing
the function return value because the fact that the return value was
live-in to the subsequent block had been lost. To fix this, it is necessary
to run the RegisterScavenging code in the BranchFolding pass.

This patch makes sure that the register scavenging code is invoked
in the X86 subtarget only when post-RA scheduling is being done.
Post RA scheduling in the X86 subtarget is only done for Atom.

This patch adds a new function to the TargetRegisterClass to control
whether or not live-ins should be preserved during branch folding.
This is necessary in order for the anti-dependency optimizations done
during the PostRASchedulerList pass to work properly when doing
Post-RA scheduling for the X86 in general and for the Intel Atom in particular.

The patch adds and invokes the new function trackLivenessAfterRegAlloc()
instead of using the existing requiresRegisterScavenging().
It changes BranchFolding.cpp to call trackLivenessAfterRegAlloc() instead of
requiresRegisterScavenging(). It changes the all the targets that
implemented requiresRegisterScavenging() to also implement
trackLivenessAfterRegAlloc().

It adds an assertion in the Post RA scheduler to make sure that post RA
liveness information is available when it is needed.

It changes the X86 break-anti-dependencies test to use –mcpu=atom, in order
to avoid running into the added assertion.

Finally, this patch restores the use of anti-dependency checking
(which was turned off temporarily for the 3.1 release) for
Intel Atom in the Post RA scheduler.

Patch by Andy Zhang!

Thanks to Jakob and Anton for their reviews.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
80799fbe3c048cc78aba59c389e4b33e936bc190 27-Mar-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Branch folding may invalidate liveness.

Branch folding can use a register scavenger to update liveness
information when required. Don't do that if liveness information is
already invalid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
5b2749abf585f9e28656c289001c2327eed401af 07-Mar-2012 Bill Wendling <isanbard@gmail.com> Where the BranchFolding pass removes a branch then adds another better branch,
the DebugLoc information can be maintained throughout by grabbing the DebugLoc
before the RemoveBranch and then passing the result to the InsertBranch.
Patch by Andrew Stanford-Jason!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152212 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
9ebfbf8b9fd5f982e0db9293808bd32168615ba9 05-Mar-2012 Craig Topper <craig.topper@gmail.com> Convert more GenRegisterInfo tables from unsigned to uint16_t to reduce static data size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152016 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
e4fd907e72a599eddfa7a81eac4366b5b82523e3 04-Mar-2012 Craig Topper <craig.topper@gmail.com> Use uint16_t to store register overlaps to reduce static data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
90f20044ade3712c8b0c3f4ebe47d57ad15ae6ce 22-Feb-2012 Chad Rosier <mcrosier@apple.com> Remove extra semi-colons.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151169 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a230262791397c88beeb7ca9bb97c8a8a026e848 16-Feb-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Handle register masks in branch folding.

Don't attempt to move instructions with regmask operands. They are most
likely calls anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
61f1e3db43e556f495b6b9360d2f550291f78471 08-Feb-2012 Andrew Trick <atrick@apple.com> Move pass configuration out of pass constructors: BranchFolderPass

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1df91b0e54bc62f8fc7a06a4f75220e40aa2dfe0 08-Feb-2012 Andrew Trick <atrick@apple.com> whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150094 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4d6ccb5f68cd7c6418a209f1fa4dbade569e4493 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c16c25fbc3b53da99dcaf27685a6116249f79b30 12-Jan-2012 Evan Cheng <evan.cheng@apple.com> When hoisting common code, watch out for uses which are marked "kill". If the
killed registers are needed below the insertion point, then unset the kill
marker.

Sorry I'm not able to find a reduced test case.

rdar://10660944


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
70017fb01bba634649f7f3b1dee33c6cda0721d0 07-Jan-2012 Evan Cheng <evan.cheng@apple.com> Revert part of r147716. Looks like x87 instructions kill markers are all messed
up so branch folding pass can't use the scavenger. :-( This doesn't breaks
anything currently. It just means targets which do not carefully update kill
markers cannot run post-ra scheduler (not new, it has always been the case).

We should fix this at some point since it's really hacky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
977679d6034791fd48a344e5b990503ba50fc242 07-Jan-2012 Evan Cheng <evan.cheng@apple.com> Added a late machine instruction copy propagation pass. This catches
opportunities that only present themselves after late optimizations
such as tail duplication .e.g.
## BB#1:
movl %eax, %ecx
movl %ecx, %eax
ret

The register allocator also leaves some of them around (due to false
dep between copies from phi-elimination, etc.)

This required some changes in codegen passes. Post-ra scheduler and the
pseudo-instruction expansion passes have been moved after branch folding
and tail merging. They were before branch folding before because it did
not always update block livein's. That's fixed now. The pass change makes
independently since we want to properly schedule instructions after
branch folding / tail duplication.

rdar://10428165
rdar://10640363



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
ddfd1377d2e4154d44dc3ad217735adc15af2e3f 14-Dec-2011 Evan Cheng <evan.cheng@apple.com> - Add MachineInstrBundle.h and MachineInstrBundle.cpp. This includes a function
to finalize MI bundles (i.e. add BUNDLE instruction and computing register def
and use lists of the BUNDLE instruction) and a pass to unpack bundles.
- Teach more of MachineBasic and MachineInstr methods to be bundle aware.
- Switch Thumb2 IT block to MI bundles and delete the hazard recognizer hack to
prevent IT blocks from being broken apart.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
5a96b3dad2f634c9081c8b2b6c2575441dc5a2bd 07-Dec-2011 Evan Cheng <evan.cheng@apple.com> Add bundle aware API for querying instruction properties and switch the code
generator to it. For non-bundle instructions, these behave exactly the same
as the MC layer API.

For properties like mayLoad / mayStore, look into the bundle and if any of the
bundled instructions has the property it would return true.
For properties like isPredicable, only return true if *all* of the bundled
instructions have the property.
For properties like canFoldAsLoad, isCompare, conservatively return false for
bundles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a823e3d42c48ceeb2f5011f7402031bf02fa0fe1 26-Oct-2011 Bill Wendling <isanbard@gmail.com> Reapply r142920 with fix:

An MBB which branches to an EH landing pad shouldn't be considered for tail merging.

In SjLj EH, the jump to the landing pad is not done explicitly through a branch
statement. The EH landing pad is added as a successor to the throwing
BB. Because of that however, the branch folding pass could mistakenly think that
it could merge the throwing BB with another BB. This isn't safe to do.
<rdar://problem/10334833>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
51583ce4b6938a44a246df65977e29e0509a7f5b 25-Oct-2011 Duncan Sands <baldrick@free.fr> Revert commit 142891. Takumi bisected the tablegen miscompiles
down to this commit. Original commit message:

An MBB which branches to an EH landing pad shouldn't be considered for tail merging.

In SjLj EH, the jump to the landing pad is not done explicitly through a branch
statement. The EH landing pad is added as a successor to the throwing
BB. Because of that however, the branch folding pass could mistakenly think that
it could merge the throwing BB with another BB. This isn't safe to do.
<rdar://problem/10334833>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
86ed4089e367956ea7134dd7e99334a084fec6df 25-Oct-2011 Bill Wendling <isanbard@gmail.com> An MBB which branches to an EH landing pad shouldn't be considered for tail merging.

In SjLj EH, the jump to the landing pad is not done explicitly through a branch
statement. The EH landing pad is added as a successor to the throwing
BB. Because of that however, the branch folding pass could mistakenly think that
it could merge the throwing BB with another BB. This isn't safe to do.
<rdar://problem/10334833>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142891 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
54cfeda74574ee167fc1261ddc71d64ee94add11 05-Aug-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix liveness computations in BranchFolding.

The old code would look at kills and defs in one pass over the
instruction operands, causing problems with this code:

%R0<def>, %CPSR<def,dead> = tLSLri %R5<kill>, 2, pred:14, pred:%noreg
%R0<def>, %CPSR<def,dead> = tADDrr %R4<kill>, %R0<kill>, pred:14, %pred:%noreg

The last instruction kills and redefines %R0, so it is still live after
the instruction.

This caused a register scavenger crash when compiling 483.xalancbmk for
armv6. I am not including a test case because it requires too much bad
luck to expose this old bug.

First you need to convince the register allocator to use %R0 twice on
the tADDrr instruction, then you have to convince BranchFolding to do
something that causes it to run the register scavenger on he bad block.

<rdar://problem/9898200>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a38cfb2fceb266bd78164021c08284dc59a1e8a3 07-Jul-2011 Eli Friedman <eli.friedman@gmail.com> When tail-merging multiple blocks, make sure to correctly update the live-in list on the merged block to correctly account for the live-outs of all the predecessors. They might not be the same in all cases (the testcase I have involves a PHI node where one of the operands is an IMPLICIT_DEF).

Unfortunately, the testcase I have is large and confidential, so I don't have a test to commit at the moment; I'll see if I can come up with something smaller where this issue reproduces.

<rdar://problem/9716278>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134565 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
e837dead3c8dc3445ef6a0e2322179c57e264a13 28-Jun-2011 Evan Cheng <evan.cheng@apple.com> - Rename TargetInstrDesc, TargetOperandInfo to MCInstrDesc and MCOperandInfo and
sink them into MC layer.
- Added MCInstrInfo, which captures the tablegen generated static data. Chang
TargetInstrInfo so it's based off MCInstrInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134021 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
f924dea8ddb74df8d591f8fdc409fc5b8b5e10d4 14-Jun-2011 Rafael Espindola <rafael.espindola@gmail.com> Add 132986 back, but avoid non-determinism if a bb address gets reused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7a07083c25074b560fea1198a86facf3a95af850 14-Jun-2011 Rafael Espindola <rafael.espindola@gmail.com> revert 132986 to see if the bots go green.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
3a42565ccb169ec4acf79698b38d7da880f13364 14-Jun-2011 Rafael Espindola <rafael.espindola@gmail.com> Make the threshold used by branch folding softer. Before we would get a
sharp all or nothing transition when one extra predecessor was added. Now
we still test first ones for merging.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132974 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
95ba669e09c30f9aa1a7d754199548b8e6a227ce 26-May-2011 Devang Patel <dpatel@apple.com> Add comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
785badb83e09ebae485c40f3fd86576581dd516e 26-May-2011 Devang Patel <dpatel@apple.com> During branch folding avoid inserting redundant DBG_VALUE machine instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6175e03825070f53b17deeb9156935ac1ac06672 13-May-2011 Evan Cheng <evan.cheng@apple.com> Update comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131258 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7139d3516526317497e70348e33a57b52ddc053c 12-May-2011 Evan Cheng <evan.cheng@apple.com> Re-enable branchfolding common code hoisting optimization. Fixed a liveness test bug and also taught it to update liveins.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
30adced41b17cc9a5c301386e80567faccaff04f 12-May-2011 Evan Cheng <evan.cheng@apple.com> Temporarily disable the transformation. It's breaking 186.crafty in some configuration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131235 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
cbc988be22bc9411d95215c8b7251b5f85710674 12-May-2011 Evan Cheng <evan.cheng@apple.com> Re-commit 131172 with fix. MachineInstr identity checks should check dead
markers. In some cases a register def is dead on one path, but not on
another.

This is passing Clang self-hosting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131214 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
41cdc16e7301c91d2460aa14412f592695b0d4ed 11-May-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert 131172 as it is causing clang to miscompile itself. I will try
to provide a reduced testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131176 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7e20a574eb3f4fc3840a0490c814443d756e2e0e 11-May-2011 Evan Cheng <evan.cheng@apple.com> Add a late optimization to BranchFolding that hoist common instruction sequences
at the start of basic blocks to their common predecessor. It's actually quite
common (e.g. about 50 times in JM/lencod) and has shown to be a nice code size
benefit. e.g.

pushq %rax
testl %edi, %edi
jne LBB0_2
## BB#1:
xorb %al, %al
popq %rdx
ret
LBB0_2:
xorb %al, %al
callq _foo
popq %rdx
ret

=>

pushq %rax
xorb %al, %al
testl %edi, %edi
je LBB0_2
## BB#1:
callq _foo
LBB0_2:
popq %rdx
ret

rdar://9145558


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131172 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d3dbd5f5cdb54b5e9472ec6040612fc4d898d297 22-Apr-2011 Bill Wendling <isanbard@gmail.com> Branch folding is folding a landing pad into a regular BB.

An exception is thrown via a call to _cxa_throw, which we don't expect to
return. Therefore, the "true" part of the invoke goes to a BB that has
'unreachable' as its only instruction. This is lowered into an empty MachineBB.
The landing pad for this invoke, however, is directly after the "true" MBB.
When the empty MBB is removed, the landing pad is directly below the BB with the
invoke call. The unconditional branch is removed and then the two blocks are
merged together.

The testcase is too big for a regression test.
<rdar://problem/9305728>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
cf13af6fdee302c2cc8628ae95b40b2bccfdde4b 22-Feb-2011 Evan Cheng <evan.cheng@apple.com> Add more debugging output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126158 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
90c579de5a383cee278acc3f7e7b9d0a656e6a35 06-Aug-2010 Owen Anderson <resistor@mac.com> Reapply r110396, with fixes to appease the Linux buildbot gods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1f74590e9d1b9cf0f1f81a156efea73f76546e05 06-Aug-2010 Owen Anderson <resistor@mac.com> Revert r110396 to fix buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
9ccaf53ada99c63737547c0235baeb8454b04e80 06-Aug-2010 Owen Anderson <resistor@mac.com> Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier. Clean up APIs related to this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855 22-Jun-2010 Evan Cheng <evan.cheng@apple.com> Tail merging pass shall not break up IT blocks. rdar://8115404


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
86050dc8cc0aaea8c9dfeb89de02cafbd7f48d92 19-Jun-2010 Evan Cheng <evan.cheng@apple.com> Allow ARM if-converter to be run after post allocation scheduling.
- This fixed a number of bugs in if-converter, tail merging, and post-allocation
scheduler. If-converter now runs branch folding / tail merging first to
maximize if-conversion opportunities.
- Also changed the t2IT instruction slightly. It now defines the ITSTATE
register which is read by instructions in the IT block.
- Added Thumb2 specific hazard recognizer to ensure the scheduler doesn't
change the instruction ordering in the IT block (since IT mask has been
finalized). It also ensures no other instructions can be scheduled between
instructions in the IT block.

This is not yet enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
3bf912593301152b65accb9d9c37a95172f1df5a 18-Jun-2010 Stuart Hastings <stuart@apple.com> Add a DebugLoc parameter to TargetInstrInfo::InsertBranch(). This
addresses a longstanding deficiency noted in many FIXMEs scattered
across all the targets.

This effectively moves the problem up one level, replacing eleven
FIXMEs in the targets with eight FIXMEs in CodeGen, plus one path
through FastISel where we actually supply a DebugLoc, fixing Radar
7421831.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106243 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
30fc5bbfd1047c666bfd653fefb74ffdc6e966f5 03-May-2010 Dan Gohman <gohman@apple.com> Fix a bug which prevented tail merging of return instructions in
beneficial cases. See the changes in test/CodeGen/X86/tail-opts.ll and
test/CodeGen/ARM/ifcvt2.ll for details.

The fix is to change HashEndOfMBB to hash at most one instruction,
instead of trying to apply heuristics about when it will be profitable to
consider more than one instruction. The regular tail-merging heuristics
are already prepared to handle the same cases, and they're more precise.

Also, make test/CodeGen/ARM/ifcvt5.ll and
test/CodeGen/Thumb2/thumb2-branch.ll slightly more complex so that they
continue to test what they're intended to test.

And, this eliminates the problem in
test/CodeGen/Thumb2/2009-10-15-ITBlockBranch.ll, the testcase from
PR5204. Update it accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
93d6a7e9c21204c52d6efec6c672163e7de79660 02-Apr-2010 Dale Johannesen <dalej@apple.com> Teach AnalyzeBranch, RemoveBranch and the branch
folder to be tolerant of debug info following the
branch(es) at the end of a block.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
80d23705e6df49a41298fd345be6f8a8d72f4fd0 19-Mar-2010 Bob Wilson <bob.wilson@apple.com> Stop trying to merge identical jump tables. This had been inadvertently
disabled for several months (since svn r88806) and no one noticed. My fix
for pr6543 yesterday reenabled it, but broke the ARM port's code for using
TBB/TBH. Rather than adding a target hook to disable merging for Thumb2 only,
I'm just taking this out. It is not common to have identical jump tables,
the code we used to merge them was O(N^2), and it only helps code size, not
performance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a1bdfc3c7fcd7bf8e42c6e4805bfb694230c7a55 17-Mar-2010 Bob Wilson <bob.wilson@apple.com> Remove a check that can no longer be true, after r84803.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
18589de9b1b8c157dea602653042e486128dd9e4 14-Mar-2010 Chris Lattner <sabre@nondot.org> eliminate InvalidateLabel and LabelIDList from MMI and replace
them with a counter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
2cd9ffef6e74febd727f0b548c21ba3f4e5cd26f 10-Mar-2010 Dale Johannesen <dalej@apple.com> Fix another place where DEBUG_VALUE affected codegen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c5cf227f3dac755508928b9dee8ac6a45dcb4e4f 10-Mar-2010 Dale Johannesen <dalej@apple.com> This survived a bootstrap, so let's try 98104 again.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7dda453410eb957cd52cff4f8fa8d5a9c09e28df 10-Mar-2010 Dale Johannesen <dalej@apple.com> Speculatively revert 98104; could be what's causing crashes



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98108 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7f876967c0b368de48a1d0b9318b5113fddcf591 10-Mar-2010 Dale Johannesen <dalej@apple.com> Ever more complicated DEBUG_VALUE fixes for branch folding.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
84839daa595968286acd25644820c644867f0c52 08-Mar-2010 Dale Johannesen <dalej@apple.com> Fix dbg value handling in tail merging.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97938 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
b0812f114b83a32c4b90a4b553c7177c557558b5 05-Mar-2010 Dale Johannesen <dalej@apple.com> Fix some more places where dbg_value affected codegen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
518bb53485df640d7b7e3f6b0544099020c42aa7 09-Feb-2010 Chris Lattner <sabre@nondot.org> move target-independent opcodes out of TargetInstrInfo
into TargetOpcodes.h. #include the new TargetOpcodes.h
into MachineInstr. Add new inline accessors (like isPHI())
to MachineInstr, and start using them throughout the
codebase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
071c62fad0b25ad4131e7f984173a796c1e63f61 26-Jan-2010 Chris Lattner <sabre@nondot.org> Rearrange handling of jump tables. Highlights:
1. MachineJumpTableInfo is now created lazily for a function the first time
it actually makes a jump table instead of for every function.
2. The encoding of jump table entries is now described by the
MachineJumpTableInfo::JTEntryKind enum. This enum is determined by the
TLI::getJumpTableEncoding() hook, instead of by lots of code scattered
throughout the compiler that "knows" that jump table entries are always
32-bits in pic mode (for example).
3. The size and alignment of jump table entries is now calculated based on
their kind, instead of at machinefunction creation time.

Future work includes using the EntryKind in more places in the compiler,
eliminating other logic that "knows" the layout of jump tables in various
situations.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
465e2b950d61c870fb3120c80191973e8282a3ef 24-Dec-2009 David Greene <greened@obbligato.org> Change errs() to dbgs().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92097 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
fe586b3e3800b397256ca9ee6a2811fc6ce7dce9 16-Dec-2009 Bill Wendling <isanbard@gmail.com> Initialize uninitialized variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
408e9d166a66c8891637975921de2980c1940c3f 16-Dec-2009 Bill Wendling <isanbard@gmail.com> Initialize uninitialized variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
43cf6c3939176e8d87719516f0b2e4c6c346f340 15-Dec-2009 Bill Wendling <isanbard@gmail.com> Revert these. They may have been causing 483_xalancbmk to fail:

$ svn merge -c -91161 https://llvm.org/svn/llvm-project/llvm/trunk
--- Reverse-merging r91161 into '.':
U lib/CodeGen/BranchFolding.cpp
U lib/CodeGen/MachineBasicBlock.cpp
$ svn merge -c -91113 https://llvm.org/svn/llvm-project/llvm/trunk
--- Reverse-merging r91113 into '.':
G lib/CodeGen/MachineBasicBlock.cpp
$ svn merge -c -91101 https://llvm.org/svn/llvm-project/llvm/trunk
--- Reverse-merging r91101 into '.':
U include/llvm/CodeGen/MachineBasicBlock.h
G lib/CodeGen/MachineBasicBlock.cpp
$ svn merge -c -91092 https://llvm.org/svn/llvm-project/llvm/trunk
--- Reverse-merging r91092 into '.':
G include/llvm/CodeGen/MachineBasicBlock.h
G lib/CodeGen/MachineBasicBlock.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91376 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c42a0b75a41144be86d40872b57850ab578969ea 11-Dec-2009 Bill Wendling <isanbard@gmail.com> Don't try to move a MBB into the fall-through position if it's a landing pad or
branches only to a landing pad. Without this check, the compiler would go into
an infinite loop because the branch to a landing pad is an "abnormal" edge which
wasn't being taken into account.

This is the meat of that fix:

if (!PrevBB.canFallThrough() && !MBB->BranchesToLandingPad(MBB)) {

The other stuff is simplification of the "branches to a landing pad" code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
864e2efce2cb5d02e376933933d96074723fe77c 05-Dec-2009 Dan Gohman <gohman@apple.com> Remove the target hook TargetInstrInfo::BlockHasNoFallThrough in favor of
MachineBasicBlock::canFallThrough(), which is target-independent and more
thorough.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7896c9f436a4eda5ec15e882a7505ba482a2fcd0 03-Dec-2009 Chris Lattner <sabre@nondot.org> improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
15acadde5f87703da5f36721a19c09a7e3f97f53 26-Nov-2009 Bob Wilson <bob.wilson@apple.com> Split tail duplication into a separate pass. This is needed to avoid
running tail duplication when doing branch folding for if-conversion, and
we also want to be able to run tail duplication earlier to fix some
reg alloc problems. Move the CanFallThrough function from BranchFolding
to MachineBasicBlock so that it can be shared by TailDuplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
f8c4cfb7cc330234112e1378dac6424d9956add0 25-Nov-2009 Bob Wilson <bob.wilson@apple.com> Refactor target hook for tail duplication as requested by Chris.
Make tail duplication of indirect branches much more aggressive (for targets
that indicate that it is profitable), based on further experience with
this transformation. I compiled 3 large applications with and without
this more aggressive tail duplication and measured minimal changes in code
size. ("size" on Darwin seems to round the text size up to the nearest
page boundary, so I can only say that any code size increase was less than
one 4k page.) Radar 7421267.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89814 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
fbb6b67df086fa5ed54e2ff27c15e4c087883957 19-Nov-2009 Bob Wilson <bob.wilson@apple.com> There should be no need to keep renumbering blocks during tail duplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
60f34b9fb0323688e93cf347d63b56327d6250f8 18-Nov-2009 Bob Wilson <bob.wilson@apple.com> Tail duplication still needs to iterate. Duplicating new instructions onto
the tail of a block may make that block a new candidate for duplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
79d621035ebe620261dd8139a0882f62edabbfdb 18-Nov-2009 Bob Wilson <bob.wilson@apple.com> Add another statistic to measure code size due to tail duplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89254 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7cd5d3e05ca9573dbac1a01846813037f901480c 18-Nov-2009 Bob Wilson <bob.wilson@apple.com> Add statistics for tail duplication.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
834b08af8d3d8fc6c76ac6ca40674565689e8d7f 18-Nov-2009 Bob Wilson <bob.wilson@apple.com> Add a target hook to allow changing the tail duplication limit based on the
contents of the block to be duplicated. Use this for ARM Cortex A8/9 to
be more aggressive tail duplicating indirect branches, since it makes it
much more likely that they will be predicted in the branch target buffer.
Testcase coming soon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89187 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
aa60ddac394e8d79ecd9700e32b595c115585007 17-Nov-2009 Bob Wilson <bob.wilson@apple.com> Remove a special case for tail merging that seems to be both broken and
unnecessary. It is broken because the "isIdenticalTo" check should be
negated. If that is fixed, this code causes the CodeGen/X86/tail-opts.ll
test to fail, in the dont_merge_oddly function. And, I confirmed that the
regression is real -- the generated code is worse. As far as I can tell,
that tail-opts.ll test is checking for what this code is supposed to handle
and we're doing the right thing anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
37d60fd1427386f68faeb0217ac2034d1acfe486 17-Nov-2009 Dan Gohman <gohman@apple.com> Set MadeChange instead of MadeChangeThisIteration.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89114 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
465c8252f282fda26db6962a81948afce7f01cc2 17-Nov-2009 Bob Wilson <bob.wilson@apple.com> Update a comment, now that tail duplication happens after other branch
folding optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89109 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
56ea69c3a251434db3fef489881368e29c95712d 17-Nov-2009 Bob Wilson <bob.wilson@apple.com> Perform tail duplication only once, after tail merging is complete.
It was too difficult to keep the heuristics for merging and duplication
consistent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4a504c6ff8c3d82e0e220611fbf53b2c9d9acdfd 16-Nov-2009 Bob Wilson <bob.wilson@apple.com> Fix a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c4a0c843e4c58386b263903ccbef2cdb980821b5 16-Nov-2009 Bob Wilson <bob.wilson@apple.com> Fix some comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88932 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d34f5d91bc6fdc55085d3c4d509c778d6bcc5f0a 16-Nov-2009 Bob Wilson <bob.wilson@apple.com> Whitespace: be consistent with pointer syntax.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88929 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
3cbc3120873242d93e469b4635c0bbd09fdb6438 16-Nov-2009 Bob Wilson <bob.wilson@apple.com> Clean up whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88927 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c4c550c7584b3240bda71d4339ec49c1cf731d55 13-Nov-2009 Dan Gohman <gohman@apple.com> When optimizing for size, don't tail-merge unless it's likely to be a
code-size win, and not when it's only likely to be code-size neutral,
such as when only a single instruction would be eliminated and a new
branch would be required.

This fixes rdar://7392894.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
72b2990a7495b9df89e151eb711c1e7abdd5f2e5 12-Nov-2009 Dan Gohman <gohman@apple.com> Make the BranchFolderPass class local to BranchFolding.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
8520149db158427339a235a74dd2cc19553a7328 12-Nov-2009 Dan Gohman <gohman@apple.com> Minor code cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
ad6af45dc172fe23801771200eabb6a7f764e2cb 12-Nov-2009 Dan Gohman <gohman@apple.com> Tail merge at any size when there are two potentials blocks and one
can be made to fall through into the other.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
ffe644ebf4dcc50b314261ddd2d08c841f629349 11-Nov-2009 Dan Gohman <gohman@apple.com> Promote MergePotentialsElt and SameTailElt to be regular classes
instead of typedefs for std::pair. This simplifies the type of
SameTails, which previously was std::vector<std::pair<std::vector<std::pair<unsigned, MachineBasicBlock *> >::iterator, MachineBasicBlock::iterator>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7cc253e3b85b27540bbc91b8331e06e7a65fbc4c 11-Nov-2009 Dan Gohman <gohman@apple.com> Revert this line of 86871.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
2210c0bea83aa8a8585d793a1f63e8c01b65be38 11-Nov-2009 Dan Gohman <gohman@apple.com> Add support for tail duplication to BranchFolding, and extend
tail merging support to handle more cases.
- Recognize several cases where tail merging is beneficial even when
the tail size is smaller than the generic threshold.
- Make use of MachineInstrDesc::isBarrier to help detect
non-fallthrough blocks.
- Check for and avoid disrupting fall-through edges in more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
cdc06ba5dfdded6cdc48061d36b63b807962ab31 11-Nov-2009 Dan Gohman <gohman@apple.com> Fix indentation level.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4e3f125e184f96ae72f2c44d16cafe0d44158283 11-Nov-2009 Dan Gohman <gohman@apple.com> Whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a127edceae2a0097133e9f032e759f9d15f92b7e 11-Nov-2009 Dan Gohman <gohman@apple.com> Prefix MBB numbers with "BB#" in debug output to make it clear what
the numbers mean.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86854 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d194498d2669e28cd8e85b0ceb7c69a7ec66da13 11-Nov-2009 Dan Gohman <gohman@apple.com> Minor code simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7071528e4e1879b67d043e6058b758f17ae7ac1b 10-Nov-2009 Dan Gohman <gohman@apple.com> Remove an unused variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
b2e40990c40999804f0f28650685c4af18e4c261 10-Nov-2009 Dan Gohman <gohman@apple.com> Minor code simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
888acc35a3e271d092f9b1efc7c32b94ff17fbf7 04-Nov-2009 Bob Wilson <bob.wilson@apple.com> Fix branch folding bug for indirect branches: for a block containing only
an unconditional branch (possibly from tail merging), this code is
trying to redirect all of its predecessors to go directly to the branch
target, but that isn't feasible for indirect branches. The other
predecessors (that don't end with indirect branches) could theoretically
still be handled, but that is not easily done right now.

The AnalyzeBranch interface doesn't currently let us distinguish jump table
branches from indirect branches, and this code is currently handling
jump tables. To avoid punting on address-taken blocks, we would have to give
up handling jump tables. That seems like a bad tradeoff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
ab918103d284b91105831c6b198ad2ab760b907d 30-Oct-2009 Dan Gohman <gohman@apple.com> Don't delete blocks which have their address taken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7b888b8ad07cccec099634bc838eed5da3f336b1 29-Oct-2009 Bob Wilson <bob.wilson@apple.com> Refactor complicated predicate into a separate function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
2c04dae715b05017d7d2c19ab4f8cb37c1e650ae 28-Oct-2009 Bob Wilson <bob.wilson@apple.com> Reimplement BranchFolding change to avoid tail merging for a 1 instruction
common tail, except when the OptimizeForSize function attribute is present.
Radar 7338114.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a597103c328e29fb763e7a4864bd7c29a588fc9d 28-Oct-2009 Bob Wilson <bob.wilson@apple.com> Revert r85346 change to control tail merging by CodeGenOpt::Level.
I'm going to redo this using the OptimizeForSize function attribute.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
cd4f04d6bcb7aefa24d92582fbadfe17519f4756 28-Oct-2009 Bob Wilson <bob.wilson@apple.com> Record CodeGen optimization level in the BranchFolding pass so that we can
use it to control tail merging when there is a tradeoff between performance
and code size. When there is only 1 instruction in the common tail, we have
been merging. That can be good for code size but is a definite loss for
performance. Now we will avoid tail merging in that case when the
optimization level is "Aggressive", i.e., "-O3". Radar 7338114.

Since the IfConversion pass invokes BranchFolding, it too needs to know
the optimization level. Note that I removed the RegisterPass instantiation
for IfConversion because it required a default constructor. If someone
wants to keep that for some reason, we can add a default constructor with
a hard-wired optimization level.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6d31268a7dc9854fa5a5cb9227ba9a15c5898414 22-Oct-2009 Dan Gohman <gohman@apple.com> Revert the main portion of r31856. It was causing BranchFolding
to break up CFG diamonds by banishing one of the blocks to the end of
the function, which is bad for code density and branch size.

This does pessimize MultiSource/Benchmarks/Ptrdist/yacr2, the
benchmark cited as the reason for the change, however I've examined
the code and it looks more like a case of gaming a particular
branch than of being generally applicable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84803 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
030a0a0cdb38924e55773a8e0b5fe7347aa664aa 04-Sep-2009 Evan Cheng <evan.cheng@apple.com> Run branch folding if if-converter make some transformations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
b3c27428969b3cc52ab8493e91b5dd1465325fed 04-Sep-2009 Evan Cheng <evan.cheng@apple.com> Funky indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80971 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
3403bcd8f943cb053a7d9bbf8eb8135407699afa 22-Aug-2009 Bill Wendling <isanbard@gmail.com> Convert DOUT to DEBUG(errs()...).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79747 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
da65822cfc938594f8fb7840947c1eb77e057a48 18-Aug-2009 Dan Gohman <gohman@apple.com> Make tail merging handle blocks with repeated predecessors correctly, and
remove RemoveDuplicateSuccessor, as it is no longer necessary, and because
it breaks assumptions made in
MachineBasicBlock::isOnlyReachableByFallthrough.

Convert test/CodeGen/X86/omit-label.ll to FileCheck and add a testcase
for PR4732.

test/CodeGen/Thumb2/thumb2-ifcvt2.ll sees a diff with this commit due to
it being bugpoint-reduced to the point where it doesn't matter what the
condition for the branch is.

Add some more interesting code to
test/CodeGen/X86/2009-08-06-branchfolder-crash.ll, which is the testcase
that originally motivated the RemoveDuplicateSuccessor code, to help
verify that the original problem isn't being re-broken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1c5a28706d0b2e712f4c825d638b46bbe6eb67d6 07-Aug-2009 Dale Johannesen <dalej@apple.com> Rewrite previous patch to follow Chris' stylistic
preference; no functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
14e545d18e46187b0f02e7c705a3da3ad82225c2 07-Aug-2009 Dale Johannesen <dalej@apple.com> Fix PR 4626, a crash in branch folding after OptimizeBlock
produced a CFG it wasn't prepared for.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c23197a26f34f559ea9797de51e187087c039c42 14-Jul-2009 Torok Edwin <edwintorok@gmail.com> llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c25e7581b9b8088910da31702d4ca21c4734c6d7 11-Jul-2009 Torok Edwin <edwintorok@gmail.com> assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
bf06f6a6f1be0802ad7b761138ecba568814008a 11-May-2009 Dale Johannesen <dalej@apple.com> Fix PR4188. TailMerging can't tolerate inexact
sucessor info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
dc54d317e7a381ef8e4aca80d54ad1466bb85dda 09-Feb-2009 Evan Cheng <evan.cheng@apple.com> Turns out AnalyzeBranch can modify the mbb being analyzed. This is a nasty
suprise to some callers, e.g. register coalescer. For now, add an parameter
that tells AnalyzeBranch whether it's safe to modify the mbb. A better
solution is out there, but I don't have time to deal with it right now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64124 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1465d61bdd36cfd6021036a527895f0dd358e97d 28-Jan-2009 Duncan Sands <baldrick@free.fr> Rename getAnalysisToUpdate to getAnalysisIfAvailable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63198 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
5d5ee80ea8bf300d1ee8ccbd7174466d98a1e99e 08-Jan-2009 Dan Gohman <gohman@apple.com> Delete unnecessary parens around return values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
0ffa3de9e9b342c0fb529853e14632c66ec9725f 11-Dec-2008 Bill Wendling <isanbard@gmail.com> Add a newline after this debug output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
41474baac839da410302950305722cb0e026a094 03-Dec-2008 Dan Gohman <gohman@apple.com> Add a sanity-check to tablegen to catch the case where isSimpleLoad
is set but mayLoad is not set. Fix all the problems this turned up.

Change code to not use isSimpleLoad instead of mayLoad unless it
really wants isSimpleLoad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
622addbe49ffdc611adb315fb22756e23fe7b222 27-Oct-2008 Dale Johannesen <dalej@apple.com> Increase default setting of tail-merge-threshold to
150, based on llvm-test measurements.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d735b8019b0f297d7c14b55adcd887af24d8e602 03-Oct-2008 Dan Gohman <gohman@apple.com> Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
bbeeb2a61ea19fbb5449260165b56c40fdc4860b 22-Sep-2008 Evan Cheng <evan.cheng@apple.com> Mark several codegen passes as preserving all analysis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
014278e6a11fa0767853b831e5bf51b95bf541c5 13-Sep-2008 Dan Gohman <gohman@apple.com> Remove isImm(), isReg(), and friends, in favor of
isImmediate(), isRegister(), and friends, to avoid confusion
about having two different names with the same meaning. I'm
not attached to the longer names, and would be ok with
changing to the shorter names if others prefer it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
ae73dc1448d25b02cabc7c64c86c64371453dda8 04-Sep-2008 Dan Gohman <gohman@apple.com> Tidy up several unbeseeming casts from pointer to intptr_t.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1501cdbf63cff3afd92df6cd249096770334b268 22-Aug-2008 Dan Gohman <gohman@apple.com> Fix SmallVector's size calculation so that a size of 0 is
handled correctly, and change a few SmallVector uses to use
size 0 to more clearly reflect their intent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
44eb65cf58e3ab9b5621ce72256d1621a18aeed7 15-Aug-2008 Owen Anderson <resistor@mac.com> Convert uses of std::vector in TargetInstrInfo to SmallVector. This change had to be propoagated down into all the targets and up into all clients of this API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54802 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
68d4d1d49c813d10047ad116e897a17d67112c10 29-Jul-2008 Duncan Sands <baldrick@free.fr> Fix PR2609. If a label is deleted, then it needs
to be marked invalid regardless of whether it is
a debug, an exception handling or (hopefully) a
GC label.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54172 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
8e5f2c6f65841542e2a7092553fe42a00048e4c7 08-Jul-2008 Dan Gohman <gohman@apple.com> Pool-allocation for MachineInstrs, MachineBasicBlocks, and
MachineMemOperands. The pools are owned by MachineFunctions.

This drastically reduces the number of calls to malloc/free made
during the "Emit" phase of scheduling, as well as later phases
in CodeGen. Combined with other changes, this speeds up the
"instruction selection" phase of CodeGen by 10% in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53212 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
62bc8a44868bd86e96bdbd2f0d66dda690cc66ad 01-Jul-2008 Dale Johannesen <dalej@apple.com> Fix longstanding thinko: don't exclude
predessors of exit blocks from tail merging
consideration.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4406604047423576e36657c7ede266ca42e79642 01-Jul-2008 Dan Gohman <gohman@apple.com> Split ISD::LABEL into ISD::DBG_LABEL and ISD::EH_LABEL, eliminating
the need for a flavor operand, and add a new SDNode subclass,
LabelSDNode, for use with them to eliminate the need for a label id
operand.

Change instruction selection to let these label nodes through
unmodified instead of creating copies of them. Teach the MachineInstr
emitter how to emit a MachineInstr directly from an ISD label node.

This avoids the need for allocating SDNodes for the label id and
flavor value, as well as SDNodes for each of the post-isel label,
label id, and label flavor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
04478e56f736325d3567e7c0efe2bb5c2766c63b 19-Jun-2008 Dan Gohman <gohman@apple.com> Use the transferSuccessors helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52495 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
679860e31bd7b8f043ba1ccdc5990cb9bafd9055 23-May-2008 Dale Johannesen <dalej@apple.com> Rewrite a loop to avoid using iterators pointing to
elements that have been erased. Based on a patch
by Nicolas Capens.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51485 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
844731a7f1909f55935e3514c9e713a62d67662e 13-May-2008 Dan Gohman <gohman@apple.com> Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
30562b7d4403414936da0661d7c6bda392f26c59 13-May-2008 Dale Johannesen <dalej@apple.com> Be more aggressive about tail-merging small blocks
if those blocks consist entirely of common instructions;
merging will not add an extra branch in this case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
51b2b9e29e4fa828ffd83d36f548bc44a4007822 12-May-2008 Dale Johannesen <dalej@apple.com> Further rework of tail merge algorithm. Not quite
semantically identical, but little difference in
either results or execution speed; but it's much
easier to read, at least IMO.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6b8583cbf1f8a3df5ae859d3da2ca690ff57f91c 10-May-2008 Dale Johannesen <dalej@apple.com> Remove an evil vector bool. Cosmetic refactoring,
no functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6ae83faadf715c398e637424a764f6b02f0b6df2 09-May-2008 Dale Johannesen <dalej@apple.com> Rewrite tail merging algorithm to handle the
case where there are multiple blocks with a large
number of common tail instructions more efficiently
(compile time optimization).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4a3f6c88820a204f80ca0fa3f1f2fe09ca10b02f 06-May-2008 Dan Gohman <gohman@apple.com> Make several variable declarations static.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50696 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
80b09fe8bc1d2755ef9a6b03b8862a657db42f06 10-Apr-2008 Evan Cheng <evan.cheng@apple.com> Teach branch folding pass about implicit_def instructions. Unfortunately we can't just eliminate them since register scavenger expects every register use to be defined. However, we can delete them when there are no intra-block uses. Carefully removing some implicit def's which enable more blocks to be optimized away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49461 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
fb8075d03f5c87bd57dcc9c5f2304f6b13c55aad 28-Feb-2008 Evan Cheng <evan.cheng@apple.com> Add a quick and dirty "loop aligner pass". x86 uses it to align its loops to 16-byte boundaries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
31886dbe370118dbb291b01d58699243a82bc4e1 19-Feb-2008 Evan Cheng <evan.cheng@apple.com> PR1909: Tail merging pass ran wild. It makes no sense to merge blocks in order to save a single instruction since a branch will be inserted for each BB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6f0d024a534af18d9e60b3ea757376cd8a3a980e 10-Feb-2008 Dan Gohman <gohman@apple.com> Rename MRegisterInfo to TargetRegisterInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
303595942502f17c087fa28874c2b89117148c45 29-Jan-2008 Dan Gohman <gohman@apple.com> Use empty() instead of comparing size() with zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
749c6f6b5ed301c84aac562e414486549d7b98eb 07-Jan-2008 Chris Lattner <sabre@nondot.org> rename TargetInstrDescriptor -> TargetInstrDesc.
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
69244300b8a0112efb44b6273ecea4ca6264b8cf 07-Jan-2008 Chris Lattner <sabre@nondot.org> Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
that it is cheap and efficient to get.

Move a variety of predicates from TargetInstrInfo into
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around. Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.

Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45674 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
834f1ce0312e3d00d836f9560cb63182c2c4570f 07-Jan-2008 Chris Lattner <sabre@nondot.org> rename isLoad -> isSimpleLoad due to evan's desire to have such a predicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
2e48a70b35635165703838fc8d3796b664207aa1 06-Jan-2008 Chris Lattner <sabre@nondot.org> rename isStore -> mayStore to more accurately reflect what it captures.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
8aa797aa51cd4ea1ec6f46f4891a6897944b75b2 31-Dec-2007 Chris Lattner <sabre@nondot.org> Add new shorter predicates for testing machine operands for various types:
e.g. MO.isMBB() instead of MO.isMachineBasicBlock(). I don't plan on
switching everything over, so new clients should just start using the
shorter names.

Remove old long accessors, switching everything over to use the short
accessor: getMachineBasicBlock() -> getMBB(),
getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4ee451de366474b9c228b4e5fa573795a715216d 29-Dec-2007 Chris Lattner <sabre@nondot.org> Remove attribution from file headers, per discussion on llvmdev.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
11a4f64bd4cb6d438dd4b5882ee1b7404832f27f 10-Dec-2007 Christopher Lamb <christopher.lamb@gmail.com> Improve branch folding by recgonizing that explict successor relationships impact the value of fall-through choices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
da6efc5268958a0668806e989c1c5a1f788543e5 25-Oct-2007 Bill Wendling <isanbard@gmail.com> Changed XXX to FIXME, and added comment to the README file

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
0713a224234b4596709c7582ebf17a1ccb95c872 25-Oct-2007 Bill Wendling <isanbard@gmail.com> Added comment explaining why we are doing this check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43353 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
80629c85f1041df41b5158ebb03a4725af6ecd90 19-Oct-2007 Bill Wendling <isanbard@gmail.com> Don't branch fold inline asm statements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43191 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
61e729e2e9517ab2d8887bab86fb377900fa1081 02-Aug-2007 Dan Gohman <gohman@apple.com> More explicit keywords.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
97b4ac8c844e08ce1c4f4a73b85ba56775a2a6c5 11-Jul-2007 Duncan Sands <baldrick@free.fr> If assertions are not enabled, we should return False here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
67fcdf7f6579fcc070f019096cedf80d5a834554 11-Jul-2007 David Greene <greened@obbligato.org> Make this work with GLIBCXX_DEBUG.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
8a46d342d8cbca7c9c7be6c66007d41329babad0 29-Jun-2007 David Greene <greened@obbligato.org> Fix misue of iterator pointing to erased object. Uncovered by
_GLIBCXX_DEBUG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
2bdb7d0cc88881857073b36f4a09ebe2f2008c24 19-Jun-2007 Evan Cheng <evan.cheng@apple.com> Move CorrectExtraCFGEdges() from BranchFolding.cpp to a MachineBasicBlock method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37633 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1a90a5aebe3488dc3feaab60ba16bed1659ba27b 08-Jun-2007 Dale Johannesen <dalej@apple.com> Make throttle a hidden parameter, per review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
53af4c01a87b8a60bce2cc19e5249aaed52d6523 08-Jun-2007 Dale Johannesen <dalej@apple.com> Throttle tail merging; handling blocks with large numbers of predecessors
is too slow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37509 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
fe7e397100edd4f2d618a1ff938dfa8624670ec1 05-Jun-2007 Dale Johannesen <dalej@apple.com> Tail merging wasn't working for predecessors of landing pads. PR 1496.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
0370fad74b48388412c52d1325512f2c218487fa 04-Jun-2007 Evan Cheng <evan.cheng@apple.com> Move ReplaceUsesOfBlockWith() out of BranchFolding into a MachineBasicBlock general facility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
8e63bf375d18118f46f43910c6a093c824eb4a7d 02-Jun-2007 Dale Johannesen <dalej@apple.com> Fix CorrectExtraCFGEdges to allow for multiple LandingPad targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a5a2117a4659ecadbec9476f2e537bcb7501b509 02-Jun-2007 Dale Johannesen <dalej@apple.com> Implement smarter algorithm for choosing which blocks to tail-merge.
See test/CodeGen/X86/test-pic-jtbl.ll for a case where it works well;
shaves another 10K off our favorite benchmark. I was hesitant about
this because of compile speed, but seems to do OK on a bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37392 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a52dd151378eeaad1369829b1dc3164874774e04 31-May-2007 Dale Johannesen <dalej@apple.com> Arrange for only 1 of multiple branches to landing pad to be kept.
Do not remove empty landing pads (EH table needs to be updated)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
44008c59188ba61aeacfd8be049e3be548ffcea4 30-May-2007 Dale Johannesen <dalej@apple.com> Changed per review comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
95ef406e0f2da0197f8b46849319c07e9bea1e55 30-May-2007 Dale Johannesen <dalej@apple.com> Make stable_sort in tail merging actually be stable (it never was, but didn't
matter until my last change). Reenable tail merging by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
035fdeb37048bae2f49d3c3b8c246cfc26d9a80d 24-May-2007 Dale Johannesen <dalej@apple.com> Blocks that cond-br and uncond-br/fallthrough to same block should have
only one successor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37324 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
de0963df420f408b2d813bd16f3c040c2d189f63 24-May-2007 Dale Johannesen <dalej@apple.com> Fix for PR1444: do not create two successors to the same block.
Temporarily, this breaks CodeGen/Generic/2006-02-12-InsertLibraryCall.ll
by exposing an unrelated latent problem; working on that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7aea8320340ce867eb4328aeec52cb02c88ef0b3 23-May-2007 Dale Johannesen <dalej@apple.com> Two tail merging improvements:
When considering blocks with more than 2 predecessors, merge the block with
the largest number of matching insns, rather than the first block found.
Considering that 1 matching insn is enough to show a win for candidates that
already end with a branch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37315 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
81da02b553b86868637f27b89c6e919c31ed5b51 22-May-2007 Dale Johannesen <dalej@apple.com> Make tail merging the default, except on powerPC. There was no prior art
for a target-dependent default with a command-line override; this way
should be generally usable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1cf08c1d6d59cbeead241f44d898eaa2a3bf1717 18-May-2007 Dale Johannesen <dalej@apple.com> Remove some unneeded branches. (spotted by Evan, thanks)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37198 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
14ba0cc42959a3fcc9b6781aea614b01877fb55f 15-May-2007 Dale Johannesen <dalej@apple.com> Remove extra CFG edges before doing these passes; it makes them happier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
54f4a6780a33043031af97571dfffdac5a4aa35c 11-May-2007 Dale Johannesen <dalej@apple.com> Do not generate branches to entry block. This fixes several test suite
failures on PPC (can happen only when prologue code is null)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
76b38fcabeba725e166a2ff72c56fe31d784b229 10-May-2007 Dale Johannesen <dalej@apple.com> Make tail merging handle many more cases (all it can, I think).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7d33b4c59b56afb96feea71073c1d9e70c457e28 07-May-2007 Dale Johannesen <dalej@apple.com> Handle some non-exit blocks in tail merging.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1997473cf72957d0e70322e2fe6fe2ab141c58a6 03-May-2007 Devang Patel <dpatel@apple.com> Drop 'const'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
3e15bf33e024b9df9e89351a165acfdb1dde51ed 02-May-2007 Devang Patel <dpatel@apple.com> Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
794fd75c67a2cdc128d67342c6d88a504d186896 01-May-2007 Devang Patel <dpatel@apple.com> Do not use typeinfo to identify pass in pass manager.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
77edc4b1b004726d96c932356750b9f3c96d74dd 01-May-2007 Chris Lattner <sabre@nondot.org> Fix PR1228 and CodeGen/Generic/2007-04-30-LandingPadBranchFolding.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
69cb9b78f11d505f4351a269fc90e7b77fcda437 20-Mar-2007 Dale Johannesen <dalej@apple.com> maintain LiveIn when splitting blocks (register scavenging needs it)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35226 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
033c9715d9bf7ce59ad2e466bf0720811b34da08 22-Feb-2007 Jim Laskey <jlaskey@mac.com> Remove isAccessable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
02b3f5ec4ac120d14a63f7fd4f4388b7d0ab6c22 21-Feb-2007 Jim Laskey <jlaskey@mac.com> Make branch folding behave in the presence of landing pads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6b896cec8b703e08e5f3d809e086a39b6ebe6589 17-Feb-2007 Dale Johannesen <dalej@apple.com> Fixes PR 1200


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
44c3b9fdd416c79f4b67cde1aecfced5921efd81 26-Jan-2007 Jim Laskey <jlaskey@mac.com> Change the MachineDebugInfo to MachineModuleInfo to better reflect usage
for debugging and exception handling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1ee29257428960fede862fcfdbe80d5d007927e9 26-Jan-2007 Jim Laskey <jlaskey@mac.com> Make LABEL a builtin opcode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
cd3245ac45c595da96bb768a55cddc356dff55fe 19-Dec-2006 Chris Lattner <sabre@nondot.org> Eliminate static ctors from Statistics


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
ac0b6ae358944ae8b2b5a11dc08f52c3ed89f2da 06-Dec-2006 Chris Lattner <sabre@nondot.org> Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4b105912657c0472dc4f6f7244ce20bf7cf9a7dc 18-Nov-2006 Chris Lattner <sabre@nondot.org> Don't transform in another bad case: if the block is empty, it should be
simplified before we do this xform so that our cost model is accurate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
f10a56a86f8ae32d0493c7de770493d55519b073 18-Nov-2006 Chris Lattner <sabre@nondot.org> Fix another case we *don't* want to do this xform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
154e1047184384afd0a701a9f8816459cf0b3490 18-Nov-2006 Chris Lattner <sabre@nondot.org> make the previous change more aggressive, moving any block with no fallthrough.
This speeds up yacr2 by 7% on a core2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a7bef4a4e49f461984c04ef6be6eef3f1c023558 18-Nov-2006 Chris Lattner <sabre@nondot.org> Minor code layout tweak: if we have something like this:

if (cond) goto BB2
BB1:
...
return;
BB2:
...

Move BB1 to the end of the function so that the code falls through in the
non-return case. This has the effect of moving assert (and other no-return
call) bodies and return blocks out of loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
5d056952ba2f97729c5db69a3f14250595fa1ee8 08-Nov-2006 Chris Lattner <sabre@nondot.org> optimize single MBB loops better. In particular, produce:

LBB1_57: #bb207.i
movl 72(%esp), %ecx
movb (%ecx,%eax), %cl
movl 80(%esp), %edx
movb %cl, 1(%edx,%eax)
incl %eax
cmpl $143, %eax
jne LBB1_57 #bb207.i
jmp LBB1_64 #cond_next255.i

intead of:

LBB1_57: #bb207.i
movl 72(%esp), %ecx
movb (%ecx,%eax), %cl
movl 80(%esp), %edx
movb %cl, 1(%edx,%eax)
incl %eax
cmpl $143, %eax
je LBB1_64 #cond_next255.i
jmp LBB1_57 #bb207.i

This eliminates a branch per iteration of the loop. This hurted PPC
particularly, because the extra branch meant another dispatch group for each
iteration of the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d41b30def3181bce4bf87e8bde664d15663165d0 05-Nov-2006 Jeff Cohen <jeffc@jolt-lang.org> Unbreak VC++ build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
3ed469ccd7b028a030b550d84b7336d146f5d8fa 02-Nov-2006 Reid Spencer <rspencer@reidspencer.com> For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31380 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d4bf3c2fd60975b30cd067b59f743a3ea45e45b5 01-Nov-2006 Chris Lattner <sabre@nondot.org> give branch folding a simple heuristic to decide which block to split so that
it inserts an uncond branch where it is less likely to cause a problem. This
fixes some perf issues on ppc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
1d08d83230338ca5969ff6ae6737a978336538bf 01-Nov-2006 Chris Lattner <sabre@nondot.org> make tail merging more aggressive. If two blocks share a common tail, but the
tail is not an entire block for either of them, pick one, split it, then
merge the common part.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31336 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
d8ccff0c3e5028019a02dd44bf7d906efc9effd8 01-Nov-2006 Chris Lattner <sabre@nondot.org> enable branch folding with an option


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31335 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6b0e3f890779b7fc912bec8d40a9590e44742737 29-Oct-2006 Chris Lattner <sabre@nondot.org> Make CanFallThrough more intelligent (so it can handle blocks with (e.g.) no
successors), and make island block movement more general.

This compiles CodeGen/X86/2006-04-27-ISelFoldingBug.ll to:

_loadAndRLEsource_no_exit_2E_1_label_2E_0:
subl $8, %esp
movl %esi, 4(%esp)
movl %ebx, (%esp)
movl 16(%esp), %eax
movl 12(%esp), %ecx
LBB1_3: #label.0
movl _last, %edx
movl %edx, %esi
incl %esi
movl %esi, _last
movl %ecx, %ebx
# TRUNCATE movb %bl, %bl
movl _block, %esi
movb %bl, 1(%esi,%edx)
cmpl %eax, _last
jge LBB1_2 #codeRepl5.exitStub
LBB1_4: #label.0
cmpl $257, %ecx
je LBB1_2 #codeRepl5.exitStub
LBB1_1: #label.0.no_exit.1_crit_edge.exitStub
movl $1, %eax
movl (%esp), %ebx
movl 4(%esp), %esi
addl $8, %esp
ret
LBB1_2: #codeRepl5.exitStub
xorl %eax, %eax
movl (%esp), %ebx
movl 4(%esp), %esi
addl $8, %esp
ret

instead of:

_loadAndRLEsource_no_exit_2E_1_label_2E_0:
subl $8, %esp
movl %esi, 4(%esp)
movl %ebx, (%esp)
movl 16(%esp), %eax
movl 12(%esp), %ecx
jmp LBB1_3 #label.0
LBB1_1: #label.0.no_exit.1_crit_edge.exitStub
movl $1, %eax
movl (%esp), %ebx
movl 4(%esp), %esi
addl $8, %esp
ret
LBB1_2: #codeRepl5.exitStub
xorl %eax, %eax
movl (%esp), %ebx
movl 4(%esp), %esi
addl $8, %esp
ret
LBB1_3: #label.0
movl _last, %edx
movl %edx, %esi
incl %esi
movl %esi, _last
movl %ecx, %ebx
# TRUNCATE movb %bl, %bl
movl _block, %esi
movb %bl, 1(%esi,%edx)
cmpl %eax, _last
jge LBB1_2 #codeRepl5.exitStub
LBB1_4: #label.0
cmpl $257, %ecx
jne LBB1_1 #label.0.no_exit.1_crit_edge.exitStub
jmp LBB1_2 #codeRepl5.exitStub

... which is much better layout :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31282 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
6acfe12dd6d52c801f78c240528b7cb42fa91159 28-Oct-2006 Chris Lattner <sabre@nondot.org> Teach branch folding to fold identical jump tables together and to delete
jump tables that are dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
cf420cca572b061fdd63587cb90904c641b6e216 28-Oct-2006 Chris Lattner <sabre@nondot.org> improve deletion of blocks that just contain branches by knowing that
the pred block doesn't fall through into them if it's a jumptable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c2e91e34dc18d794435db86713c06400ea60e930 26-Oct-2006 Chris Lattner <sabre@nondot.org> simplify code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
323ece6fcd9722482a0be6c82afc5abc75739c78 25-Oct-2006 Chris Lattner <sabre@nondot.org> turn off tail merging for now


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31180 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7d09784d3fc652131a2afbf06a0f2ed893837fb9 24-Oct-2006 Chris Lattner <sabre@nondot.org> move single basic blocks that are neither fallen into nor fall out of into
a place more useful. In particular, if we can put them in a place where code
will be able to fall into it, do so. Otherwise, put it in a place it can fall
through into a successor. Otherwise, if preventing a fallthrough, move to the
end of the function, out of the way.

This deletes several hundred unconditional branches from spass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a4bcfe12d1ea16e3e4ea9148e2d9cba3bb63dbda 24-Oct-2006 Chris Lattner <sabre@nondot.org> Enable tail merging by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31140 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
66ebf0973d717b4b2cdef731847aef3904fd04b2 23-Oct-2006 Jim Laskey <jlaskey@mac.com> More complete solution to deleting blocks and debug info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4bc135e93beebdcb3b9c44745c5ccbc91199ac0b 21-Oct-2006 Chris Lattner <sabre@nondot.org> don't break infinite loops


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
a2d799531a748a349b9a458dbbc580b134074c49 21-Oct-2006 Chris Lattner <sabre@nondot.org> Use branch reversal to do stuff like this:

call L_strcmp$stub
testl %eax, %eax
- jne LBB26_208 #cond_true6020
- jmp LBB26_227 #bb7119
+ je LBB26_227 #bb7119
LBB26_208: #cond_true6020
movl $l31_str14, 4(%esp)

testl %eax, %eax
- jne LBB26_704 #cond_true13042
- jmp LBB26_713 #bb13151
+ je LBB26_713 #bb13151
LBB26_704: #cond_true13042
movl $_str52, 4(%esp)

cmpl 76(%ecx), %eax
- jge LBB26_1628 #cond_false63.i.i
- jmp LBB26_1769 #_Z8makeGridP13mrSurfaceListidiidd.exit.i
+ jl LBB26_1769 #_Z8makeGridP13mrSurfaceListidiidd.exit.i
LBB26_1628: #cond_false63.i.i
movl $0, 48964(%esp)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
2d47bd937c13556ace07b2b2daf4dfe75f4e1e90 21-Oct-2006 Chris Lattner <sabre@nondot.org> Transform code like:

jle FOO
jmp BAR
BAR:

into:

jle FOO
BAR:

... whoa!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
386e29065db5b05b57440f6b2a6dfa1e7f29a00d 21-Oct-2006 Chris Lattner <sabre@nondot.org> Three changes:
1. Remove a bunch of ifdef'd code.
2. When a block just contains an uncond branch, change all blocks branching
to it to jump to the destination instead.
3. If branch analysis tells us some edges in the machinecfg are not actually
possible, remove them.

#2 triggers a suprisingly large number of times.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31094 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
12143054aa6d120f029d268a5154bf2ecd0f707f 21-Oct-2006 Chris Lattner <sabre@nondot.org> Add an experimental cross-jumping implementation.
This is currently disabled by default and limited in several ways, but does
have a positive effect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31090 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
683747abb81a7b7711ad6cb5abf5a4227f7ab691 18-Oct-2006 Chris Lattner <sabre@nondot.org> Teach the branch folder to update debug info if it removes blocks with line
# notes in it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
ffddf6ba1c58b42dcfd071972754649c3ca5dff7 17-Oct-2006 Chris Lattner <sabre@nondot.org> Enable deleting branches to successor blocks. With the previous patches,
branch folding can now compile stuff like this:

void foo(int W, int X, int Y, int Z) {
if (W & 1) {
for (; X;--X) bar();
} else if (W & 2) {
for (; Y;--Y) bar();
} else if (W & 4) {
for (; Z;--Z) bar();
} else if (W & 8) {
for (; W;--W) bar();
}

if (W) {
bar();
}
}

contrived testcase where loops exits all end up merging together. To have
the loop merges be:

...
cmplw cr0, r30, r27
bne cr0, LBB1_14 ;bb38
LBB1_16: ;cond_next48.loopexit
mr r27, r29
LBB1_20: ;cond_next48
cmplwi cr0, r27, 0
beq cr0, LBB1_22 ;UnifiedReturnBlock
...

instead of:


...
cmplw cr0, r30, r27
bne cr0, LBB1_14 ;bb38
LBB1_16: ;cond_next48.loopexit
mr r27, r29
b LBB1_20 ;cond_next48
LBB1_17: ;cond_next48.loopexit1
b LBB1_20 ;cond_next48
LBB1_18: ;cond_next48.loopexit2
b LBB1_20 ;cond_next48
LBB1_19: ;cond_next48.loopexit3
LBB1_20: ;cond_next48
cmplwi cr0, r27, 0
beq cr0, LBB1_22 ;UnifiedReturnBlock
...


This is CodeGen/PowerPC/branch-opt.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
c50ffcb7fcb7c1109fee2406e8f74d096f755f47 17-Oct-2006 Chris Lattner <sabre@nondot.org> Reenable this pass, fixing the bugs in it.
It now correctly deletes unreachable blocks and blocks that are empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
8f16eb98ed21a642d7f75c76f4b1acf0f199ee6d 14-Oct-2006 Chris Lattner <sabre@nondot.org> disable this pass for now, it's causing issues


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30951 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7821a8afd3009c3c2760592e61de9e2c31c73e18 14-Oct-2006 Chris Lattner <sabre@nondot.org> falling off the end of a function is ok with an unreachable instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
eb15eeec396145b6f5028d07bd2c4a5e903fdec5 13-Oct-2006 Chris Lattner <sabre@nondot.org> disable some objectionable code, maybe we can bring this pass to life


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
edf128a7fa90f2b0b7ee24741a04a7ae1ecd6f7e 22-Apr-2005 Misha Brukman <brukman+llvm@gmail.com> Remove trailing whitespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21420 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
551ccae044b0ff658fe629dd67edd5ffe75d10e8 02-Sep-2004 Reid Spencer <rspencer@reidspencer.com> Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
4ae131e5da124bb5f7455133fefb1fa3b336192b 01-Aug-2004 Chris Lattner <sabre@nondot.org> Dereferencing end() is bad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
f978a1db517749e91210b7df17b7f11b9a30ae47 31-Jul-2004 Alkis Evlogimenos <alkis@evlogimenos.com> Make OptimizeBlock take a MachineFunction::iterator instead of a
MachineBasicBlock* as a parameter so that nxext() and prior() helper
functions can work naturally on it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15376 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
7f74340733967255cf45f6514cf0f18a1f325371 31-Jul-2004 Chris Lattner <sabre@nondot.org> Next on a pointer increments the pointer, not an iterator


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
9fd332392c184b13eeb2bd3ffc4347034bc7408a 31-Jul-2004 Alkis Evlogimenos <alkis@evlogimenos.com> Use next() helper to make code more readable. Use
MachineFunction::iterator instead of MachineBasicBlock* to avoid
dereferencing end iterators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15373 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
dd0458378128b748d4ac6c6035cd47d021faf507 31-Jul-2004 Alkis Evlogimenos <alkis@evlogimenos.com> Use MachineFunction::iterator instead of a MachineBasicBlock* because
FallThrough maybe == to MF.end().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp
21ab22e47592d8a4046cfdac844d76b2cb76d711 31-Jul-2004 Chris Lattner <sabre@nondot.org> Implement a simple target-independent CFG cleanup pass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/BranchFolding.cpp