llvm-6502/test
Tim Northover d113448c1d Refactor isInTailCallPosition handling
This change came about primarily because of two issues in the existing code.
Niether of:

define i64 @test1(i64 %val) {
  %in = trunc i64 %val to i32
  tail call i32 @ret32(i32 returned %in)
  ret i64 %val
}

define i64 @test2(i64 %val) {
  tail call i32 @ret32(i32 returned undef)
  ret i32 42
}

should be tail calls, and the function sameNoopInput is responsible. The main
problem is that it is completely symmetric in the "tail call" and "ret" value,
but in reality different things are allowed on each side.

For these cases:
1. Any truncation should lead to a larger value being generated by "tail call"
   than needed by "ret".
2. Undef should only be allowed as a source for ret, not as a result of the
   call.

Along the way I noticed that a mismatch between what this function treats as a
valid truncation and what the backends see can lead to invalid calls as well
(see x86-32 test case).

This patch refactors the code so that instead of being based primarily on
values which it recurses into when necessary, it starts by inspecting the type
and considers each fundamental slot that the backend will see in turn. For
example, given a pathological function that returned {{}, {{}, i32, {}}, i32}
we would consider each "real" i32 in turn, and ask if it passes through
unchanged. This is much closer to what the backend sees as a result of
ComputeValueVTs.

Aside from the bug fixes, this eliminates the recursion that's going on and, I
believe, makes the bulk of the code significantly easier to understand. The
trade-off is the nasty iterators needed to find the real types inside a
returned value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187787 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-06 09:12:35 +00:00
..
Analysis FileCheckize some of the testcases. 2013-08-05 23:43:18 +00:00
Assembler Debug Info: enable verifier for testing cases. 2013-07-29 20:18:19 +00:00
Bindings/Ocaml
Bitcode
BugPoint Remove "lto_on_osx" xfails, now that -rdynamic works on Darwin. 2013-08-04 23:55:24 +00:00
CodeGen Refactor isInTailCallPosition handling 2013-08-06 09:12:35 +00:00
DebugInfo Bugfix for making the DWARF debug strings and labels to code emitted as secrel32 instead of long opcodes (only for coff). This makes them debuggable with GDB (with fix for 64bits msvc) 2013-08-02 16:14:15 +00:00
ExecutionEngine LLVM Interpreter: This patch implements vector support for cast operations (zext, sext, uitofp, sitofp, trunc, fpext, fptosi, fptrunc, bitcast) and shift operations (shl, ashr, lshr) for integer and floating point data types. 2013-08-05 12:17:06 +00:00
Feature Remove "lto_on_osx" xfails, now that -rdynamic works on Darwin. 2013-08-04 23:55:24 +00:00
FileCheck Fix handling of CHECK-DAG combined with CHECK-NOT 2013-08-02 11:32:50 +00:00
Instrumentation Debug Info: update testing cases to pass verifier. 2013-07-29 18:12:58 +00:00
Integer
JitListener Debug Info: update testing cases to pass verifier. 2013-07-29 18:12:58 +00:00
Linker
MC [SystemZ] Add definitions for BRCT and BRCTG 2013-08-05 11:07:38 +00:00
Object Add support for the 's' operation to llvm-ar. 2013-07-29 12:40:31 +00:00
Other
TableGen
tools
Transforms Factor FlattenCFG out from SimplifyCFG 2013-08-06 02:43:45 +00:00
Unit
Verifier Reject bitcasts between address spaces with different sizes 2013-07-31 17:49:08 +00:00
YAMLParser
CMakeLists.txt
lit.cfg Remove "lto_on_osx" xfails, now that -rdynamic works on Darwin. 2013-08-04 23:55:24 +00:00
lit.site.cfg.in
Makefile
Makefile.tests
TestRunner.sh