[llvm] 635288d - [llvm-diff] Check for recursive initialiers
Bill Wendling via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 21 14:21:41 PDT 2021
Author: Bill Wendling
Date: 2021-07-21T14:21:21-07:00
New Revision: 635288d215b1147e624cf37f9c5f66ae35c15b74
URL: https://github.com/llvm/llvm-project/commit/635288d215b1147e624cf37f9c5f66ae35c15b74
DIFF: https://github.com/llvm/llvm-project/commit/635288d215b1147e624cf37f9c5f66ae35c15b74.diff
LOG: [llvm-diff] Check for recursive initialiers
We need to check for recursive initializers in the "ConstantStruct"
case.
Differential Revision: https://reviews.llvm.org/D105616
Added:
Modified:
llvm/test/tools/llvm-diff/initializers.ll
llvm/tools/llvm-diff/DifferenceEngine.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-
diff /initializers.ll b/llvm/test/tools/llvm-
diff /initializers.ll
index 93cabfba54f2..d4b0d8f8a231 100644
--- a/llvm/test/tools/llvm-
diff /initializers.ll
+++ b/llvm/test/tools/llvm-
diff /initializers.ll
@@ -36,3 +36,12 @@ define internal i32 @qux() {
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
+}
diff --git a/llvm/tools/llvm-
diff /DifferenceEngine.cpp b/llvm/tools/llvm-
diff /DifferenceEngine.cpp
index b3a6ba83c1e4..eb746cd2a865 100644
--- a/llvm/tools/llvm-
diff /DifferenceEngine.cpp
+++ b/llvm/tools/llvm-
diff /DifferenceEngine.cpp
@@ -490,6 +490,16 @@ class FunctionDifferenceEngine {
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;
}
More information about the llvm-commits
mailing list