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

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 4 07:56:21 PDT 2020


bjope added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:190
+  // Check that all of the replacements still exist.
+  for (auto const &I : ReplacedValues)
+    assert(IdToValueMap.count(I.second) && "remapped value missing");
----------------
Don't you need to wrap the whole for loop inside #ifndef NDEBUG. Otherwise `I` would be a def without any uses in a no-assert build.

Looking at the for loop above there is no such protection for UI (but maybe that is because UI is incremented in the loop).

I wouldn't mind if you added #ifndef NDEBUG around both loops, as they only make sense when the asserts are active.


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

https://reviews.llvm.org/D76994





More information about the llvm-commits mailing list