[PATCH] D33850: Inlining: Don't re-map simplified cloned instructions.
Kyle Butt via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 18:58:05 PDT 2017
iteratee updated this revision to Diff 104074.
iteratee added a comment.
Use cast instead of dyn_cast
https://reviews.llvm.org/D33850
Files:
lib/Transforms/Utils/CloneFunction.cpp
Index: lib/Transforms/Utils/CloneFunction.cpp
===================================================================
--- lib/Transforms/Utils/CloneFunction.cpp
+++ lib/Transforms/Utils/CloneFunction.cpp
@@ -325,10 +325,11 @@
// the basic block.
if (Value *V =
SimplifyInstruction(NewInst, BB->getModule()->getDataLayout())) {
- // On the off-chance that this simplifies to an instruction in the old
- // function, map it back into the new function.
- if (Value *MappedV = VMap.lookup(V))
- V = MappedV;
+ assert((!isa<Instruction>(V) ||
+ cast<Instruction>(V)->getParent() == nullptr ||
+ cast<Instruction>(V)->getFunction() != OldFunc ||
+ OldFunc == NewFunc) &&
+ "Simplified Instruction should not be in the old function.");
if (!NewInst->mayHaveSideEffects()) {
VMap[&*II] = V;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33850.104074.patch
Type: text/x-patch
Size: 926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170627/ec05f5c7/attachment.bin>
More information about the llvm-commits
mailing list