[PATCH] D54447: [WebAssembly] Fix broken assumption that all bitcasts are to functions types

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 13 11:09:35 PST 2018


dschuff accepted this revision.
dschuff added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Target/WebAssembly/WebAssemblyAddMissingPrototypes.cpp:129
+          Inst->replaceAllUsesWith(NewCast);
+          Inst->eraseFromParent();
+        } else if (ConstantExpr *Const = dyn_cast<ConstantExpr>(U)) {
----------------
sbc100 wrote:
> dschuff wrote:
> > isn't this modifying F.uses while iterating over it?
> I'm not sure.   Is the `eraseFromParent` call that makes you think that?  Any idea how would I validate that?    
Yes, `Inst` is a user of F, and I'm pretty sure `eraseFromParent` removes the instruction from the BB list and also drops its use references.
edit: yes, it's the `operator delete` of `User` that does that. 


Repository:
  rL LLVM

https://reviews.llvm.org/D54447





More information about the llvm-commits mailing list