[PATCH] D76994: [DAG] Fix PR45049: LegalizeTypes crash

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 09:44:26 PDT 2020


tra resigned from this revision.
tra added a comment.

Looks OK to me, but I'm not that familiar with the legalizer.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:190
+  // Check that all of the replacements still exist.
+  for (auto I = ReplacedValues.begin(), E = ReplacedValues.end(); I != E; ++I)
+    assert(IdToValueMap.count(I->second) && "remapped value missing");
----------------
Nit: `for (auto const &I: ReplacedValues)`


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h:203
+
       ValueToIdMap.erase(SDValue(Old, i));
     }
----------------
Do we need an assert at the beginning of the loop that `Old != New`? Otherwise we may be removing a valid map entry.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76994/new/

https://reviews.llvm.org/D76994





More information about the llvm-commits mailing list