Rudderham, Stuart
2012-Nov-14 22:39 UTC
[LLVMdev] CodeExtractor doesn't work with debugging metadata
Hi,
I've been experimenting with the CodeExtractor class and have been running
into a problem where the verifier pass fails with the error "function-local
metadata used in wrong function" when I compile with debugging symbols
enabled (-g flag). The issue seems to be that after extraction we have metadata
that references variables that aren't allocated in the extracted function.
Example IR is below. Is this intentional or a bug?
Original IR
define i32 @Fn() nounwind {
%a = alloca i32, align 4
...
call void @llvm.dbg.declare(metadata !{i32* %a}, metadata !15), !dbg
!14
%call = call i32 @Foo(), !dbg !14
store i32 %call, i32* %a, align 4, !dbg !14
After Extraction
define i32 @Fn() nounwind {
entry:
%a = alloca i32, align 4
...
call void @extractedFn(i32* %a)
define internal void @extractedFn(i32* %a) noinline {
newFuncRoot:
call void @llvm.dbg.declare(metadata !{i32* %a}, metadata !19), !dbg
!14 ;; metadata now references variable not allocated in this function
%call = call i32 @Foo(), !dbg !14
store i32 %call, i32* %a, align 4, !dbg !14
Thanks,
Stuart Rudderham
Reasonably Related Threads
- CodeExtractor buggy?
- [LLVMdev] Question about ExtractLoop
- [LLVMdev] [PATCH] Fix nondeterministic behaviour in the CodeExtractor
- [LLVMdev] [PATCH] Fix nondeterministic behaviour in the CodeExtractor
- [LLVMdev] [PATCH] Fix nondeterministic behaviour in the CodeExtractor
