[llvm] [InstCombine] Remove transformation on call instruction where return value need void to non-void conversion (PR #98536)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 01:21:30 PDT 2024
================
@@ -4071,9 +4071,7 @@ bool InstCombinerImpl::transformConstExprCastCall(CallBase &Call) {
if (Callee->isDeclaration())
return false; // Cannot transform this return value.
- if (!Caller->use_empty() &&
- // void -> non-void is handled specially
- !NewRetTy->isVoidTy())
+ if (!Caller->use_empty() || NewRetTy->isVoidTy())
----------------
nikic wrote:
```suggestion
if (!Caller->use_empty())
```
A more conservative change would be this. In that case we'd still allow changing the return type to void as long as the return value is not used. That may be more consistent with the overall handling?
https://github.com/llvm/llvm-project/pull/98536
More information about the llvm-commits
mailing list