[llvm] [LiveRange] Verify Other LiveRange in Join API (PR #66809)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 13:04:29 PDT 2023


https://github.com/annamthomas created https://github.com/llvm/llvm-project/pull/66809

The LiveRange::join API takes in two live ranges. We should verify the
LiveRange argument passed in as well.


>From cc774250abc9c7c1ad4aac262eabe8a2bd8a0caf Mon Sep 17 00:00:00 2001
From: Anna Thomas <anna at azul.com>
Date: Tue, 19 Sep 2023 15:48:33 -0400
Subject: [PATCH] [LiveRange] Verify Other LiveRange in Join API

The LiveRange::join API takes in two live ranges. We should verify the
LiveRange argument passed in as well.
---
 llvm/lib/CodeGen/LiveInterval.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index 1cf354349c5610c..a8e45d46c07cee6 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/lib/CodeGen/LiveInterval.cpp
@@ -629,6 +629,7 @@ void LiveRange::join(LiveRange &Other,
                      const int *RHSValNoAssignments,
                      SmallVectorImpl<VNInfo *> &NewVNInfo) {
   verify();
+  Other.verify();
 
   // Determine if any of our values are mapped.  This is uncommon, so we want
   // to avoid the range scan if not.



More information about the llvm-commits mailing list