<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm/test/Transforms/SROA, branch release_32</title>
<subtitle>http://llvm.org</subtitle>
<id>https://git.amat.us/llvm/atom/test/Transforms/SROA?h=release_32</id>
<link rel='self' href='https://git.amat.us/llvm/atom/test/Transforms/SROA?h=release_32'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/'/>
<updated>2012-12-10T14:20:28Z</updated>
<entry>
<title>Merging r169719: into 3.2 release branch.</title>
<updated>2012-12-10T14:20:28Z</updated>
<author>
<name>Pawel Wodnicki</name>
<email>pawel@32bitmicro.com</email>
</author>
<published>2012-12-10T14:20:28Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=3f0b779be8218760033ad0ff698ea88c3c7e73c9'/>
<id>urn:sha1:3f0b779be8218760033ad0ff698ea88c3c7e73c9</id>
<content type='text'>
Fix PR14548: SROA was crashing on a mixture of i1 and i8 loads and stores.

When SROA was evaluating a mixture of i1 and i8 loads and stores, in
just a particular case, it would tickle a latent bug where we compared
bits to bytes rather than bits to bits. As a consequence of the latent
bug, we would allow integers through which were not byte-size multiples,
a situation the later rewriting code was never intended to handle.

In release builds this could trigger all manner of oddities, but the
reported issue in PR14548 was forming invalid bitcast instructions.

The only downside of this fix is that it makes it more clear that SROA
in its current form is not capable of handling mixed i1 and i8 loads and
stores. Sometimes with the previous code this would work by luck, but
usually it would crash, so I'm not terribly worried. I'll watch the LNT
numbers just to be sure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@169735 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Merging r169084: into 3.2 release branch.</title>
<updated>2012-12-04T18:29:45Z</updated>
<author>
<name>Pawel Wodnicki</name>
<email>pawel@32bitmicro.com</email>
</author>
<published>2012-12-04T18:29:45Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=a9020249400f65612fc9f1c0f5cfebe50a58ff85'/>
<id>urn:sha1:a9020249400f65612fc9f1c0f5cfebe50a58ff85</id>
<content type='text'>
SROA: Avoid struct and array types early to avoid creating an overly large integer type.

Fixes PR14465.

Differential Revision: http://llvm-reviews.chandlerc.com/D148


git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@169290 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Merging r168361, r168346 and r168227 into 3.2 branch release</title>
<updated>2012-11-21T18:28:32Z</updated>
<author>
<name>Pawel Wodnicki</name>
<email>pawel@32bitmicro.com</email>
</author>
<published>2012-11-21T18:28:32Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=36915224aa459ce855d7ce56b36307d468ab44a8'/>
<id>urn:sha1:36915224aa459ce855d7ce56b36307d468ab44a8</id>
<content type='text'>
Merging r168361: 

Fix PR14132 and handle OOB loads speculated throuh PHI nodes.

The issue is that we may end up with newly OOB loads when speculating
a load into the predecessors of a PHI node, and this confuses the new
integer splitting logic in some cases, triggering an assertion failure.
In fact, the branch in question must be dead code as it loads from
a too-narrow alloca. Add code to handle this gracefully and leave the
requisite FIXMEs for both optimizing more aggressively and doing more to
aid sanitizing invalid code which triggers these patterns.


Merging r168346:
------------------------------------------------------------------------

Rework the rewriting of loads and stores for vector and integer allocas
to properly handle the combinations of these with split integer loads
and stores. This essentially replaces Evan's r168227 by refactoring the
code in a different way, and trynig to mirror that refactoring in both
the load and store sides of the rewriting.

Generally speaking there was some really problematic duplicated code
here that led to poorly founded assumptions and then subtle bugs. Now
much of the code actually flows through and follows a more consistent
style and logical path. There is still a tiny bit of duplication on the
store side of things, but it is much less bad.

This also changes the logic to never re-use a load or store instruction
as that was simply too error prone in practice.

I've added a few tests (one a reduction of the one in Evan's original
patch, which happened to be the same as the report in PR14349). I'm
going to look at adding a few more tests for things I found and fixed in
passing (such as the volatile tests in the vectorizable predicate).

This patch has survived bootstrap, and modulo one bugfix survived
Duncan's test suite, but let me know if anything else explodes.


Merging r168227:

Teach SROA rewriteVectorizedStoreInst to handle cases when the loaded value is narrower than the stored value. rdar://12713675



git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168443 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Fix PR14212: For some strange reason I treated vectors differently from</title>
<updated>2012-10-30T20:52:40Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-10-30T20:52:40Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=70dace3052984e843202ec98844a2a6636debb89'/>
<id>urn:sha1:70dace3052984e843202ec98844a2a6636debb89</id>
<content type='text'>
integers in that the code to handle split alloca-wide integer loads or
stores doesn't come first. It should, for the same reasons as with
integers, and the PR attests to that. Also had to fix a busted assert in
that this test case also covers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167051 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Teach SROA how to split whole-alloca integer loads and stores into</title>
<updated>2012-10-25T04:37:07Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-10-25T04:37:07Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=a2b88163af30f59d12ae0172565f3406bdbf6c45'/>
<id>urn:sha1:a2b88163af30f59d12ae0172565f3406bdbf6c45</id>
<content type='text'>
smaller integer loads and stores.

The high-level motivation is that the frontend sometimes generates
a single whole-alloca integer load or store during ABI lowering of
splittable allocas. We need to be able to break this apart in order to
see the underlying elements and properly promote them to SSA values. The
hope is that this fixes some performance regressions on x86-32 with the
new SROA pass.

