문제

모든 기본 블록을 최소 수의 지침으로 나누고 있습니다 (보통 3-5).

llvm::SplitBlock(BasicBlock, &*BasicBlockiter, Pass);

그리고 IR에서 객체 파일을 얻으려고합니다

llc -filetype=obj 2.ll

다음 오류가 발생했습니다.

Instruction does not dominate all uses!
  %1 = alloca i32
  %mul = load i32* %1
Instruction does not dominate all uses!
  %1 = alloca i32
  %99 = load i32* %1

그리고

While deleting: i32 %
Use still stuck around after Def is destroyed:  %var = alloca i32
Assertion failed: use_empty() && "Uses remain when a value is destroyed!"

그리고

error: expected instruction opcode
invoke.cont2:                                     ; preds = %main_block, %invoke
.cont

ir :

  invoke.cont2:                                     ; preds = %main_block, %invoke.cont
  %call4 = invoke i32 @_ZStorSt13_Ios_OpenmodeS_(i32 8, i32 16)
          to label %invoke.cont3 unwind label %lpad1
  store i32 %call4, i32* %var4

분할 후 지침은 다른 기본 블록에 있다고 생각합니다. 블록을 10-15 지침으로 나누면 모두 괜찮습니다. 이 오류를 어떻게 예측/점검하고 피할 수 있습니까?

도움이 되었습니까?

해결책

첫 번째 버전에서는 터미네이터 명령 후 지침이 있었는데,이 명령어가 실행되지 않았기 때문에 잘못되었습니다.

두 번째 버전에서 (여기서 언급되지 않음, 개인 이메일 대신 stackoverFlow를 사용하십시오 ...)는 정의하기 전에 ( %call = ...)를 정의하기 전에 %호출을 사용합니다. 사용 ...하지만 내가 말했듯이, 상점은 호출 후에는 안된다.

솔루션은 매장을 다음 기본 블록에 두는 것입니다 (새 블록을 만들 수 있음).

%invoke.cont
  %call = invoke i8* @_ZNKSs5c_strEv(%"class.std::basic_string"* @loadedFile)
          to label %invoke.cont2_before unwind label %lpad1

invoke.cont2_before:                                     ; preds = %invoke.cont
  store i8* %call, i8** %reduced_var
  br label %invoke.cont2

invoke.cont2:                                     ; preds = %main_block, %invoke.cont2_before
  %call4 = invoke i32 @_ZStorSt13_Ios_OpenmodeS_(i32 8, i32 16)
          to label %invoke.cont3_before unwind label %lpad1

등...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top