[llvm-dev] About the concept of "materialization"

Pei Wang via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 28 11:08:55 PDT 2017

OK. About the error it’s a long story, so it’s probably better to pin some source code here. Below is a piece of code related to my problem, clipped from lib/Transforms/Utils/ValueMapper.cpp. I was wondering what “materialized” means here.

Value *Mapper::mapBlockAddress(const BlockAddress &BA) {
   Function *F = cast<Function>(mapValue(BA.getFunction())); 

   // F may not have materialized its initializer.  In that case, create a
   // dummy basic block for now, and replace it once we've materialized all
   // the initializers.
   BasicBlock *BB;
   if (F->empty()) {
     BB = DelayedBBs.back().TempBB.get();
   } else {
     BB = cast_or_null<BasicBlock>(mapValue(BA.getBasicBlock()));
   return getVM()[&BA] = BlockAddress::get(F, BB ? BB : BA.getBasicBlock());


On 6/28/17, 10:59 AM, "陳韋任" <chenwj.cs97g at g2.nctu.edu.tw> wrote:

    2017-06-29 1:55 GMT+08:00 Pei Wang via llvm-dev <llvm-dev at lists.llvm.org>:
    > Bruce,
    > Thanks for the explanation. But based on my inspection on the source code,
    > it seems that materialization is related to lazily reading LLVM objects
    > (Module, Function, etc.) into the memory from bitcode files, which is
    > possibly useful during LTO. I’m not sure though.
    You probably need to give us the error message you got, or the source code
    you're reading about materialization, so that we can speak of the same thing.
    Wei-Ren Chen (陳韋任)
    Homepage: https://people.cs.nctu.edu.tw/~chenwj

More information about the llvm-dev mailing list