mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Fix (and test) function-local metadata that occurs before the instruction that it refers to; fix is to not enumerate operands of function-local metadata until after all instructions have been enumerated
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95269 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -408,21 +408,25 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
|
|||||||
|
|
||||||
FirstInstID = Values.size();
|
FirstInstID = Values.size();
|
||||||
|
|
||||||
|
SmallVector<MDNode *, 8> FunctionLocalMDs;
|
||||||
// Add all of the instructions.
|
// Add all of the instructions.
|
||||||
for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
|
for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
|
||||||
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; ++I) {
|
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; ++I) {
|
||||||
for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
|
for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
|
||||||
OI != E; ++OI) {
|
OI != E; ++OI) {
|
||||||
if (MDNode *MD = dyn_cast<MDNode>(*OI))
|
if (MDNode *MD = dyn_cast<MDNode>(*OI))
|
||||||
if (!MD->isFunctionLocal())
|
if (MD->isFunctionLocal())
|
||||||
// These were already enumerated during ValueEnumerator creation.
|
// Enumerate metadata after the instructions they might refer to.
|
||||||
continue;
|
FunctionLocalMDs.push_back(MD);
|
||||||
EnumerateOperandType(*OI);
|
|
||||||
}
|
}
|
||||||
if (!I->getType()->isVoidTy())
|
if (!I->getType()->isVoidTy())
|
||||||
EnumerateValue(I);
|
EnumerateValue(I);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add all of the function-local metadata.
|
||||||
|
for (unsigned i = 0, e = FunctionLocalMDs.size(); i != e; ++i)
|
||||||
|
EnumerateOperandType(FunctionLocalMDs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValueEnumerator::purgeFunction() {
|
void ValueEnumerator::purgeFunction() {
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
define void @Foo(i32 %a, i32 %b) {
|
define void @Foo(i32 %a, i32 %b) {
|
||||||
entry:
|
entry:
|
||||||
|
call void @llvm.dbg.value(metadata !{ i32* %1 }, i64 16, metadata !"bar")
|
||||||
|
; CHECK: call void @llvm.dbg.value(metadata !{i32* %1}, i64 16, metadata !"bar")
|
||||||
%0 = add i32 %a, 1 ; <i32> [#uses=1]
|
%0 = add i32 %a, 1 ; <i32> [#uses=1]
|
||||||
%two = add i32 %b, %0 ; <i32> [#uses=0]
|
%two = add i32 %b, %0 ; <i32> [#uses=0]
|
||||||
%1 = alloca i32 ; <i32*> [#uses=1]
|
%1 = alloca i32 ; <i32*> [#uses=1]
|
||||||
|
Reference in New Issue
Block a user