mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-04 05:17:07 +00:00 
			
		
		
		
	The non-opaque part can be structurally uniqued. To keep this to just a hash lookup, we don't try to unique cyclic types. Also change the type mapping algorithm to be optimistic about a type not being recursive and only create a new type when proven to be wrong. This is not as strong as trying to speculate that we can keep the source type, but is simpler (no speculation to revert) and more powerfull than what we had before (we don't copy non-recursive types at least). I initially wrote this to try to replace the name based type merging. It is not strong enough to replace it, but is is a useful addition. With this patch the number of named struct types is a clang lto bootstrap goes from 49674 to 15986. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223278 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			25 lines
		
	
	
		
			687 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			687 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
; RUN: llvm-as %s -o %t.bc
 | 
						|
; RUN: llvm-link -S %t.bc -o - | FileCheck %s
 | 
						|
; RUN: llvm-link -S %s -o - | FileCheck %s
 | 
						|
 | 
						|
; Test that we don't try to map %C.0 and C and then try to map %C to a new type.
 | 
						|
; This used to happen when lazy loading since we wouldn't then identify %C
 | 
						|
; as a destination type until it was too late.
 | 
						|
 | 
						|
; CHECK: %C.0 = type { %B }
 | 
						|
; CHECK-NEXT: %B = type { %A }
 | 
						|
; CHECK-NEXT: %A = type { i8 }
 | 
						|
 | 
						|
; CHECK: @g1 = external global %C.0
 | 
						|
; CHECK:  getelementptr %C.0* null, i64 0, i32 0, i32 0
 | 
						|
 | 
						|
%A   = type { i8 }
 | 
						|
%B   = type { %A }
 | 
						|
%C   = type { %B }
 | 
						|
%C.0 = type { %B }
 | 
						|
define void @f1() {
 | 
						|
  getelementptr %C* null, i64 0, i32 0, i32 0
 | 
						|
  ret void
 | 
						|
}
 | 
						|
@g1 = external global %C.0
 |