[llvm-dev] Question about LLVM Rel10 llvm/IR/AsmWriter.cpp
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Thu Nov 12 01:28:04 PST 2020
On Wed, 11 Nov 2020 at 23:58, James Courtier-Dutton via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> What happens when CA->getNumElements() is zero ? Infinite loop????
It looks like a ConstantArray can't exist with zero elements,
ConstantArray::get produces a ConstantAggregateZero instead. Actually
parsing a .ll file seems to go for UndefValue.
> Wouldn't the following be better. i.e. safer:
> for (unsigned i = 1; i < CA->getNumElements(); i++) {
The code above has already dereferenced CA[0] so I think it's no real
improvement.
Cheers.
Tim.
More information about the llvm-dev
mailing list