[LLVMdev] llvm cse optimization

xiaoyong liu xiaoyongliu at outlook.com
Fri Apr 11 10:13:53 PDT 2014


I'm working on the across the subprogram call optimization, and let's say the following llvm IR,
 
 @ng0 = internal global [2 x i32] [i32 2, i32 0], align 4
 
  %t7 = alloca [16 x i8], align 16
  %add.ptr = getelementptr inbounds i8* %t1, i64 40
  %call = call i8* @handle_value(i8* %add.ptr, i32 3) #3
  %arraydecay = getelementptr inbounds [8 x i8]* %t3, i64 0, i64 0
  %arraydecay1 = getelementptr inbounds [16 x i8]* %t4, i64 0, i64 0
 call void @select_value(i8* %arraydecay, i32 1, i32 1, i8* %call, i8* %arraydecay1, i8* null, i32 1, i32 2, i32 1, i8* bitcast ([2 x i32]* @ng0 to i8*), i32 32, i32 1) #3
  %call3 = call i8* @handle_value(i8* %add.ptr, i32 3) #3
 
; Function Attrs: nounwind readonly
declare i8* @handle_value(i8* nocapture, i32) #1
; Function Attrs: nounwind
declare void @select_value(i8*, i32, i32, i8* nocapture readonly, i8* nocapture readonly, i8*, i32, i32, i32, i8*, i32, i32) #2 //select value will only write to the first parameter, other parameter is readonly
 
For the above case, the second handle_value function call should be replaced with %call with cse or gvn optimization.
 
Is anything I can do to optimize this case?
 
thanks

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140411/3e2ceac3/attachment.html>


More information about the llvm-dev mailing list