[llvm] r191122 - LoopVectorizer: Only allow vectorization of intrinsics. We can't know for sure that the functions 'abs' or 'round' are the functions from libm.

Arnold Schwaighofer aschwaighofer at apple.com
Sat Sep 21 16:00:04 PDT 2013


On Sep 21, 2013, at 5:41 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> Arnold,
> 
> Thanks for looking at this quickly.
> 
> +static Intrinsic::ID checkBinaryFloatSignature(const CallInst &I,
> +                                               Intrinsic::ID ValidIntrinsicID) {
> +  if (I.getNumArgOperands() != 2 ||
> +      !I.getArgOperand(0)->getType()->isFloatingPointTy() ||
> +      !I.getArgOperand(1)->getType()->isFloatingPointTy() ||
> +      I.getType() != I.getArgOperand(0)->getType() ||
> +      !I.onlyReadsMemory())
> +    return Intrinsic::not_intrinsic;
> +
> +  return ValidIntrinsicID;
> +}
> 
> To be pedantic, we should check that the two arguments also have the same type (to prevent grabbing copysign(float, double)).

Right.

Now with

+static Intrinsic::ID checkBinaryFloatSignature(const CallInst &I,
+                                               Intrinsic::ID ValidIntrinsicID) 
+  if (I.getNumArgOperands() != 2 ||
+      !I.getArgOperand(0)->getType()->isFloatingPointTy() ||
+      !I.getArgOperand(1)->getType()->isFloatingPointTy() ||
+      I.getType() != I.getArgOperand(0)->getType() ||
+      I.getType() != I.getArgOperand(1)->getType() ||
+      !I.onlyReadsMemory())

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Revert-LoopVectorizer-Only-allow-vectorization-of-in.patch
Type: application/octet-stream
Size: 10260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130921/8169e284/attachment.obj>


More information about the llvm-commits mailing list