llvm-6502/test/Linker/Inputs
David Blaikie 198d8baafb [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.

This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.

* This doesn't modify gep operators, only instructions (operators will be
  handled separately)

* Textual IR changes only. Bitcode (including upgrade) and changing the
  in-memory representation will be in separate changes.

* geps of vectors are transformed as:
    getelementptr <4 x float*> %x, ...
  ->getelementptr float, <4 x float*> %x, ...
  Then, once the opaque pointer type is introduced, this will ultimately look
  like:
    getelementptr float, <4 x ptr> %x
  with the unambiguous interpretation that it is a vector of pointers to float.

* address spaces remain on the pointer, not the type:
    getelementptr float addrspace(1)* %x
  ->getelementptr float, float addrspace(1)* %x
  Then, eventually:
    getelementptr float, ptr addrspace(1) %x

Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.

update.py:
import fileinput
import sys
import re

ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile(       r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")

def conv(match, line):
  if not match:
    return line
  line = match.groups()[0]
  if len(match.groups()[5]) == 0:
    line += match.groups()[2]
  line += match.groups()[3]
  line += ", "
  line += match.groups()[1]
  line += "\n"
  return line

for line in sys.stdin:
  if line.find("getelementptr ") == line.find("getelementptr inbounds"):
    if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
      line = conv(re.match(ibrep, line), line)
  elif line.find("getelementptr ") != line.find("getelementptr ("):
    line = conv(re.match(normrep, line), line)
  sys.stdout.write(line)

apply.sh:
for name in "$@"
do
  python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
  rm -f "$name.tmp"
done

The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh

After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).

The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7636

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 19:29:02 +00:00
..
apple-version [LinkModules] Change the way ModuleLinker merges triples. 2015-02-13 00:40:41 +00:00
2003-01-30-LinkerRename.ll Make this test a bit stricter. 2014-10-23 18:44:07 +00:00
2003-05-31-LinkerRename.ll Make this test a bit stricter. 2014-10-23 18:52:46 +00:00
alias.ll Allow alias to point to an arbitrary ConstantExpr. 2014-06-03 02:41:57 +00:00
alignment.ll Add a few extra cases to the test. NFC. 2014-12-05 00:02:42 +00:00
basiclink.a.ll
basiclink.b.ll
comdat.ll Change the .ll syntax for comdats and add a syntactic sugar. 2015-01-06 22:55:16 +00:00
comdat2.ll Change the .ll syntax for comdats and add a syntactic sugar. 2015-01-06 22:55:16 +00:00
comdat3.ll Change the .ll syntax for comdats and add a syntactic sugar. 2015-01-06 22:55:16 +00:00
comdat4.ll Change the .ll syntax for comdats and add a syntactic sugar. 2015-01-06 22:55:16 +00:00
comdat5.ll Change the .ll syntax for comdats and add a syntactic sugar. 2015-01-06 22:55:16 +00:00
comdat8.ll Change the .ll syntax for comdats and add a syntactic sugar. 2015-01-06 22:55:16 +00:00
ConstantGlobals.ll merge tests for constant linking. 2014-10-31 05:04:16 +00:00
constructor-comdat.ll Fix use of uninitialized variable. 2014-08-11 17:07:34 +00:00
ctors.ll Fix pr20078. 2014-09-05 21:27:52 +00:00
datalayout-a.ll Compare DataLayout by Value, not by pointer. 2014-02-26 17:02:08 +00:00
datalayout-b.ll Fix DataLayout::operator==(). 2014-04-22 17:47:03 +00:00
distinct.ll Utils: Keep distinct MDNodes distinct in MapMetadata() 2015-01-08 22:42:30 +00:00
ident.a.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
ident.b.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
linkage.a.ll
linkage.b.ll
linkage2.ll Merge alignment of common GlobalValue. 2014-09-09 17:48:18 +00:00
mdlocation.ll Utils: Handle remapping distinct MDLocations 2015-01-14 01:29:32 +00:00
module-flags-dont-change-others.ll Linker: Don't use MDNode::replaceOperandWith() 2015-01-07 21:32:27 +00:00
module-flags-pic-1-b.ll Add Position-independent Code model Module API. 2014-11-07 04:46:10 +00:00
module-flags-pic-2-b.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
old_global_ctors.3.4.bc Add comdat key field to llvm.global_ctors and llvm.global_dtors 2014-05-16 20:39:27 +00:00
opaque.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
PR8300.a.ll
PR8300.b.ll Allow alias to point to an arbitrary ConstantExpr. 2014-06-03 02:41:57 +00:00
PR11464.a.ll
PR11464.b.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
pr21374.ll Ask the module for its the identified types. 2014-12-03 07:18:23 +00:00
redefinition.ll Unify and update link-messages.ll and redefinition.ll. NFC. 2014-10-31 16:52:30 +00:00
replaced-function-matches-first-subprogram.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
targettriple-a.ll [LinkModules] Change the way ModuleLinker merges triples. 2015-02-13 00:40:41 +00:00
targettriple-b.ll [LinkModules] Change the way ModuleLinker merges triples. 2015-02-13 00:40:41 +00:00
targettriple-c.ll [LinkModules] Change the way ModuleLinker merges triples. 2015-02-13 00:40:41 +00:00
testlink.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
type-unique-alias.ll Link the type of aliases. 2014-11-25 04:43:59 +00:00
type-unique-dst-types2.ll Add a test showing what the linker IdentifiedStructTypes is for. 2014-12-01 03:20:57 +00:00
type-unique-dst-types3.ll Add a test showing what the linker IdentifiedStructTypes is for. 2014-12-01 03:20:57 +00:00
type-unique-inheritance-a.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
type-unique-inheritance-b.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
type-unique-name.ll Set the body of a new struct as soon as it is created. 2014-11-25 15:33:40 +00:00
type-unique-opaque.ll Add back r222727 with a fix. 2014-11-28 16:41:24 +00:00
type-unique-simple2-a.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
type-unique-simple2-b.ll IR: Move MDLocation into place 2015-01-14 22:27:36 +00:00
type-unique-unrelated2.ll Add an interesting test that we already get right. NFC. 2014-11-25 03:47:57 +00:00
type-unique-unrelated3.ll Add an interesting test that we already get right. NFC. 2014-11-25 03:47:57 +00:00
unique-fwd-decl-b.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
unique-fwd-decl-order.ll IR: Make metadata typeless in assembly 2014-12-15 19:07:53 +00:00
visibility.ll Change the .ll syntax for comdats and add a syntactic sugar. 2015-01-06 22:55:16 +00:00