[PATCH] D13076: [InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic call (PR24886)

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 22:03:30 PDT 2015

sanjoy added inline comments.

Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1471
@@ -1470,2 +1470,3 @@
   // fold (and (cast A), (cast B)) -> (cast (and A, B))
+  if (CastInst *Op0C = dyn_cast<CastInst>(Op0)) {
I think this comment should now be sunk to the inner if.

Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1507
@@ +1506,3 @@
+    // The backend should know how to optimize fabs().
+    // TODO: This transform should also apply to vectors.
+    ConstantInt *CI;
Is this optimization valid if the cast is actually an `fptosi` or `fptoui`?  They're also `CastInst`s.


More information about the llvm-commits mailing list