[IR] Delete llvm::Constants using the correct type.

In most cases, this doesn't have much impact: the destructors just call
the base class destructor anyway.  A few subclasses of ConstantExpr
actually store non-trivial data, though. Make sure we clean up
appropriately.

This is sort of ugly, but I don't see a good alternative given the
constraints.

Issue found by asan buildbots running the testcase for D80330.

Differential Revision: https://reviews.llvm.org/D82509
This commit is contained in:
Eli Friedman
2020-06-24 15:54:21 -07:00
parent ef10a35a6b
commit 7b42c225db
6 changed files with 97 additions and 13 deletions
+1 -1
View File
@@ -220,6 +220,6 @@ void BitcodeReaderValueList::resolveConstantForwardRefs() {
// Update all ValueHandles, they should be the only users at this point.
Placeholder->replaceAllUsesWith(RealVal);
Placeholder->deleteValue();
delete cast<ConstantPlaceHolder>(Placeholder);
}
}