안녕하세요. 최근에 llvm 4.0으로 업그레이드되었습니다. 이제는 가장 양심적 인 코드 인 것처럼 보이는 가장 이상한 오류가 나타납니다. 나는 나에게 아래의 오류를 줄 것으로 보이는 코드를 확인했다. 그리고 llvm이 <badref>
에 속하는 나를 제공한다는 단언을 인쇄했지만 어떤 코드에 대해서도 <badref>
이 보이지 않는다. 이것은 내가 컴파일러 오류 또는 생성 된 코드가 잘못 될 수 있다고 생각합니다. 상기 (2)의 기능을 나타내는llvm ir optimization "Def가 파괴 된 후에도 계속 사용하십시오."오류 기능 삭제
; ModuleID = '__form__module.$static.196'
source_filename = "__form__module.$static.196"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
%struct.clousure_type = type { void()*, %struct.closure_vtable*, i8* }
%struct.closure_vtable = type { %struct.type_info*, void (i8*, i8*)*, void (i8*)*, i8 (i8*, i8*)*, i64 (i8*, i8*)* }
%struct.type_info = type { i8*, i8*, i64, i8, i8, i8, i8, %struct.type_info**, %struct.member_info* }
%struct.member_info = type { i8, %struct.type_info* }
@"$static.159$stub_ptr" = external hidden externally_initialized global void (%struct.clousure_type*, %struct.clousure_type*)*
define hidden void @"$static.196"(%struct.clousure_type*, %struct.clousure_type*, %struct.clousure_type*, i8) {
entry:
%4 = icmp eq i8 %3, 0
br i1 %4, label %bb2, label %bb4
bb2: ; preds = %entry
%5 = icmp eq %struct.clousure_type* %0, %2
br i1 %5, label %bb3, label %bb6
bb3: ; preds = %bb4, %bb2
ret void
bb4: ; preds = %entry
%6 = icmp eq %struct.clousure_type* %1, %2
br i1 %6, label %bb3, label %bb6
bb6: ; preds = %bb4, %bb2
tail call void @"$static.159"(%struct.clousure_type* %0, %struct.clousure_type* %1)
ret void
}
; Function Attrs: alwaysinline
define available_externally hidden void @"$static.159"(%struct.clousure_type*, %struct.clousure_type*) #0 {
entry:
%2 = load void (%struct.clousure_type*, %struct.clousure_type*)*, void (%struct.clousure_type*, %struct.clousure_type*)** @"$static.159$stub_ptr", align 8
tail call void %2(%struct.clousure_type* %0, %struct.clousure_type* %1)
ret void
}
attributes #0 = { alwaysinline }
While deleting: void (%struct.clousure_type*, %struct.clousure_type*)* %$static.159
Use still stuck around after Def is destroyed: call void @"$static.159"(%struct.clousure_type* <badref>, %struct.clousure_type* %0)
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Assertion failed!
Program: C:\Users\RICH\workspace\formvm\Debug\formvm.exe
File: C:\llvm-4.0.0.src\lib\IR\Value.cpp, Line 85
Expression: use_empty() && "Uses remain when a value is destroyed!"
최적화 기울이고 LLVM 적외선 코드 (C++에서 생성) 다음 2 개 함수이다.
define private void @gen__fun__return_copy85(%struct.clousure_type*, %struct.clousure_type*, %struct.clousure_type*, i8) {
entry:
%4 = alloca %struct.clousure_type*, align 8
store %struct.clousure_type* %0, %struct.clousure_type** %4, align 8
%5 = load %struct.clousure_type*, %struct.clousure_type** %4, align 8
%6 = alloca %struct.clousure_type*, align 8
store %struct.clousure_type* %1, %struct.clousure_type** %6, align 8
%7 = load %struct.clousure_type*, %struct.clousure_type** %6, align 8
%8 = alloca %struct.clousure_type*, align 8
store %struct.clousure_type* %2, %struct.clousure_type** %8, align 8
%9 = load %struct.clousure_type*, %struct.clousure_type** %8, align 8
%10 = alloca i8, align 8
store i8 %3, i8* %10, align 8
%11 = load i8, i8* %10, align 8
%12 = icmp eq i8 %11, 0
br i1 %12, label %bb2, label %bb4
bb2: ; preds = %entry
%13 = icmp eq %struct.clousure_type* %5, %9
br i1 %13, label %bb3, label %bb6
bb3: ; preds = %bb2
ret void
bb4: ; preds = %entry
%14 = icmp eq %struct.clousure_type* %7, %9
br i1 %14, label %bb5, label %bb6
bb5: ; preds = %bb4
ret void
bb6: ; preds = %bb4, %bb2
call void @_ZN13clousure_typeC2ERKS_(%struct.clousure_type* %5, %struct.clousure_type* %7)
ret void
}
define private void @_ZN13clousure_typeC2ERKS_(%struct.clousure_type* %this, %struct.clousure_type* %rhs) {
%1 = alloca %struct.clousure_type*, align 8
%2 = alloca %struct.clousure_type*, align 8
store %struct.clousure_type* %this, %struct.clousure_type** %1, align 8
store %struct.clousure_type* %rhs, %struct.clousure_type** %2, align 8
%3 = load %struct.clousure_type*, %struct.clousure_type** %1, align 8
%4 = getelementptr %struct.clousure_type, %struct.clousure_type* %3, i32 0, i32 0
store void()* null, void()** %4, align 8
%5 = getelementptr %struct.clousure_type, %struct.clousure_type* %3, i32 0, i32 1
store %struct.closure_vtable* null, %struct.closure_vtable** %5, align 8
%6 = getelementptr %struct.clousure_type, %struct.clousure_type* %3, i32 0, i32 2
store i8* null, i8** %6, align 8
%7 = load %struct.clousure_type*, %struct.clousure_type** %2, align 8
call void @_ZN13clousure_type4copyERKS_(%struct.clousure_type* %3, %struct.clousure_type* %7)
ret void
}
다음 패스가 추가되었으므로 추가 기능을 변경해야합니까?이 중 어떤 것이 문제의 원인 일 수 있습니까?
내가 패스를 모두 제거하더라도 편집은 계속됩니다!
현재 문제는 다음 기능에서 유래 한 것으로 보입니다. @"$static.159"
기능이 load @"$static.159$stub_ptr"
이 아니란 것으로 간주됩니다. 이론 자체가로드하려고하는 것처럼 제거 할 수 없다는 이론입니까?
; Function Attrs: alwaysinline
define available_externally hidden void @"$static.159"(%struct.clousure_type*, %struct.clousure_type*) #0 {
entry:
%2 = load void (%struct.clousure_type*, %struct.clousure_type*)*, void (%struct.clousure_type*, %struct.clousure_type*)** @"$static.159$stub_ptr"
tail call void %2(%struct.clousure_type* %0, %struct.clousure_type* %1)
ret void
}