OSDN Git Service

[ValueTracking] Use a function_ref to avoid multiple instantiations
authorDavid Majnemer <david.majnemer@gmail.com>
Tue, 23 Aug 2016 20:52:00 +0000 (20:52 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Tue, 23 Aug 2016 20:52:00 +0000 (20:52 +0000)
No functional change intended, this should just be a code size
improvement.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279563 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ValueTracking.cpp

index c9fc4d4..7f62a26 100644 (file)
@@ -782,11 +782,11 @@ static void computeKnownBitsFromAssume(const Value *V, APInt &KnownZero,
 // shift amount, compute the implied known-zero or known-one bits of the shift
 // operator's result respectively for that shift amount. The results from calling
 // KZF and KOF are conservatively combined for all permitted shift amounts.
-template <typename KZFunctor, typename KOFunctor>
-static void computeKnownBitsFromShiftOperator(const Operator *I,
-              APInt &KnownZero, APInt &KnownOne,
-              APInt &KnownZero2, APInt &KnownOne2,
-              unsigned Depth, const Query &Q, KZFunctor KZF, KOFunctor KOF) {
+static void computeKnownBitsFromShiftOperator(
+    const Operator *I, APInt &KnownZero, APInt &KnownOne, APInt &KnownZero2,
+    APInt &KnownOne2, unsigned Depth, const Query &Q,
+    function_ref<APInt(const APInt &, unsigned)> KZF,
+    function_ref<APInt(const APInt &, unsigned)> KOF) {
   unsigned BitWidth = KnownZero.getBitWidth();
 
   if (auto *SA = dyn_cast<ConstantInt>(I->getOperand(1))) {