summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorJoey Gouly <joey.gouly@arm.com>2013-05-24 12:33:28 +0000
committerJoey Gouly <joey.gouly@arm.com>2013-05-24 12:33:28 +0000
commit7ab9fb02f821806de5e27d01a123260dca799575 (patch)
treebfac9bcde3b7ab0547fb522337efc81590385d6d /lib/Transforms/InstCombine
parent4a941316cdcfbc3671c806c9c40df1bad09ba6ad (diff)
downloadllvm-7ab9fb02f821806de5e27d01a123260dca799575.tar.gz
llvm-7ab9fb02f821806de5e27d01a123260dca799575.tar.bz2
llvm-7ab9fb02f821806de5e27d01a123260dca799575.tar.xz
Run clang-format over the scalarizePHI function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine')
-rw-r--r--lib/Transforms/InstCombine/InstCombineVectorOps.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 527ddbca39..d4344c3c4d 100644
--- a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -125,17 +125,15 @@ Instruction *InstCombiner::scalarizePHI(ExtractElementInst &EI, PHINode *PN) {
// and that it is a binary operation which is cheap to scalarize.
// otherwise return NULL.
if (!PHIUser->hasOneUse() || !(PHIUser->use_back() == PN) ||
- !(isa<BinaryOperator>(PHIUser)) ||
- !CheapToScalarize(PHIUser, true))
+ !(isa<BinaryOperator>(PHIUser)) || !CheapToScalarize(PHIUser, true))
return NULL;
// Create a scalar PHI node that will replace the vector PHI node
// just before the current PHI node.
- PHINode * scalarPHI = cast<PHINode>(
- InsertNewInstWith(PHINode::Create(EI.getType(),
- PN->getNumIncomingValues(), ""), *PN));
+ PHINode *scalarPHI = cast<PHINode>(InsertNewInstWith(
+ PHINode::Create(EI.getType(), PN->getNumIncomingValues(), ""), *PN));
// Scalarize each PHI operand.
- for (unsigned i=0; i < PN->getNumIncomingValues(); i++) {
+ for (unsigned i = 0; i < PN->getNumIncomingValues(); i++) {
Value *PHIInVal = PN->getIncomingValue(i);
BasicBlock *inBB = PN->getIncomingBlock(i);
Value *Elt = EI.getIndexOperand();
@@ -145,19 +143,17 @@ Instruction *InstCombiner::scalarizePHI(ExtractElementInst &EI, PHINode *PN) {
// scalar PHI and the second operand is extracted from the other
// vector operand.
BinaryOperator *B0 = cast<BinaryOperator>(PHIUser);
- unsigned opId = (B0->getOperand(0) == PN) ? 1: 0;
+ unsigned opId = (B0->getOperand(0) == PN) ? 1 : 0;
Value *Op = InsertNewInstWith(
ExtractElementInst::Create(B0->getOperand(opId), Elt,
B0->getOperand(opId)->getName() + ".Elt"),
*B0);
Value *newPHIUser = InsertNewInstWith(
- BinaryOperator::Create(B0->getOpcode(), scalarPHI,Op),
- *B0);
+ BinaryOperator::Create(B0->getOpcode(), scalarPHI, Op), *B0);
scalarPHI->addIncoming(newPHIUser, inBB);
} else {
// Scalarize PHI input:
- Instruction *newEI =
- ExtractElementInst::Create(PHIInVal, Elt, "");
+ Instruction *newEI = ExtractElementInst::Create(PHIInVal, Elt, "");
// Insert the new instruction into the predecessor basic block.
Instruction *pos = dyn_cast<Instruction>(PHIInVal);
BasicBlock::iterator InsertPos;
@@ -226,7 +222,7 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
if (PHINode *PN = dyn_cast<PHINode>(EI.getOperand(0))) {
Instruction *scalarPHI = scalarizePHI(EI, PN);
if (scalarPHI)
- return (scalarPHI);
+ return scalarPHI;
}
}