Is sizeof(pointer) known in LLVM IR?

If you look at some LLVM assembly (e.g. emitted by clang -emit-llvm -S
your_program.c) you'll see "target datalayout..." at the top. The
information on the size of the pointer and its alignment are there.
AFAIK this information is present in all LLVM modules and so is
present very early on.

Take a look at [1] and pay special attention to the bit starting
"p[n]:<size>:<abi>:<pref>"

The LLVM C++ API for llvm::Module seems to have what you want [2] so I
see no reason why you could not have access to this in one of your
passes.

[1] http://llvm.org/docs/LangRef.html#data-layout
[2] http://llvm.org/docs/doxygen/html/classllvm_1_1Module.html#a3f499ddbebdc1456836d7b00a735df26

Hope that helps,

Cheers,
Dan Liew.