1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[Attributor][FIX] Do not RAUW void values

This caused an error when passes iterated over cached assumptions in the
tracker and assumed them to be `null` or an instruction. I failed to
create a test case so far.
This commit is contained in:
Johannes Doerfert 2020-02-13 20:10:59 -06:00
parent 52e7c94059
commit e6077023d4

View File

@ -7527,7 +7527,8 @@ ChangeStatus Attributor::run() {
for (auto &V : ToBeDeletedInsts) {
if (Instruction *I = dyn_cast_or_null<Instruction>(V)) {
CGModifiedFunctions.insert(I->getFunction());
I->replaceAllUsesWith(UndefValue::get(I->getType()));
if (!I->getType()->isVoidTy())
I->replaceAllUsesWith(UndefValue::get(I->getType()));
if (!isa<PHINode>(I) && isInstructionTriviallyDead(I))
DeadInsts.push_back(I);
else
@ -8251,9 +8252,9 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
A.identifyDefaultAbstractAttributes(*F);
}
Module &M = *Functions.front()->getParent();
ChangeStatus Changed = A.run();
assert(!verifyModule(*Functions.front()->getParent(), &errs()) &&
"Module verification failed!");
assert(!verifyModule(M, &errs()) && "Module verification failed!");
LLVM_DEBUG(dbgs() << "[Attributor] Done with " << Functions.size()
<< " functions, result: " << Changed << ".\n");
return Changed == ChangeStatus::CHANGED;