mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Teach lint how to look through simple store+load pairs and other
effective no-op constructs, to make it more effective on unoptimized IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104950 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -104,3 +104,24 @@ define i8* @return_local(i32 %n, i32 %m) {
|
||||
%s = getelementptr i8* %t, i32 %m
|
||||
ret i8* %s
|
||||
}
|
||||
|
||||
; CHECK: Unusual: Returning alloca or va_arg value
|
||||
define i32* @return_obscured_local() {
|
||||
entry:
|
||||
%retval = alloca i32*
|
||||
%x = alloca i32
|
||||
store i32* %x, i32** %retval
|
||||
br label %next
|
||||
next:
|
||||
%t0 = load i32** %retval
|
||||
%t1 = insertvalue { i32, i32, i32* } zeroinitializer, i32* %t0, 2
|
||||
%t2 = extractvalue { i32, i32, i32* } %t1, 2
|
||||
br label %exit
|
||||
exit:
|
||||
%t3 = phi i32* [ %t2, %next ]
|
||||
%t4 = bitcast i32* %t3 to i32*
|
||||
%t5 = ptrtoint i32* %t4 to i64
|
||||
%t6 = add i64 %t5, 0
|
||||
%t7 = inttoptr i64 %t6 to i32*
|
||||
ret i32* %t7
|
||||
}
|
||||
|
Reference in New Issue
Block a user