From 8e985e3604c4790a1ab5ef2dd6f0a8f56679f32a Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 27 Mar 2023 13:48:06 -0700 Subject: [PATCH] [RISCV] Replace an 'else if' with 'else'+assert. NFC 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 --- llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp index b1171da..7e7b25d 100644 --- a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp @@ -173,12 +173,12 @@ static std::pair 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); } -- 2.7.4