[PATCH] D35498: [LoopVectorizer] Use two step casting for float to pointer type.

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 12:26:09 PDT 2017


manojgupta added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2958
+          // pointer type.
+          const Type* SrcElemTy = cast<VectorType>(StoredVec->getType())->getElementType();
+          if (ScalarTy->isPointerTy() && SrcElemTy->isFloatingPointTy()) {
----------------
Loop vectorize crashes when trying to do the following cast :
<4 x float> <float 0xC415AF1D80000000, float 0xC415AF1D80000000, float 0xC415AF1D80000000, float 0xC415AF1D80000000> to <4 x %struct.CvNode1D* >

As a floating point type cannot be directly casted to a pointer type (even if bitwidth is same), the crash can be avoided using two  bitcasts (float->int and int-> pointer).



https://reviews.llvm.org/D35498





More information about the llvm-commits mailing list