llvm-mirror/test/Other
David Blaikie dfadb4e9ee [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.

Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.

When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.

This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.

This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).

No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.

This leaves /only/ the varargs case where the explicit type is required.

Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.

About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.

import fileinput
import sys
import re

pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")

def conv(match, line):
  if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
    return line
  return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]

for line in sys.stdin:
  sys.stdout.write(conv(re.search(pat, line), line))

llvm-svn: 235145
2015-04-16 23:24:18 +00:00
..
Inputs If we see UTF-8 BOM sequence at the beginning of a response file, we shall 2015-01-24 04:23:08 +00:00
X86 Reduce verbiage of lit.local.cfg files 2014-06-09 22:42:55 +00:00
2002-01-31-CallGraph.ll
2002-02-24-InlineBrokePHINodes.ll
2002-03-11-ConstPropCrash.ll
2003-02-19-LoopInfoNestingBug.ll Convert all tests using TCL-style quoting to use shell-style quoting. 2012-07-02 12:47:22 +00:00
2004-08-16-PackedConstantInlineStore.ll
2004-08-16-PackedGlobalConstant.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
2004-08-16-PackedSelect.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
2004-08-16-PackedSimple.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
2004-08-20-PackedControlFlow.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
2006-02-05-PassManager.ll
2007-04-24-eliminate-mostly-empty-blocks.ll
2007-06-05-PassID.ll
2007-06-28-PassManager.ll
2007-09-10-PassManager.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
2008-02-14-PassManager.ll
2008-06-04-FieldSizeInPacked.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
2008-10-06-RemoveDeadPass.ll
2008-10-15-MissingSpace.ll Using "not grep" is brittle as the test passes if llvm-as fails. 2012-11-21 14:17:23 +00:00
2009-03-31-CallGraph.ll Don't promote asynch EH invokes of nounwind functions to calls 2015-02-11 01:23:16 +00:00
2009-06-05-no-implicit-float.ll
2009-09-14-function-elements.ll
2010-05-06-Printer.ll
attribute-comment.ll Update to remove the no-frame-pointer-elim-non-leaf flag if it was set to 'false'. 2013-08-22 21:28:54 +00:00
bcanalyzer-block-info.txt Teach llvm-bcanalyzer to use one stream's BLOCKINFO to read another stream. 2014-08-30 17:07:55 +00:00
can-execute.txt Suppress llvm/test/Other/can-execute.txt on msys bash. 2013-06-26 10:56:44 +00:00
close-stderr.ll llvm/test/Other/close-stderr.ll: Remove "XFAIL:win32". It reverts r173509. 2013-10-26 02:50:14 +00:00
constant-fold-gep-address-spaces.ll [opaque pointer type] Add textual IR support for explicit type parameter to gep operator 2015-03-13 18:20:45 +00:00
constant-fold-gep.ll [opaque pointer type] Add textual IR support for explicit type parameter to gep operator 2015-03-13 18:20:45 +00:00
extract-alias.ll Fix most of PR10367. 2014-05-16 19:35:39 +00:00
extract-linkonce.ll Add a fixed version of r195470 back. 2013-11-22 17:58:12 +00:00
extract-weak-odr.ll llvm-extract changes linkages so that functions on both sides of the 2012-10-29 01:59:03 +00:00
extract.ll llvm-extract changes linkages so that functions on both sides of the 2012-10-29 01:59:03 +00:00
FileCheck-space.txt FileCheck: Fix off-by-one bug that made CHECK-NOT: ignore the next character after the colon. 2012-09-18 20:51:39 +00:00
invalid-commandline-option.ll Convert the uses of '|&' to use '2>&1 |' instead, which works on old 2012-07-02 18:37:59 +00:00
lint.ll [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
lit-unicode.txt [lit] Parse all strings as UTF-8 rather than ASCII. 2014-09-12 16:46:05 +00:00
llvm-nm-without-aliases.ll Change the default input for llvm-nm to be a.out instead of standard input 2014-06-23 20:27:53 +00:00
new-pass-manager.ll [PM] Teach the module-to-function adaptor to not run function passes 2015-02-01 10:47:25 +00:00
optimization-remarks-inline.ll [opaque pointer type] Add textual IR support for explicit type parameter to load instruction 2015-02-27 21:17:42 +00:00
optimize-options.ll Provide a test input for opt 2013-11-05 13:57:34 +00:00
pass-pipeline-parsing.ll [PM] Remove the defunt CGSCC-specific debug flag. 2015-01-13 22:45:13 +00:00
pipefail.txt Use pipefail when available. 2013-07-26 22:32:58 +00:00
ResponseFile.ll If we see UTF-8 BOM sequence at the beginning of a response file, we shall 2015-01-24 04:23:08 +00:00
spir_cc.ll Forgot the SPIR test case. 2012-10-01 17:07:51 +00:00
umask.ll XFAIL this test on mingw. 2013-07-16 19:20:29 +00:00