1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[llvm-diff] Check for recursive initialiers

We need to check for recursive initializers in the "ConstantStruct"
case.

Differential Revision: https://reviews.llvm.org/D105616
This commit is contained in:
Bill Wendling 2021-07-08 02:08:45 -07:00
parent f01cf44407
commit fd6bc0cc95
2 changed files with 19 additions and 0 deletions

View File

@ -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.
@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
}

View File

@ -490,6 +490,16 @@ public:
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;
}