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

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 17:08:43 PDT 2017


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

I wrote this, but also have no memory of the intent. I'm pretty sure I was worried about something that could not in fact happen. I'm happy moving to an assert to check that in fact it does not happen. =]

LGTM with the suggestion from Easwaran and myself applied (and without the unrelated change).



================
Comment at: lib/Transforms/Utils/CloneFunction.cpp:313
               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((dyn_cast<Instruction>(V) == nullptr ||
+                dyn_cast<Instruction>(V)->getParent() == nullptr ||
----------------
Just use isa<...> here...


Repository:
  rL LLVM

https://reviews.llvm.org/D33850





More information about the llvm-commits mailing list