llvm-6502/test
Gerolf Hoflehner 049a087d3f Suppress inlining when the block address is taken
Inlining functions with block addresses can cause many problem and requires a
rich infrastructure to support including escape analysis.  At this point the
safest approach to address these problems is by blocking inlining from
happening.

Background:
There have been reports on Ruby segmentation faults triggered by inlining
functions with block addresses like

//Ruby code snippet
vm_exec_core() {
    finish_insn_seq_0 = &&INSN_LABEL_finish;
    INSN_LABEL_finish:
      ;
}

This kind of scenario can also happen when LLVM picks a subset of blocks for
inlining, which is the case with the actual code in the Ruby environment.

LLVM suppresses inlining for such functions when there is an indirect branch.
The attached patch does so even when there is no indirect branch.  Note that
user code like above would not make much sense: using the global for jumping
across function boundaries would be illegal.

Why was there a segfault:

In the snipped above the block with the label is recognized as dead So it is
eliminated. Instead of a block address the cloner stores a constant (sic!) into
the global resulting in the segfault (when the global is used in a goto).

Why had it worked in the past then:

By luck. In older versions vm_exec_core was also inlined but the label address
used was the block label address in vm_exec_core.  So the global jump ended up
in the original function rather than in the caller which accidentally happened
to work.

Test case ./tools/clang/test/CodeGen/indirect-goto.c will fail as a result
of this commit.

rdar://17245966



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212077 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-01 00:19:34 +00:00
..
Analysis
Assembler IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
Bindings
Bitcode Add some test files for r211710. 2014-06-25 15:41:39 +00:00
BugPoint
CodeGen AArch64: Actually do address type promotion 2014-06-30 23:42:14 +00:00
DebugInfo Debug info: split out complex DIVariable address expressions into a 2014-06-30 17:17:35 +00:00
ExecutionEngine Fix this test to not write to the source tree, and instead to write to 2014-06-28 05:18:49 +00:00
Feature IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
FileCheck
Instrumentation msan: Stop stripping the 'tail' modifier off of calls 2014-06-30 20:12:27 +00:00
Integer
JitListener
Linker IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
LTO
MC ARM: take care not to set the ThumbFunc bit on TLS data symbols 2014-06-30 09:37:24 +00:00
Object objdump: Add test for ELF file with no section table 2014-06-30 20:03:02 +00:00
Other
TableGen
tools llvm-cov: Support specifying multiple source files 2014-06-27 20:41:25 +00:00
Transforms Suppress inlining when the block address is taken 2014-07-01 00:19:34 +00:00
Unit
Verifier IR: Add COMDATs to the IR 2014-06-27 18:19:56 +00:00
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg
lit.site.cfg.in
Makefile
Makefile.tests
TestRunner.sh