[llvm] r280727 - fix formatting; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 6 11:16:32 PDT 2016


Author: spatel
Date: Tue Sep  6 13:16:31 2016
New Revision: 280727

URL: http://llvm.org/viewvc/llvm-project?rev=280727&view=rev
Log:
fix formatting; NFC

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp?rev=280727&r1=280726&r2=280727&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp Tue Sep  6 13:16:31 2016
@@ -1133,29 +1133,24 @@ Instruction *InstCombiner::visitSelectIn
     if (Instruction *IV = FoldSelectOpOp(SI, TI, FI))
       return IV;
 
-  // (select C, (sext X), const) -> (sext (select C, X, const')) and
-  // variations thereof when extending from i1, as that allows further folding
-  // into logic ops. When the sext is from a larger type, we prefer to have it
-  // as an operand.
-  if (TI &&
-      (TI->getOpcode() == Instruction::ZExt || TI->getOpcode() == Instruction::SExt)) {
+  // (select C, (ext X), const) -> (ext (select C, X, const')) and variations
+  // thereof when extending from i1, as that allows further folding into logic
+  // ops. When the sext is from a larger type, prefer to have it as an operand.
+  if (TI && (TI->getOpcode() == Instruction::ZExt ||
+             TI->getOpcode() == Instruction::SExt)) {
     bool IsSExt = TI->getOpcode() == Instruction::SExt;
     const APInt *C;
-    if (match(FalseVal, m_APInt(C))) {
-      if (Instruction *IV =
-              foldSelectExtConst(*Builder, SI, TI, *C, true, IsSExt))
-        return IV;
-    }
+    if (match(FalseVal, m_APInt(C)))
+      if (auto *I = foldSelectExtConst(*Builder, SI, TI, *C, true, IsSExt))
+        return I;
   }
-  if (FI &&
-      (FI->getOpcode() == Instruction::ZExt || FI->getOpcode() == Instruction::SExt)) {
+  if (FI && (FI->getOpcode() == Instruction::ZExt ||
+             FI->getOpcode() == Instruction::SExt)) {
     bool IsSExt = FI->getOpcode() == Instruction::SExt;
     const APInt *C;
-    if (match(TrueVal, m_APInt(C))) {
-      if (Instruction *IV =
-              foldSelectExtConst(*Builder, SI, FI, *C, false, IsSExt))
-          return IV;
-    }
+    if (match(TrueVal, m_APInt(C)))
+      if (auto *I = foldSelectExtConst(*Builder, SI, FI, *C, false, IsSExt))
+        return I;
   }
 
   // See if we can fold the select into one of our operands.
@@ -1293,7 +1288,7 @@ Instruction *InstCombiner::visitSelectIn
     return &SI;
   }
 
-  if (VectorType* VecTy = dyn_cast<VectorType>(SelType)) {
+  if (VectorType *VecTy = dyn_cast<VectorType>(SelType)) {
     unsigned VWidth = VecTy->getNumElements();
     APInt UndefElts(VWidth, 0);
     APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));




More information about the llvm-commits mailing list