[llvm] [Inline][Cloning] Drop incompatible attributes from `NewFunc` before `instSimplify` (PR #90489)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 29 18:16:54 PDT 2024
================
@@ -700,6 +697,16 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc,
}
}
+ // Drop all incompatible return attributes that cannot be applied to NewFunc
+ // during cloning, so as to allow instruction simplification later to reason
+ // on the old state of the function. The original attributes are restored
+ // before returning.
+ AttributeMask IncompatibleAttrs =
+ AttributeFuncs::typeIncompatible(OldFunc->getReturnType());
+ AttrBuilder RetAttrs(NewFunc->getContext(),
+ NewFunc->getAttributes().getRetAttrs());
+ NewFunc->removeRetAttrs(IncompatibleAttrs);
----------------
nikic wrote:
Maybe move this directly before the code doing the actual simplification?
https://github.com/llvm/llvm-project/pull/90489
More information about the llvm-commits
mailing list