[PATCH] D26785: InstCombine: Fold bitcast of vector to FP scalar

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 13:27:52 PST 2016


majnemer added inline comments.


================
Comment at: lib/Analysis/ConstantFolding.cpp:91-113
-    // Now that we know that the input value is a vector of integers, just shift
-    // and insert them into our result.
-    unsigned BitShift = DL.getTypeSizeInBits(SrcEltTy);
-    APInt Result(IT->getBitWidth(), 0);
-    for (unsigned i = 0; i != NumSrcElts; ++i) {
-      Constant *Element;
-      if (DL.isLittleEndian())
----------------
Is splitting out this code into a function related to the correctness of the change? If not, I'd leave it alone.


================
Comment at: lib/Analysis/ConstantFolding.cpp:105
+  if (auto *VTy = dyn_cast<VectorType>(C->getType())) {
+    // Handle a vector->integer cast.
+    if (isa<IntegerType>(DestTy) || DestTy->isFloatingPointTy()) {
----------------
This comment doesn't seem correct now.


https://reviews.llvm.org/D26785





More information about the llvm-commits mailing list