I found 2 APIs in llvm::ConstantInt
document:
static ConstantInt *ConstantInt::getTrue (LLVMContext &Context)
: https://llvm.org/doxygen/classllvm_1_1ConstantInt.html#a82dbbd8e3688b0bc1eedb338864d0d0c
static Constant *ConstantInt::getTrue (Type *Ty)
: https://llvm.org/doxygen/classllvm_1_1ConstantInt.html#a1d728e83e9e0fa85b0b58b33ec9c3197
But I don't know what's the difference between these 2 APIs ?
The former constructs a ConstantInt
which has i1
type, while the latter allows you to specify the type yourself. This type, however, can only be either a scalar i1
or a vector of i1
s.