mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
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
96 lines
4.7 KiB
LLVM
96 lines
4.7 KiB
LLVM
; RUN: opt < %s -basicaa -bb-vectorize -disable-output
|
|
; This is a bugpoint-reduced test case. It did not always assert, but does reproduce the bug
|
|
; and running under valgrind (or some similar tool) will catch the error.
|
|
|
|
target datalayout = "e-p:64:64:64-S128-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:128:128-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
|
target triple = "x86_64-apple-darwin12.2.0"
|
|
|
|
%0 = type { [10 x { float, float }], [10 x { float, float }], [10 x { float, float }], [10 x { float, float }], [10 x { float, float }] }
|
|
%1 = type { [10 x [8 x i8]] }
|
|
%2 = type { i64, i64 }
|
|
%3 = type { [10 x i64], i64, i64, i64, i64, i64 }
|
|
%4 = type { i64, i64, i64, i64, i64, i64 }
|
|
%5 = type { [10 x i64] }
|
|
%6 = type { [10 x float], [10 x float], [10 x float], [10 x float] }
|
|
%struct.__st_parameter_dt.1.3.5.7 = type { %struct.__st_parameter_common.0.2.4.6, i64, i64*, i64*, i8*, i8*, i32, i32, i8*, i8*, i32, i32, i8*, [256 x i8], i32*, i64, i8*, i32, i32, i8*, i8*, i32, i32, i8*, i8*, i32, i32, i8*, i8*, i32, [4 x i8] }
|
|
%struct.__st_parameter_common.0.2.4.6 = type { i32, i32, i8*, i32, i32, i8*, i32* }
|
|
|
|
@cctenso_ = external unnamed_addr global %0, align 32
|
|
@ctenso_ = external unnamed_addr global %1, align 32
|
|
@i_dim_ = external unnamed_addr global %2, align 16
|
|
@itenso1_ = external unnamed_addr global %3, align 32
|
|
@itenso2_ = external unnamed_addr global %4, align 32
|
|
@ltenso_ = external unnamed_addr global %5, align 32
|
|
@rtenso_ = external unnamed_addr global %6, align 32
|
|
@.cst = external unnamed_addr constant [8 x i8], align 8
|
|
@.cst1 = external unnamed_addr constant [3 x i8], align 8
|
|
@.cst2 = external unnamed_addr constant [29 x i8], align 8
|
|
@.cst3 = external unnamed_addr constant [32 x i8], align 64
|
|
|
|
define void @cart_to_dc2y_(double* noalias nocapture %xx, double* noalias nocapture %yy, double* noalias nocapture %zz, [5 x { double, double }]* noalias nocapture %c2ten) nounwind uwtable {
|
|
entry:
|
|
%0 = fmul double undef, undef
|
|
%1 = fmul double undef, undef
|
|
%2 = fadd double undef, undef
|
|
%3 = fmul double undef, 0x3FE8B8B76E3E9919
|
|
%4 = fsub double %0, %1
|
|
%5 = fsub double -0.000000e+00, undef
|
|
%6 = fmul double undef, undef
|
|
%7 = fmul double %4, %6
|
|
%8 = fmul double undef, 2.000000e+00
|
|
%9 = fmul double %8, undef
|
|
%10 = fmul double undef, %9
|
|
%11 = fmul double %10, undef
|
|
%12 = fsub double undef, %7
|
|
%13 = fmul double %3, %12
|
|
%14 = fmul double %3, undef
|
|
%15 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 0, i32 0
|
|
store double %13, double* %15, align 8
|
|
%16 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 0, i32 1
|
|
%17 = fmul double undef, %8
|
|
%18 = fmul double %17, undef
|
|
%19 = fmul double undef, %18
|
|
%20 = fadd double undef, undef
|
|
%21 = fmul double %3, %19
|
|
%22 = fsub double -0.000000e+00, %21
|
|
%23 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 1, i32 0
|
|
store double %22, double* %23, align 8
|
|
%24 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 1, i32 1
|
|
%25 = fmul double undef, 0x3FE42F601A8C6794
|
|
%26 = fmul double undef, 2.000000e+00
|
|
%27 = fsub double %26, %0
|
|
%28 = fmul double %6, undef
|
|
%29 = fsub double undef, %28
|
|
%30 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 2, i32 0
|
|
store double undef, double* %30, align 8
|
|
%31 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 2, i32 1
|
|
%32 = fmul double undef, %17
|
|
%33 = fmul double undef, %17
|
|
%34 = fmul double undef, %32
|
|
%35 = fmul double undef, %33
|
|
%36 = fsub double undef, %35
|
|
%37 = fmul double %3, %34
|
|
%38 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 3, i32 0
|
|
store double %37, double* %38, align 8
|
|
%39 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 3, i32 1
|
|
%40 = fmul double undef, %8
|
|
%41 = fmul double undef, %40
|
|
%42 = fmul double undef, %41
|
|
%43 = fsub double undef, %42
|
|
%44 = fmul double %3, %43
|
|
%45 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 4, i32 0
|
|
store double %13, double* %45, align 8
|
|
%46 = getelementptr inbounds [5 x { double, double }], [5 x { double, double }]* %c2ten, i64 0, i64 4, i32 1
|
|
%47 = fsub double -0.000000e+00, %14
|
|
store double %47, double* %16, align 8
|
|
store double undef, double* %24, align 8
|
|
store double -0.000000e+00, double* %31, align 8
|
|
store double undef, double* %39, align 8
|
|
store double undef, double* %46, align 8
|
|
ret void
|
|
}
|
|
|
|
attributes #0 = { nounwind uwtable }
|
|
attributes #1 = { nounwind readnone }
|
|
attributes #2 = { nounwind }
|