[PATCH] D103051: [IR] Allow Value::replaceUsesWithIf() to process constants

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 10:30:30 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/IR/Value.cpp:543
+    Use &U = *UI;
+    ++UI;
+    if (!ShouldReplace(U))
----------------
I'm suspicious of the way you're iterating over the use list here; incrementing early isn't enough to avoid a use-after-free, I think.  The incremented `UI` might refer to the same constant.

`doRAUW` repeatedly accesses `*use_begin()` to avoid issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103051



More information about the llvm-commits mailing list