Unfortunately, this causes quite a bit of churn in the test cases, and
bloats some IR that comes out. When we see an alloca that consists soley
of bits and bytes being extracted and re-inserted, we now do some
splitting first, before building widened integer "bucket of bits"
representations. These are always well folded by instcombine however, so
this shouldn't actually result in missed opportunities.

If this splitting of all-integer allocas does cause problems (perhaps
due to smaller SSA values going into the RA), we could potentially go to
some extreme measures to only do this integer splitting trick when there
are non-integer component accesses of an alloca, but discovering this is
quite expensive: it adds yet another complete walk of the recursive use
tree of the alloca.

Either way, I will be watching build bots and LNT bots to see what
fallout there is here. If anyone gets x86-32 numbers before &amp; after this
change, I would be very interested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166662 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>This just in, it is a *bad idea* to use 'udiv' on an offset of</title>
<updated>2012-10-17T09:23:48Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-10-17T09:23:48Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=02bf98ab38355aafbe9a763caa019bc06ad9ce3d'/>
<id>urn:sha1:02bf98ab38355aafbe9a763caa019bc06ad9ce3d</id>
<content type='text'>
a pointer. A very bad idea. Let's not do that. Fixes PR14105.

Note that this wasn't *that* glaring of an oversight. Originally, these
routines were only called on offsets within an alloca, which are
intrinsically positive. But over the evolution of the pass, they ended
up being called for arbitrary offsets, and things went downhill...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166095 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Update the memcpy rewriting to fully support widened int rewriting. This</title>
<updated>2012-10-15T10:24:43Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-10-15T10:24:43Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=d2cd73f6a5103f5de221a67410e35e6bee211fa3'/>
<id>urn:sha1:d2cd73f6a5103f5de221a67410e35e6bee211fa3</id>
<content type='text'>
includes extracting ints for copying elsewhere and inserting ints when
copying into the alloca. This should fix the CanSROA assertion coming
out of Clang's regression test suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165931 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Follow-up fix to r165928: handle memset rewriting for widened integers,</title>
<updated>2012-10-15T10:24:40Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-10-15T10:24:40Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=94fc64c42fe27aa16dd5611eb3657ff0297801c8'/>
<id>urn:sha1:94fc64c42fe27aa16dd5611eb3657ff0297801c8</id>
<content type='text'>
and generally clean up the memset handling. It had rotted a bit as the
other rewriting logic got polished more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165930 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>First major step toward addressing PR14059. This teaches SROA to handle</title>
<updated>2012-10-15T08:40:30Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-10-15T08:40:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=81ff90db4403f9b4ee3574f00ebdfba4a12177c9'/>
<id>urn:sha1:81ff90db4403f9b4ee3574f00ebdfba4a12177c9</id>
<content type='text'>
cases where we have partial integer loads and stores to an otherwise
promotable alloca to widen[1] those loads and stores to cover the entire
alloca and bitcast them into the appropriate type such that promotion
can proceed.

These partial loads and stores stem from an annoying confluence of ARM's
calling convention and ABI lowering and the FCA pre-splitting which
takes place in SROA. Clang lowers a { double, double } in-register
function argument as a [4 x i32] function argument to ensure it is
placed into integer 32-bit registers (a really unnerving implicit
contract between Clang and the ARM backend I would add). This results in
a FCA load of [4 x i32]* from the { double, double } alloca, and SROA
decomposes this into a sequence of i32 loads and stores. Inlining
proceeds, code gets folded, but at the end of the day, we still have i32
stores to the low and high halves of a double alloca. Widening these to
be i64 operations, and bitcasting them to double prior to loading or
storing allows promotion to proceed for these allocas.

I looked quite a bit changing the IR which Clang produces for this case
to be more friendly, but small changes seem unlikely to help. I think
the best representation we could use currently would be to pass 4 i32
arguments thereby avoiding any FCAs, but that would still require this
fix. It seems like it might eventually be nice to somehow encode the ABI
register selection choices outside of the parameter type system so that
the parameter can be a { double, double }, but the CC register
annotations indicate that this should be passed via 4 integer registers.

This patch does not address the second problem in PR14059, which is the
reverse: when a struct alloca is loaded as a *larger* single integer.

This patch also does not address some of the code quality issues with
the FCA-splitting. Those don't actually impede any optimizations really,
but they're on my list to clean up.

[1]: Pedantic footnote: for those concerned about memory model issues
here, this is safe. For the alloca to be promotable, it cannot escape or
have any use of its address that could allow these loads or stores to be
racing. Thus, widening is always safe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165928 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Teach SROA to cope with wrapper aggregates. These show up a lot in ABI</title>
<updated>2012-10-13T10:49:33Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-10-13T10:49:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=07525a6be6bce604f3b528c91973ac4e66742266'/>
<id>urn:sha1:07525a6be6bce604f3b528c91973ac4e66742266</id>
<content type='text'>
type coercion code, especially when targetting ARM. Things like [1
x i32] instead of i32 are very common there.

The goal of this logic is to ensure that when we are picking an alloca
type, we look through such wrapper aggregates and across any zero-length
aggregate elements to find the simplest type possible to form a type
partition.

This logic should (generally speaking) rarely fire. It only ends up
kicking in when an alloca is accessed using two different types (for
instance, i32 and float), and the underlying alloca type has wrapper
aggregates around it. I noticed a significant amount of this occurring
looking at stepanov_abstraction generated code for arm, and suspect it
happens elsewhere as well.

Note that this doesn't yet address truly heinous IR productions such as
PR14059 is concerning. Those result in mismatched *sizes* of types in
addition to mismatched access and alloca types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165870 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
</feed>
