[llvm] r343268 - [ScalarizeMaskedMemIntrin] Remove some temporary variables that are only used by a single if condition.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 14:28:41 PDT 2018


Author: ctopper
Date: Thu Sep 27 14:28:41 2018
New Revision: 343268

URL: http://llvm.org/viewvc/llvm-project?rev=343268&view=rev
Log:
[ScalarizeMaskedMemIntrin] Remove some temporary variables that are only used by a single if condition.

Modified:
    llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp

Modified: llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp?rev=343268&r1=343267&r2=343268&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp (original)
+++ llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp Thu Sep 27 14:28:41 2018
@@ -131,10 +131,7 @@ static void scalarizeMaskedLoad(CallInst
   Builder.SetCurrentDebugLocation(CI->getDebugLoc());
 
   // Short-cut if the mask is all-true.
-  bool IsAllOnesMask =
-      isa<Constant>(Mask) && cast<Constant>(Mask)->isAllOnesValue();
-
-  if (IsAllOnesMask) {
+  if (isa<Constant>(Mask) && cast<Constant>(Mask)->isAllOnesValue()) {
     Value *NewI = Builder.CreateAlignedLoad(Ptr, AlignVal);
     CI->replaceAllUsesWith(NewI);
     CI->eraseFromParent();
@@ -269,10 +266,7 @@ static void scalarizeMaskedStore(CallIns
   Builder.SetCurrentDebugLocation(CI->getDebugLoc());
 
   // Short-cut if the mask is all-true.
-  bool IsAllOnesMask =
-      isa<Constant>(Mask) && cast<Constant>(Mask)->isAllOnesValue();
-
-  if (IsAllOnesMask) {
+  if (isa<Constant>(Mask) && cast<Constant>(Mask)->isAllOnesValue()) {
     Builder.CreateAlignedStore(Src, Ptr, AlignVal);
     CI->eraseFromParent();
     return;
@@ -391,9 +385,7 @@ static void scalarizeMaskedGather(CallIn
   unsigned VectorWidth = VecType->getNumElements();
 
   // Shorten the way if the mask is a vector of constants.
-  bool IsConstMask = isa<ConstantVector>(Mask);
-
-  if (IsConstMask) {
+  if (isa<ConstantVector>(Mask)) {
     for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
       if (cast<ConstantVector>(Mask)->getOperand(Idx)->isNullValue())
         continue;
@@ -512,9 +504,7 @@ static void scalarizeMaskedScatter(CallI
   unsigned VectorWidth = Src->getType()->getVectorNumElements();
 
   // Shorten the way if the mask is a vector of constants.
-  bool IsConstMask = isa<ConstantVector>(Mask);
-
-  if (IsConstMask) {
+  if (isa<ConstantVector>(Mask)) {
     for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
       if (cast<ConstantVector>(Mask)->getOperand(Idx)->isNullValue())
         continue;
@@ -527,6 +517,7 @@ static void scalarizeMaskedScatter(CallI
     CI->eraseFromParent();
     return;
   }
+
   for (unsigned Idx = 0; Idx < VectorWidth; ++Idx) {
     // Fill the "else" block, created in the previous iteration
     //




More information about the llvm-commits mailing list