[PATCH] D65451: [DivRemPairs] Avoid RAUW pitfalls (PR42823)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 31 03:09:47 PDT 2019
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - should the test from https://bugs.llvm.org/show_bug.cgi?id=42823 be included with this patch even if does not fail yet without D65298 <https://reviews.llvm.org/D65298>?
================
Comment at: llvm/lib/Transforms/Scalar/DivRemPairs.cpp:210-214
// Now kill the explicit remainder. We have replaced it with:
// (sub X, (mul (div X, Y), Y)
- RemInst->replaceAllUsesWith(Sub);
- RemInst->eraseFromParent();
+ Sub->setName(RemInst->getName() + ".decomposed");
+ Instruction *OrigRemInst = RemInst;
+ RemInst = Sub;
----------------
Add to this code comment to explain why we need to preserve the Sub in RemInst?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65451/new/
https://reviews.llvm.org/D65451
More information about the llvm-commits
mailing list