mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-05 13:25:42 +00:00
Assign type IDs recursively for constants
* In case a type is only referenced via e.g. bitcast -> gep we need to recurse to assign type IDs in this case.
This commit is contained in:
@@ -2513,6 +2513,7 @@ void LLVMOrderAccumulator::processGlobals(Program *prog)
|
||||
{
|
||||
assignTypeId(inst->args[a]->type);
|
||||
accumulate(cast<Metadata>(inst->args[a]));
|
||||
assignTypeId(cast<Constant>(inst->args[a]));
|
||||
}
|
||||
assignTypeId(inst->type);
|
||||
for(size_t m = 0; m < inst->getAttachedMeta().size(); m++)
|
||||
@@ -2716,6 +2717,19 @@ void LLVMOrderAccumulator::assignTypeId(const Type *t)
|
||||
types.push_back(t);
|
||||
}
|
||||
|
||||
void LLVMOrderAccumulator::assignTypeId(const Constant *c)
|
||||
{
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
assignTypeId(c->type);
|
||||
if(c->isCast())
|
||||
assignTypeId(cast<Constant>(c->getInner()));
|
||||
else if(c->isCompound())
|
||||
for(Value *v : c->getMembers())
|
||||
assignTypeId(cast<Constant>(v));
|
||||
}
|
||||
|
||||
void LLVMOrderAccumulator::accumulate(const Value *v)
|
||||
{
|
||||
Value *value = (Value *)v;
|
||||
|
||||
@@ -1172,6 +1172,7 @@ private:
|
||||
void accumulateTypePrintOrder(const Type *t);
|
||||
void accumulateTypePrintOrder(rdcarray<const Metadata *> &visited, const Metadata *m);
|
||||
void assignTypeId(const Type *t);
|
||||
void assignTypeId(const Constant *c);
|
||||
};
|
||||
|
||||
}; // namespace DXIL
|
||||
|
||||
Reference in New Issue
Block a user