[llvm-dev] Using ConstantDataVector instead of ConstantVector

Alex Susu via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 9 01:30:06 PST 2016


   Hello.
     I'm curious why can't I convert a Value like
       <16 x i16> <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2... i16 2>
      to ConstantVector - using llvm::dyn_cast<llvm::ConstantVector>() returns NULL.

     However, converting it with dyn_cast to ConstantDataVector fortunately works.

     Note that at http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantDataVector.html 
it is written "A vector constant whose element type is a simple 1/2/4/8-byte integer or 
float/double", etc. This is a bit misleading, since vectors of bigger sizes can be used.

   Thank you,
     Alex


More information about the llvm-dev mailing list