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

Jonathan Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 4 09:32:35 PDT 2020


jroelofs marked 2 inline comments as done.
jroelofs 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");
----------------
bjope wrote:
> 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.
Good catch!


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