[PATCH] D50848: [ConstantFolding] add simplifications for funnel shift intrinsics

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 16 15:27:02 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/Analysis/ConstantFolding.cpp:2096
+    const APInt &BitWidth = APInt(C0->getBitWidth(), C0->getBitWidth());
+    const APInt &ShAmt = C2->getValue().urem(BitWidth);
+    bool IsRight = IntrinsicID == Intrinsic::fshr;
----------------
Can we use APInt::urem(uint64_t) version here since bitwidth is guaranteed 32-bits? Then your ShAmt would be unsigned. Then LshrAmt and ShlAmt can be unsigned. And we get rid of a lot of temporary APInts which could save heap allocations if bit width is more than 64.


https://reviews.llvm.org/D50848





More information about the llvm-commits mailing list