[llvm] r253787 - use ternary ops; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 21 08:51:19 PST 2015


Author: spatel
Date: Sat Nov 21 10:51:19 2015
New Revision: 253787

URL: http://llvm.org/viewvc/llvm-project?rev=253787&view=rev
Log:
use ternary ops; NFC

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

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=253787&r1=253786&r2=253787&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Sat Nov 21 10:51:19 2015
@@ -1325,14 +1325,8 @@ Value *InstCombiner::SimplifyVectorOp(Bi
     }
     if (MayChange) {
       Constant *C2 = ConstantVector::get(C2M);
-      Value *NewLHS, *NewRHS;
-      if (isa<Constant>(LHS)) {
-        NewLHS = C2;
-        NewRHS = Shuffle->getOperand(0);
-      } else {
-        NewLHS = Shuffle->getOperand(0);
-        NewRHS = C2;
-      }
+      Value *NewLHS = isa<Constant>(LHS) ? C2 : Shuffle->getOperand(0);
+      Value *NewRHS = isa<Constant>(LHS) ? Shuffle->getOperand(0) : C2;
       Value *NewBO = CreateBinOpAsGiven(Inst, NewLHS, NewRHS, Builder);
       return Builder->CreateShuffleVector(NewBO,
           UndefValue::get(Inst.getType()), Shuffle->getMask());




More information about the llvm-commits mailing list