Skip to content

Commit

Permalink
[RISCV] Replace an 'else if' with 'else'+assert. NFC
Browse files Browse the repository at this point in the history
There are only two cases here. Using an assert ensures there is
no handled third case.

Also move comment to avoid odd formatting.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D146998
  • Loading branch information
topperc committed Mar 27, 2023
1 parent 2315945 commit 8e985e3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ static std::pair<Value *, Value *> matchStridedStart(Value *Start,

Builder.SetInsertPoint(BO);
Builder.SetCurrentDebugLocation(DebugLoc());
// Add the splat value to the start
// Add the splat value to the start or multiply the start and stride by the
// splat.
if (BO->getOpcode() == Instruction::Add) {
Start = Builder.CreateAdd(Start, Splat);
}
// Or multiply the start and stride by the splat.
else if (BO->getOpcode() == Instruction::Mul) {
} else {
assert(BO->getOpcode() == Instruction::Mul && "Unexpected opcode");
Start = Builder.CreateMul(Start, Splat);
Stride = Builder.CreateMul(Stride, Splat);
}
Expand Down

0 comments on commit 8e985e3

Please sign in to comment.