[PATCH] D47139: [NaryReassociate] Detect deleted instr with WeakTrackingVH
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 22 14:13:33 PDT 2018
sanjoy requested changes to this revision.
sanjoy added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/Transforms/Scalar/NaryReassociate.cpp:243
I->replaceAllUsesWith(NewI);
- // If SeenExprs constains I's WeakTrackingVH, that entry will be
- // replaced with
- // nullptr.
+ WeakTrackingVH NewIExist = NewI;
+ // If SeenExprs and NewIExist contains I's WeakTrackingVH, that entry
----------------
You probably want `WeakVH` instead of `WeakTrackingVH` here. However, did you consider lazily deleting `&*I` instead of doing them in this loop? You could keep an `std::vector` of `WeakVH`s that are pending delete and delete them after leaving this loop.
Repository:
rL LLVM
https://reviews.llvm.org/D47139
More information about the llvm-commits
mailing list