mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	I had already factored this analysis specifically to enable doing this, but hadn't actually committed the necessary wiring to get at this from the new pass manager. This also nicely shows how the separate cache object can be directly managed by the new pass manager. This analysis didn't have any direct tests and so I've added a printer pass and a boring test case. I chose to print the i1 value which is being assumed rather than the call to llvm.assume as that seems much more useful for testing... but suggestions on an even better printing strategy welcome. My main goal was to make sure things actually work. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226868 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			23 lines
		
	
	
		
			585 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			585 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
| ; RUN: opt < %s -disable-output -passes='print<assumptions>' 2>&1 | FileCheck %s
 | |
| 
 | |
| target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
 | |
| 
 | |
| declare void @llvm.assume(i1)
 | |
| 
 | |
| define void @test1(i32 %a) {
 | |
| ; CHECK-LABEL: Cached assumptions for function: test1
 | |
| ; CHECK-NEXT: icmp ne i32 %{{.*}}, 0
 | |
| ; CHECK-NEXT: icmp slt i32 %{{.*}}, 0
 | |
| ; CHECK-NEXT: icmp sgt i32 %{{.*}}, 0
 | |
| 
 | |
| entry:
 | |
|   %cond1 = icmp ne i32 %a, 0
 | |
|   call void @llvm.assume(i1 %cond1)
 | |
|   %cond2 = icmp slt i32 %a, 0
 | |
|   call void @llvm.assume(i1 %cond2)
 | |
|   %cond3 = icmp sgt i32 %a, 0
 | |
|   call void @llvm.assume(i1 %cond3)
 | |
| 
 | |
|   ret void
 | |
| }
 |