mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
make the asmparser reject function and type redefinitions. 'Merging' hasn't been
needed since llvm-gcc 3.4 days. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133248 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
424545e950
commit
d589099eec
@ -352,18 +352,14 @@ bool LLParser::ParseNamedType() {
|
||||
cast<DerivedType>(FI->second.first.get())->refineAbstractTypeTo(Ty);
|
||||
Ty = FI->second.first.get();
|
||||
ForwardRefTypes.erase(FI);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Inserting a name that is already defined, get the existing name.
|
||||
const Type *Existing = M->getTypeByName(Name);
|
||||
assert(Existing && "Conflict but no matching type?!");
|
||||
|
||||
// Otherwise, this is an attempt to redefine a type. That's okay if
|
||||
// the redefinition is identical to the original.
|
||||
// FIXME: REMOVE REDEFINITIONS IN LLVM 3.0
|
||||
if (Existing == Ty) return false;
|
||||
|
||||
// Any other kind of (non-equivalent) redefinition is an error.
|
||||
// Otherwise, this is an attempt to redefine a type, report the error.
|
||||
return Error(NameLoc, "redefinition of type named '" + Name + "' of type '" +
|
||||
Ty->getDescription() + "'");
|
||||
}
|
||||
@ -2761,21 +2757,9 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
|
||||
|
||||
ForwardRefVals.erase(FRVI);
|
||||
} else if ((Fn = M->getFunction(FunctionName))) {
|
||||
// If this function already exists in the symbol table, then it is
|
||||
// multiply defined. We accept a few cases for old backwards compat.
|
||||
// FIXME: Remove this stuff for LLVM 3.0.
|
||||
if (Fn->getType() != PFT || Fn->getAttributes() != PAL ||
|
||||
(!Fn->isDeclaration() && isDefine)) {
|
||||
// If the redefinition has different type or different attributes,
|
||||
// reject it. If both have bodies, reject it.
|
||||
return Error(NameLoc, "invalid redefinition of function '" +
|
||||
FunctionName + "'");
|
||||
} else if (Fn->isDeclaration()) {
|
||||
// Make sure to strip off any argument names so we can't get conflicts.
|
||||
for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
|
||||
AI != AE; ++AI)
|
||||
AI->setName("");
|
||||
}
|
||||
// Reject redefinitions.
|
||||
return Error(NameLoc, "invalid redefinition of function '" +
|
||||
FunctionName + "'");
|
||||
} else if (M->getNamedValue(FunctionName)) {
|
||||
return Error(NameLoc, "redefinition of function '@" + FunctionName + "'");
|
||||
}
|
||||
|
@ -24,8 +24,6 @@ define i32 @test0(i8* %P) {
|
||||
; CHECK: ret i32 0
|
||||
}
|
||||
|
||||
declare void @llvm.memcpy.i8(i8*, i8*, i8, i32)
|
||||
|
||||
define i8 @test1() {
|
||||
; CHECK: @test1
|
||||
%A = alloca i8
|
||||
|
@ -1,9 +0,0 @@
|
||||
; Test to make sure that the 'internal' tag is not lost!
|
||||
;
|
||||
; RUN: llvm-as < %s | llvm-dis | grep internal
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define internal void @foo() {
|
||||
ret void
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
; RUN: llvm-as %s -o /dev/null
|
||||
|
||||
declare i32 @"ArrayRef"([100 x i32] * %Array)
|
||||
|
||||
define i32 @"ArrayRef"([100 x i32] * %Array) {
|
||||
ret i32 0
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
; Test to make sure that the 'private' tag is not lost!
|
||||
;
|
||||
; RUN: llvm-as < %s | llvm-dis | grep private
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define private void @foo() {
|
||||
ret void
|
||||
}
|
@ -188,11 +188,6 @@ bb231: ; preds = %bb226
|
||||
ret void
|
||||
}
|
||||
|
||||
%struct.III_psy_xmin = type { [22 x double], [13 x [3 x double]] }
|
||||
%struct.III_scalefac_t = type { [22 x i32], [13 x [3 x i32]] }
|
||||
%struct.gr_info = type { i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32*, [4 x i32] }
|
||||
%struct.lame_global_flags = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32 }
|
||||
|
||||
define fastcc void @outer_loop2(%struct.lame_global_flags* %gfp, double* %xr, i32 %targ_bits, double* %best_noise, %struct.III_psy_xmin* %l3_xmin, i32* %l3_enc, %struct.III_scalefac_t* %scalefac, %struct.gr_info* %cod_info, i32 %ch) {
|
||||
entry:
|
||||
%cod_info.20128.1 = getelementptr %struct.gr_info* %cod_info, i32 0, i32 20, i32 1 ; <i32*> [#uses=1]
|
||||
|
@ -6,8 +6,6 @@
|
||||
; RUN: grep .Lbaz: %t
|
||||
; RUN: grep long.*\.Lbaz %t
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define private void @foo() {
|
||||
ret void
|
||||
}
|
||||
|
@ -152,7 +152,6 @@ entry:
|
||||
ret <2 x i32> %1
|
||||
}
|
||||
|
||||
declare <2 x i32> @llvm.arm.neon.vqrdmulh.v2i32(<2 x i32>, <2 x i32>) nounwind readnone
|
||||
declare <4 x i16> @llvm.arm.neon.vqrdmulh.v4i16(<4 x i16>, <4 x i16>) nounwind readnone
|
||||
declare <2 x i32> @llvm.arm.neon.vqrdmulh.v2i32(<2 x i32>, <2 x i32>) nounwind readnone
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
; RUN: grep \\\$baz: %t
|
||||
; RUN: grep ldah.*\\\$baz %t
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define private void @foo() {
|
||||
ret void
|
||||
}
|
||||
|
@ -6,9 +6,6 @@
|
||||
; RUN: grep .Lbaz: %t
|
||||
; RUN: grep ila.*\.Lbaz %t
|
||||
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define private void @foo() {
|
||||
ret void
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
; RUN: grep \\\$baz: %t
|
||||
; RUN: grep lw.*\\\$baz %t
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define private void @foo() {
|
||||
ret void
|
||||
}
|
||||
|
@ -6,8 +6,6 @@
|
||||
; RUN: grep .baz: %t
|
||||
; RUN: grep ld.*\.baz %t
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define private void @foo() {
|
||||
ret void
|
||||
}
|
||||
|
@ -87,8 +87,6 @@ for.inc: ; preds = %for.inc, %lor.end.i, %lor.rhs.i, %land.lhs.true3.i
|
||||
br label %for.inc
|
||||
}
|
||||
|
||||
declare i32 @safe()
|
||||
|
||||
define i32 @func_35(i8 signext %p_35) nounwind readonly {
|
||||
entry:
|
||||
%tobool = icmp eq i8 %p_35, 0 ; <i1> [#uses=1]
|
||||
|
@ -5,8 +5,6 @@
|
||||
; RUN: llc < %s -mtriple=x86_64-pc-linux | grep .Lbaz:
|
||||
; RUN: llc < %s -mtriple=x86_64-pc-linux | grep movl.*\.Lbaz
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define private void @foo() {
|
||||
ret void
|
||||
}
|
||||
|
@ -312,8 +312,6 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @foo()
|
||||
|
||||
; If caller / callee calling convention mismatch then check if the return
|
||||
; values are returned in the same registers.
|
||||
; rdar://7874780
|
||||
|
@ -6,8 +6,6 @@
|
||||
; RUN: grep .Lbaz: %t
|
||||
; RUN: grep ldw.*\.Lbaz %t
|
||||
|
||||
declare void @foo()
|
||||
|
||||
define private void @foo() {
|
||||
ret void
|
||||
}
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
%FunTy = type i32 (i32)
|
||||
|
||||
declare i32 @test(i32) ; Test forward declaration merging
|
||||
|
||||
define void @invoke(%FunTy* %x) {
|
||||
%foo = call i32 %x( i32 123 ) ; <i32> [#uses=0]
|
||||
%foo2 = tail call i32 %x( i32 123 ) ; <i32> [#uses=0]
|
||||
|
@ -1,18 +0,0 @@
|
||||
; RUN: llvm-as < %s | llvm-dis > %t1.ll
|
||||
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
|
||||
; RUN: diff %t1.ll %t2.ll
|
||||
|
||||
; Test forward references and redefinitions of globals
|
||||
|
||||
@A = global i32* @B ; <i32**> [#uses=0]
|
||||
@B = global i32 7 ; <i32*> [#uses=1]
|
||||
|
||||
declare void @X()
|
||||
|
||||
declare void @X()
|
||||
|
||||
define void @X() {
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @X()
|
@ -1,18 +0,0 @@
|
||||
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
|
||||
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
|
||||
; RUN: diff %t1.ll %t2.ll
|
||||
|
||||
; Test forward references and redefinitions of globals
|
||||
|
||||
@A = global i17* @B
|
||||
@B = global i17 7
|
||||
|
||||
declare void @X()
|
||||
|
||||
declare void @X()
|
||||
|
||||
define void @X() {
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @X()
|
@ -50,10 +50,6 @@ entry:
|
||||
}
|
||||
|
||||
; PR5284
|
||||
declare i64 @llvm.bswap.i64(i64)
|
||||
declare i32 @llvm.bswap.i32(i32)
|
||||
declare i16 @llvm.bswap.i16(i16)
|
||||
|
||||
define i16 @test7(i32 %A) {
|
||||
%B = tail call i32 @llvm.bswap.i32(i32 %A) nounwind
|
||||
%C = trunc i32 %B to i16
|
||||
|
@ -213,5 +213,4 @@ define i32 @cttz_simplify1(i32 %x) nounwind readnone ssp {
|
||||
; CHECK-NEXT: ret i32
|
||||
}
|
||||
|
||||
declare i32 @llvm.ctlz.i32(i32) nounwind readnone
|
||||
|
||||
|
@ -149,8 +149,6 @@ declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind
|
||||
|
||||
declare noalias i8* @malloc(i32) nounwind
|
||||
|
||||
declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly
|
||||
|
||||
define i32 @test7() {
|
||||
; CHECK: @test7
|
||||
%alloc = call noalias i8* @malloc(i32 48) nounwind
|
||||
|
@ -84,7 +84,6 @@ declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32,
|
||||
|
||||
declare void @test5a(%struct.S* byval align 16) nounwind ssp
|
||||
|
||||
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
|
||||
|
||||
; rdar://8713376 - This memcpy can't be eliminated.
|
||||
define i32 @test5(i32 %x) nounwind ssp {
|
||||
|
@ -30,5 +30,4 @@ define float @fabsf(float %f) {
|
||||
ret float %t
|
||||
}
|
||||
|
||||
declare float @fabsf(float %f)
|
||||
declare x86_fp80 @fabsl(x86_fp80 %f)
|
||||
|
Loading…
Reference in New Issue
Block a user