[PATCH] D42541: [DeadArgumentElimination] Preserve llvm.dbg.values's first argument
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 26 13:42:27 PST 2018
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.
LGTM with outstanding changes applied.
================
Comment at: lib/IR/Metadata.cpp:342
+static DISubprogram *getLocalFunctionMetadata(Value *V) {
+ if (getLocalFunction(V))
+ return getLocalFunction(V)->getSubprogram();
----------------
mattd wrote:
> One stylistic suggestion:
> if (auto Fn = getLocalFunction(V))
> ...
getLocalFunction() is also static and not used by anyone else. I would just roll this into one function.
================
Comment at: lib/IR/Metadata.cpp:419
}
- if (getLocalFunction(From) && getLocalFunction(To) &&
- getLocalFunction(From) != getLocalFunction(To)) {
+ if (getLocalFunctionMetadata(From) && getLocalFunctionMetadata(To) &&
+ getLocalFunctionMetadata(From) != getLocalFunctionMetadata(To)) {
----------------
One of these checks is redundant. How about:
```
if (DISubprogram *FromSP = getLocalFunctionMetadata(From))
if (getLocalFunctionMetadata(To) == FromSP)
```
https://reviews.llvm.org/D42541
More information about the llvm-commits
mailing list