[PATCH] D11710: [SimplifyCFG] Ignore lifetime intrinsics when looking for empty landing pads
Björn Steinbrink via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 10 03:37:28 PDT 2015
dotdash added a comment.
In my case, the callee also contained a call to llvm.lifetime.end, so I didn't consider the removal a problem even if the callee is inlined. But of course you're right, in the general case this could preclude further optimizations.
The problem I saw with handling it as a DSE problem is that you can't handle the lifetime intrinsics for a given alloca in isolation. Given a terminating block like this:
out:
call void @llvm.lifetime.start(i64 16, i8* %a)
; Use %a
call void @llvm.lifetime.end(i64 16, i8* %a)
call void @llvm.lifetime.start(i64 16, i8* %b)
; Use %b
call void @llvm.lifetime.end(i64 16, i8* %b)
ret void
Here, the lifetime end is useful stack coloring, even though it's in a terminating block.
Thinking about it some more though, I think that we could track whether we found a lifetime start that we didn't remove yet, and until that is the case, we can strip lifetime ends without affecting stack coloring. So for the above, the lifetime end for %b would get removed, but the other lifetime intrinsics are kept. But if %b was unused, we'd also remove its lifetime start, and then go on to also remove the lifetime end for %a.
Sounds good?
http://reviews.llvm.org/D11710
More information about the llvm-commits
mailing list