[llvm-branch-commits] [clang] [llvm] [GVN] Simple GVN-based hoisring of scalars (PR #210337)

Alexis Engelke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 17 06:59:35 PDT 2026


================
@@ -322,6 +322,24 @@ class GVNPass : public OptionalPassInfoMixin<GVNPass> {
   // List of critical edges to be split between iterations.
   SmallVector<std::pair<Instruction *, unsigned>, 4> ToSplit;
 
+  // A pair of instructions with the same value number to be hoisted and merged,
+  // together with their respective hoist barriers. A pair of insructions can be
+  // hoisted iff both their barriers (if not null) are hoisted as well. The
+  // `WeakVH` is used to track when the barrier instruction itself is hoisted.
+  struct HoistPair {
+    Instruction *ThenI = nullptr;
+    Instruction *ThenB = nullptr;
+    Instruction *ElseI = nullptr;
+    WeakVH ElseB = nullptr;
----------------
aengelke wrote:

Is it possible to avoid value handles?

https://github.com/llvm/llvm-project/pull/210337


More information about the llvm-branch-commits mailing list