[PATCH] D33850: Inlining: Don't re-map simplified cloned instructions.

Kyle Butt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 12:02:25 PDT 2017


iteratee updated this revision to Diff 103437.
iteratee marked 2 inline comments as done.
Herald added a subscriber: sanjoy.

Repository:
  rL LLVM

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) ||
+                dyn_cast<Instruction>(V)->getParent() == nullptr ||
+                dyn_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.103437.patch
Type: text/x-patch
Size: 934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170621/cae30e4f/attachment.bin>


More information about the llvm-commits mailing list