J'ai un code IR LLVM qui ressemble à ceci.Quel est le problème avec ce code IR LLVM
%8 = load i64* @tid, align 8
%arrayidx1 = getelementptr inbounds [16 x i32]* @h,
i32 0, i64 %8 ;<-- %8 works fine here
..............
%OldFuncCounter7 = load i64* getelementptr inbounds ([16 x i64]*
@EdgeProfCounters, i64 0, i64 %8) ;<-- error here, %8 not allowed
..............
Dans la ligne où arrayidx1 est attribué, tout va bien, mais pour OldFuncCounter7, le compilateur LLVM se plaint en disant « utilisation invalide du nom de la fonction locale ». C'est dû au% 8 que j'utilise. Si je le remplace par une constante, ça fonctionne bien. Donc ma question est pourquoi est ce% 8 fonctionne bien avec arrayidx1, mais pas avec OldFuncCounter7. Qu'est-ce qui se passe ici?
Le bloc de base tout où cette erreur se produit est indiquée ci-dessous
%8 = load i64* @tid, align 8
%arrayidx1 = getelementptr inbounds [16 x i32]* @h, i32 0, i64 %8
store volatile i32 3, i32* %arrayidx1, align 4
%9 = load volatile i32* getelementptr inbounds ([16 x i32]* @h, i32 0, i64 0), align 4
%call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 %9)
%10 = load i64* @tid, align 8
store volatile i64 %10, i64* %clock, align 8
%call3 = call i32 @getpid() nounwind
%call4 = call i64 @pthread_self() nounwind readnone
%11 = load volatile i64* %clock, align 8
%call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([21 x i8]* @.str1, i32 0, i32 0), i32 %call3, i64 %call4, i64 %11)
store i64 0, i64* %oi, align 8
; Error here due to %8
%OldFuncCounter7 = load i64* getelementptr inbounds ([16 x i64]* @EdgeProfCounters, i64 0, i64 %8)
;
%NewFuncCounter8 = add i64 %OldFuncCounter7, 13
store volatile i64 %NewFuncCounter8, i64* getelementptr inbounds ([16 x i64]* @EdgeProfCounters, i64 0, i64 0)
br label %for.cond6
peut vous coller un module minimal mais complet qui produit ce problème? –
Eli, maintenant j'ai ajouté tout le bloc de base. – pythonic