================
@@ -1016,11 +1017,18 @@ struct DSEState {
// Treat byval, inalloca or dead on return arguments the same as Allocas,
// stores to them are dead at the end of the function.
- for (Argument &AI : F.args())
+ for (Argument &AI : F.args()) {
if (AI.hasPassPointeeByValueCopyAttr() ||
(AI.getType()->isPointerTy() &&
AI.getDeadOnReturnInfo().coversAllReachableMemory()))
InvisibleToCallerAfterRet.insert({&AI, true});
+ if (AI.getType()->isPointerTy() &&
+ !AI.getDeadOnReturnInfo().coversAllReachableMemory()) {
+ if (uint64_t DeadOnReturnBytes =
+ AI.getDeadOnReturnInfo().getNumberOfDeadBytes())
+ InvisibleToCallerAfterRetBounded.insert({&AI, DeadOnReturnBytes});
+ }
+ }
----------------
antoniofrighetto wrote:
Perhaps the code could be reordered a bit here, I'd favour readability:
```cpp
for (Argument &AI : F.args()) {
if (AI.hasPassPointeeByValueCopyAttr()) {
InvisibleToCallerAfterRet.insert({&AI, true});
continue;
}
if (!AI.getType()->isPointerTy())
continue;
const auto &Info = AI.getDeadOnReturnInfo();
if (Info.coversAllReachableMemory())
InvisibleToCallerAfterRet.insert({&AI, true});
else if (uint64_t DeadBytes = Info.getNumberOfDeadBytes())
InvisibleToCallerAfterRetBounded.insert({&AI, DeadBytes});
}
```
https://github.com/llvm/llvm-project/pull/173694
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits