[PATCH] D20497: [ValueTracking, InstCombine] extend isKnownToBeAPowerOfTwo() to handle vector splat constants

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 15:39:01 PDT 2016


majnemer added inline comments.

================
Comment at: lib/Analysis/ValueTracking.cpp:1504-1508
@@ -1504,3 +1503,7 @@
+
+    if (auto *CI = dyn_cast<ConstantInt>(C))
       return CI->getValue().isPowerOf2();
-    // TODO: Handle vector constants.
+
+    if (auto *Splat = dyn_cast_or_null<ConstantInt>(C->getSplatValue()))
+      return Splat->getValue().isPowerOf2();
   }
----------------
I think you could use `m_APInt` to merge these cases together.


http://reviews.llvm.org/D20497





More information about the llvm-commits mailing list