[SCCP] Properly report changes when changing a pointer argument

Fixes one of the issues in PR51946.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D111277
This commit is contained in:
Arthur Eubanks 2021-10-06 14:43:59 -07:00
parent e0582e69f5
commit fbddf22ef7
2 changed files with 35 additions and 0 deletions

View File

@ -500,6 +500,7 @@ bool llvm::runIPSCCP(
CB->removeFnAttrs(AttributesToRemove);
}
}
MadeChanges |= ReplacedPointerArg;
}
SmallPtrSet<Value *, 32> InsertedValues;

View File

@ -0,0 +1,34 @@
; RUN: opt -passes='require<no-op-module>,ipsccp' -disable-output < %s 2>&1 -debug-pass-manager | FileCheck %s
; CHECK: Invalidating {{.*}} NoOpModuleAnalysis
define i16 @main() {
entry:
%call10 = call i16 @test_local_fp3(i16 undef)
ret i16 0
}
declare i16 (i16, i16)* @add_fp2()
define internal i16 (i16, i16)* ()* @add_fp3() {
entry:
ret i16 (i16, i16)* ()* @add_fp2
}
define internal i16 @test_local_fp3(i16 %tnr) {
entry:
%tnr.addr = alloca i16, align 1
%call10 = call i16 @apply_fp3_local(i16 (i16, i16)* ()* ()* @add_fp3, i16 181, i16 16384)
%0 = load i16, i16* %tnr.addr, align 1
ret i16 %0
}
define internal i16 @apply_fp3_local(i16 (i16, i16)* ()* ()* %fp, i16 %p1, i16 %p2) {
entry:
%fp.addr = alloca i16 (i16, i16)* ()* ()*, align 1
store i16 (i16, i16)* ()* ()* %fp, i16 (i16, i16)* ()* ()** %fp.addr, align 1
%0 = load i16 (i16, i16)* ()* ()*, i16 (i16, i16)* ()* ()** %fp.addr, align 1
%call = call i16 (i16, i16)* ()* %0()
%call2 = call i16 undef(i16 undef, i16 undef)
ret i16 %call2
}