[llvm-branch-commits] [llvm-branch] r115409 - /llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp

Gabor Greif ggreif at gmail.com
Sat Oct 2 03:20:43 PDT 2010


Author: ggreif
Date: Sat Oct  2 05:20:43 2010
New Revision: 115409

URL: http://llvm.org/viewvc/llvm-project?rev=115409&view=rev
Log:
count unknown bits

Modified:
    llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp

Modified: llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=115409&r1=115408&r2=115409&view=diff
==============================================================================
--- llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp Sat Oct  2 05:20:43 2010
@@ -916,7 +916,10 @@
 APInt Mask(cast<IntegerType>(Ty2)->getMask());
 APInt KnownZero(Mask.getBitWidth(), 0), KnownOne(Mask.getBitWidth(), 0);
 ComputeMaskedBits(A, Mask, KnownZero, KnownOne);
-
+unsigned unknown = (~KnownZero).countPopulation();
+if (unknown > 2) return true;
+unknown += KnownOne.countPopulation();
+if (unknown > 2) return true;
 
         return true;
       }





More information about the llvm-branch-commits mailing list