This commit allows Dead Object Elimination (DOE) pass to eliminate
objects with no backing bag (if it has no uses).
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
for (uint32_t n = 0; n < m->entity()->object()->size(); ++n)
{
auto obj = m->entity()->object()->at(n);
- auto bag = obj->bag();
- if (coco::readers(bag).empty() && !(bag->isOutput()))
+ if (auto bag = obj->bag())
{
- res.insert(obj);
+ if (coco::readers(bag).empty() && !(bag->isOutput()))
+ {
+ res.insert(obj);
+ }
+ }
+ else
+ {
+ if (obj->uses()->size() == 0)
+ {
+ res.insert(obj);
+ }
}
}