[PATCH] [InstSimplify] Support constant folding to vector of pointers

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Mon Oct 20 11:54:11 PDT 2014


================
Comment at: lib/Analysis/ConstantFolding.cpp:59
@@ -59,1 +58,3 @@
+  if (C->isAllOnesValue() && !DestTy->isX86_MMXTy() &&
+      !DestTy->isPtrOrPtrVectorTy()) // don't get ones for ptr types!
     return Constant::getAllOnesValue(DestTy);
----------------
arsenm wrote:
> Comment should be capitalized.
> 
> 
> Why do you need this check on the isAllOnesValue() and not the isNullValue() case?
Because getNullValue knows how to handle a PointerTyID, through ConstantPointerNull. There isn't a "ConstantPointerOnes" and IMO that would also not make much sense.

http://reviews.llvm.org/D5834






More information about the llvm-commits mailing list