[PATCH] D146998: [RISCV] Replace an 'else if' with 'else'+assert. NFC

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 13:48:26 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8e985e3604c4: [RISCV] Replace an 'else if' with 'else'+assert. NFC (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146998/new/

https://reviews.llvm.org/D146998

Files:
  llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp


Index: llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
@@ -173,12 +173,12 @@
 
   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);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146998.508786.patch
Type: text/x-patch
Size: 861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230327/f5b52456/attachment.bin>


More information about the llvm-commits mailing list