llvm-6502/lib
Michael Gottesman 0556900b26 [objc-arc] Do not mismatch up retains inside a for loop with releases outside said for loop in the presense of differing provenance caused by escaping blocks.
This occurs due to an alloca representing a separate ownership from the
original pointer. Thus consider the following pseudo-IR:

  objc_retain(%a)
  for (...) {
    objc_retain(%a)
    %block <- %a
    F(%block)
    objc_release(%block)
  }
  objc_release(%a)

From the perspective of the optimizer, the %block is a separate
provenance from the original %a. Thus the optimizer pairs up the inner
retain for %a and the outer release from %a, resulting in segfaults.

This is fixed by noting that the signature of a mismatch of
retain/releases inside the for loop is a Use/CanRelease top down with an
None bottom up (since bottom up the Retain-CanRelease-Use-Release
sequence is completed by the inner objc_retain, but top down due to the
differing provenance from the objc_release said sequence is not
completed). In said case in CheckForCFGHazards, we now clear the state
of %a implying that no pairing will occur.

Additionally a test case is included.

rdar://12969722

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179747 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-18 05:39:45 +00:00
..
Analysis A limit of 500 was still a bit too high for some tests. 2013-04-17 20:02:32 +00:00
Archive Fix auto_ptr is deprecated warnings 2013-02-26 21:20:35 +00:00
AsmParser Rationalize the formatting of these case labels. Having two sorted 2013-04-09 19:46:46 +00:00
Bitcode Whitespace cleanup 2013-04-01 02:28:07 +00:00
CodeGen Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
DebugInfo Use StringSwitch instead of long chain of if-else. No functionality change. 2013-04-17 14:27:04 +00:00
ExecutionEngine Two small cleanups for ELF's templates. 2013-04-17 21:20:55 +00:00
IR Add an option `-enable-old-style-attr-syntax' to print out function attributes in the "old" style. 2013-04-17 23:35:59 +00:00
IRReader Measure time that IR parsing took as part of the -time-passes measurement. 2013-04-03 15:33:45 +00:00
Linker Specutively revert r178130. 2013-03-27 17:54:41 +00:00
MC Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
Object Make the host endianness check an integer constant expression. 2013-04-15 14:44:24 +00:00
Option Resort the #include lines in include/... and lib/... with the 2013-01-02 10:22:59 +00:00
Support Make the host endianness check an integer constant expression. 2013-04-15 14:44:24 +00:00
TableGen Allow TableGen DAG arguments to be just a name. 2013-03-24 19:36:51 +00:00
Target [mips] Rename function. 2013-04-18 01:00:46 +00:00
Transforms [objc-arc] Do not mismatch up retains inside a for loop with releases outside said for loop in the presense of differing provenance caused by escaping blocks. 2013-04-18 05:39:45 +00:00
CMakeLists.txt Split out the IRReader header and the utility functions it provides into 2013-03-26 02:25:37 +00:00
LLVMBuild.txt Split out the IRReader header and the utility functions it provides into 2013-03-26 02:25:37 +00:00
Makefile Split out the IRReader header and the utility functions it provides into 2013-03-26 02:25:37 +00:00