[PATCH] D105616: [llvm-diff] Check for recursive initializers

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 14:21:46 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG635288d215b1: [llvm-diff] Check for recursive initialiers (authored by void).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105616

Files:
  llvm/test/tools/llvm-diff/initializers.ll
  llvm/tools/llvm-diff/DifferenceEngine.cpp


Index: llvm/tools/llvm-diff/DifferenceEngine.cpp
===================================================================
--- llvm/tools/llvm-diff/DifferenceEngine.cpp
+++ llvm/tools/llvm-diff/DifferenceEngine.cpp
@@ -490,6 +490,16 @@
         const Value *LAgg = CSL->getAggregateElement(I);
         const Value *RAgg = CSR->getAggregateElement(I);
 
+        if (LAgg == SavedLHS || RAgg == SavedRHS) {
+          if (LAgg != SavedLHS || RAgg != SavedRHS)
+            // If the left and right operands aren't both re-analyzing the
+            // variable, then the initialiers don't match, so report "false".
+            // Otherwise, we skip these operands..
+            return false;
+
+          continue;
+        }
+
         if (!equivalentAsOperands(LAgg, RAgg)) {
           return false;
         }
Index: llvm/test/tools/llvm-diff/initializers.ll
===================================================================
--- llvm/test/tools/llvm-diff/initializers.ll
+++ llvm/test/tools/llvm-diff/initializers.ll
@@ -36,3 +36,12 @@
   call void undef(%struct.mutex* @vmx_l1d_flush_mutex)
   ret i32 undef
 }
+
+; An initializer could use itself as part of the initialization.
+
+ at kvm_debugfs_entries = internal global %struct.list_head { %struct.list_head* @kvm_debugfs_entries, %struct.list_head* @kvm_debugfs_entries }, align 8
+
+define i64 @mux() {
+  %1 = load i8*, i8** bitcast (%struct.list_head* @kvm_debugfs_entries to i8**), align 8
+  ret i64 undef
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105616.360598.patch
Type: text/x-patch
Size: 1469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210721/abec684c/attachment.bin>


More information about the llvm-commits mailing list