[PATCH] D158977: [clang][dataflow] Don't associate prvalue expressions with storage locations.

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 00:19:50 PDT 2023


mboehme added a comment.

In D158977#4623402 <https://reviews.llvm.org/D158977#4623402>, @xazax.hun wrote:

> Thanks! Sometimes I am wondering whether we actually need a full map for PRValues. E.g., once we processed a `MaterializeTemporaryExpr`, we now have a location for the value, and it feels like we represent the same thing twice, once in `ExprToLoc + LocToVal` and once in `ExprToVal`. It is probably not too bad and might be extra work to clean this up.

Yes, I think it's probably not worth it. (And note that the `Expr`s in question are different: In the `ExprToVal`, we map the prvalue expression to a value, whereas in `ExprToLoc`, we map the `MaterializeTemporaryExpr` to a location.)

I'd say this is just one example of the more general case when a prvalue is consumed by some other expression. For example, when two prvalue integer operands are consumed by a `+` `BinaryOperator`, we could also say that the entries in `ExprToVal` for the operands are now superfluous and could be removed -- but we still keep them around. They might be superfluous, but there aren't typically enough of them to hurt performance (I think?). And they may be useful for debugging.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158977/new/

https://reviews.llvm.org/D158977



More information about the cfe-commits mailing list