[PATCH] D54478: [InstCombine] fold funnel shift amount based on demanded bits

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 13 10:22:24 PST 2018


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:1998
+    unsigned BitWidth = II->getType()->getScalarSizeInBits();
+    APInt Op2Demanded = APInt::getLowBitsSet(BitWidth, Log2_32_Ceil(BitWidth));
+    KnownBits Op2Known(BitWidth);
----------------
fabiang wrote:
> Need to check whether BitWidth is a power of 2 here, this is incorrect for non-pow2. Take the BitWidth=33 case in the tests below.
> 
> A mod-33 funnel shift by say 65 should shift by 65-33=32 not 65 % 64 = 1.
Oops, yes. Will fix here and the test comments.


https://reviews.llvm.org/D54478





More information about the llvm-commits mailing list