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

Kyle Butt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 18:41:39 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL306495: Inlining: Don't re-map simplified cloned instructions. (authored by iteratee).

Changed prior to commit:
  https://reviews.llvm.org/D33850?vs=104074&id=104336#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33850

Files:
  llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp


Index: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
+++ llvm/trunk/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.104336.patch
Type: text/x-patch
Size: 959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170628/8e328b82/attachment.bin>


More information about the llvm-commits mailing list