Commit Graph

25 Commits

Author SHA1 Message Date
Sebastian Pop
83ba06afa8 Clear unknown mem ops when merging stack slots (pr14090)
When merging stack slots, if StackColoring::remapInstructions gets a
value back from GetUnderlyingObject that it does not know about or is
not itself a stack slot, clear the memory operand in case it aliases
the merged slot. This prevents the introduction of incorrect aliasing
information.

Author:    Matthew Curtis <mcurtis@codeaurora.org>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166216 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 19:53:48 +00:00
Sebastian Pop
bf0683f0f7 Change MachineFrameInfo::StackObject::Alloca from Value* to AllocaInst*
This more accurately reflects what is actually being stored in the
field.

No functionality change intended.

Author:    Matthew Curtis <mcurtis@codeaurora.org>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166215 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-18 19:53:45 +00:00
Nadav Rotem
a26cadc58d Disable the protection from escaped allocas in an attempt to find violating passes. This may break the buildbots. I plan to revert it in a few hours.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164024 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-17 10:21:55 +00:00
Nadav Rotem
18e2c29094 Rename the flag which protects from escaped allocas, which may come from bugs in user code or in the compiler. Also, dont assert if the protection is not enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163807 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 15:46:30 +00:00
Nadav Rotem
faf31d01db Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163801 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 14:51:00 +00:00
Nadav Rotem
0cd19b9301 Stack Coloring: We have code that checks that all of the uses of allocas
are within the lifetime zone. Sometime legitimate usages of allocas are
hoisted outside of the lifetime zone. For example, GEPS may calculate the
address of a member of an allocated struct. This commit makes sure that
we only check (abort regions or assert) for instructions that read and write
memory using stack frames directly. Notice that by allowing legitimate
usages outside the lifetime zone we also stop checking for instructions
which use derivatives of allocas. We will catch less bugs in user code
and in the compiler itself.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163791 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 12:38:37 +00:00
Nadav Rotem
d76f6eadc8 Add a flag to disable the code that looks for allocas which escaped the lifetime regions. This is useful for debugging. No testcase because without this check we fail on assertions when finding escaped allocas.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163702 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 11:06:26 +00:00
Nadav Rotem
dba5de5246 Enable stack-coloring, in hope that the recent fixes will enable correct dragonegg self-hosting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163687 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 07:58:35 +00:00
Nadav Rotem
0a16da4457 Stack coloring: remove lifetime intervals which contain escaped allocas.
The input program may contain intructions which are not inside lifetime
markers. This can happen due to a bug in the compiler or due to a bug in
user code (for example, returning a reference to a local variable).
This commit adds checks that all of the instructions in the function and
invalidates lifetime ranges which do not contain all of the instructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163678 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-12 04:57:37 +00:00
Nadav Rotem
1eba4a7a28 Dragonegg selfhost exposed additional cases where alloca usage moved outside of lifetime markers. Disabling the pass for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163623 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 15:40:27 +00:00
Nadav Rotem
50bdea299c Enable stack coloring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163617 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 13:48:35 +00:00
Nadav Rotem
8754bbbe67 Stack Coloring: Dont crash on dbg values which use stack frames.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163616 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 12:34:27 +00:00
Dmitri Gribenko
2de0572cae Remove redundant semicolons which are null statements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163547 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 21:26:47 +00:00
Nadav Rotem
8631a90f46 Disable stack coloring because it makes dragonegg fail bootstrapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163545 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 21:17:58 +00:00
Nadav Rotem
b6d52a5b4a Enable stack coloring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163539 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 20:15:49 +00:00
Nadav Rotem
6165dba25f Stack Coloring: Handle the case where END markers come before BEGIN markers properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163530 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 18:51:09 +00:00
Nadav Rotem
ff1b63172d Minor cleanup. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163510 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 13:20:00 +00:00
Nadav Rotem
9438d1e351 Stack Coloring: Debug prints to print the slot number and not the array index.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163509 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 13:17:58 +00:00
Nadav Rotem
a7de8a61df Stack Coloring: When searching for disjoint regions, do not compare intervals twice or to theirself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163508 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 12:47:38 +00:00
Nadav Rotem
e47feeb823 Stack Coloring: Add support for multiple regions of the same slot, within a single basic block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163507 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 12:39:35 +00:00
Nadav Rotem
8cc1494905 Fix a typo in the comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163496 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 08:51:46 +00:00
Nadav Rotem
0aa52ee04e Add an assertion that the frame index is indeed inside the declared lifetime region.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163495 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 08:44:15 +00:00
Roman Divacky
5177b3a8c4 Dont cast away const needlessly. Found by gcc48 -Wcast-qual.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163324 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 15:42:13 +00:00
Nadav Rotem
79cb162e5d Disable stack coloring by default in order to resolve the i386 failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163316 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 14:27:06 +00:00
Nadav Rotem
c05d30601c Add a new optimization pass: Stack Coloring, that merges disjoint static allocations (allocas). Allocas are known to be
disjoint if they are marked by disjoint lifetime markers (@llvm.lifetime.XXX intrinsics).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163299 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 09:17:37 +00:00