Commit Graph

15 Commits

Author SHA1 Message Date
Adrian Prantl
521de91ba7 Fix the debug info generated by the LoadableByAddress transformation.
And unbreak the LLDB testsuite.

This patch fixes three problems with the original implementation:
- Use SILBuilderWithScope instead of SILBuilder to avoid holes in the
  lexical scopes.
- Use an artificial location for stores to the alloca to avoid the debugger
  stopping before the variable is initialized.
- Recognize debug_value_addr instructions referring to an alloc_stack
  instruction to avoid introducing an extra indirection in the debug info.

rdar://problem/31975108
2017-12-02 16:48:34 -08:00
Michael Gottesman
f85da6860a [sil] Delete SILInstruction::removeFromParent().
This is a very easily misused API since it allows for users to leak instructions
if they are not careful. This commit removes this API and replaces the small
number of uses of this API with higher level APIs that accomplish the same task
without using removeFromParent(). There were no API users that specifically
required removeFromParent.

An example of one way we were using removeFromParent is to move a SILInstruction
to the front of a block. That does not require exposing an API like
removeFromParent()... we can just create a higher level API like the one added
in this commit: SILInstruction::moveFront(SILBasicBlock *).

rdar://31276565
2017-06-07 16:52:10 -07:00
Joe Shajrawi
4dc0801785 IRGen Mandatory Module Pass: Pass large loadable types by address instead of by value 2017-05-01 12:04:06 -07:00
practicalswift
5e255e07d7 [gardening] Remove redundant logic 2017-04-11 23:04:55 +02:00
Andrew Trick
be1881aa1f Remove redundant Transform.getName() definitions.
At some point, pass definitions were heavily macro-ized. Pass
descriptive names were added in two places. This is not only redundant
but a source of confusion. You could waste a lot of time grepping for
the wrong string. I removed all the getName() overrides which, at
around 90 passes, was a fairly significant amount of code bloat.

Any pass that we want to be able to invoke by name from a tool
(sil-opt) or pipeline plan *should* have unique type name, enum value,
commend-line string, and name string. I removed a comment about the
various inliner passes that contradicted that.

Side note: We should be consistent with the policy that a pass is
identified by its type. We have a couple passes, LICM and CSE, which
currently violate that convention.
2017-04-09 15:20:28 -07:00
Hugh Bellamy
397f25e43b Use LLVM_ATTRIBUTE_NOINLINE instead of __attribute__((noinline)) 2017-01-14 12:46:14 +00:00
Arnold Schwaighofer
d6dd8e83bc Hack to workaround a clang lto bug
We hit an assert in AllocStackHoisting that is only triggered in a release lto
build.

Clang forwards the read of parent basic block of 'AssignedLoc' in the next
statement:

  auto *EntryBB = AssignedLoc->getFunction()->getEntryBlock(); // read AssignedLoc->ParentBB
  AssignedLoc->removeFromParent(); // writes AssignedLoc->ParentBB

To this read:

  EntryBB->push_front(AssignedLoc); // read AssignedLoc->ParentBB and assert if non-null, *should reload*

As a temporary workaround outline code to prevent the miscompile.

rdar://29982182
2017-01-13 08:42:02 -08:00
practicalswift
adc75d6806 [gardening] Add "// end anonymous namespace" where appropriate 2017-01-07 20:18:21 +01:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
9c738f6b58 Merge pull request #6438 from practicalswift/i-heard-you-like-partitions
[gardening] Fix partiion^H^H^H^H^Hitions^H^H^H^H^H^Htitions.
2016-12-22 15:18:36 +01:00
practicalswift
fe3b9968fc [gardening] Fix partiion^H^H^H^H^Hitions^H^H^H^H^H^Htitions.
By being less creative in the ways we spell "partition" :-)
2016-12-21 21:36:24 +01:00
practicalswift
f05a338e9a [gardening] Prefer (!foo) to (foo == false). Fix typo. 2016-12-21 21:25:58 +01:00
Arnold Schwaighofer
9a2582f7a4 Remove to strict assert
unreachable exits don't need an dealloc_stack and so there can be alloc_stack
instructions without a matching dealloc_stack
2016-12-20 17:02:26 -08:00
Arnold Schwaighofer
a87f34372e Rename SILFunction::entryBB to getEntryBlock 2016-12-20 07:51:55 -08:00
Arnold Schwaighofer
f1c2dcf1fa Add an alloc_stack hoisting pass.
Hoist alloc_stack instructions of 'generic' or resilient type to the entry
block. At the same time also perform a very simple stack coloring analysis.
This does not use a true liveness-analysis yet but rather employs some simple
conservative checks to see whether the live ranges of two alloc_stacks might
interfere.

AllocStackHoisting is an IRGen SIL pass. This allows for using IRGen's type
lowering information. Furthermore, hoisting and merging the alloc_stack
instructions this late does not interfere with SIL optimizations because the
resulting SIL never gets serialized.
2016-12-20 07:51:55 -08:00