[Attributor][FIX] Do not replace musstail calls with constant

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374498 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Johannes Doerfert
2019-10-11 01:45:32 +00:00
parent f7258ae46f
commit 589b4cb587
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -997,7 +997,7 @@ ChangeStatus AAReturnedValuesImpl::manifest(Attributor &A) {
// Callback to replace the uses of CB with the constant C.
auto ReplaceCallSiteUsersWith = [](CallBase &CB, Constant &C) {
if (CB.getNumUses() == 0)
if (CB.getNumUses() == 0 || CB.isMustTailCall())
return ChangeStatus::UNCHANGED;
CB.replaceAllUsesWith(&C);
return ChangeStatus::CHANGED;
@@ -830,6 +830,11 @@ define i32* @use_const() #0 {
; CHECK: ret i32* bitcast (i8* @G to i32*)
ret i32* %c
}
define i32* @dont_use_const() #0 {
%c = musttail call i32* @ret_const()
; CHECK: ret i32* %c
ret i32* %c
}
attributes #0 = { noinline nounwind uwtable }