yronglin added a comment.

Sorry for the late reply.  I tried to investigate the memory impact of creating 
these additional materializations by build the whole llvm-project and compare 
the number of `MaterializedTemporaryExpr` created during parsing.

Steps:

1. Add a public member `uint64_t NumMetarilizedTemporaryExpr = 0;` in 
`ASTContext` .
2. Increment the value of `NumMetarilizedTemporaryExpr ` in 
`Sema::CreateMaterializeTemporaryExpr`.
3. Write the `NumMetarilizedTemporaryExpr ` into a text file when `ASTContext` 
destruction, each translation unit will append a line to the file to record the 
value of `NumMetarilizedTemporaryExpr `.
4. Build the entire llvm-project separately using the compiler that creates 
addational materializations and the compiler that doesn't.
5. Sum the numbers produced by each translation unit.

The result is:

The version that create addational materializations:                 50740658
The version that does not create addational materializations:  18360888

The gap between these two numbers is very large. So I'think we can create 
additional materializations only within for-range initializers. I'm not sure if 
I can find a way to only create materializes for temporaries that need to have 
an extended lifetime, WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153701

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to