[llvm] r357529 - [X86] Mark the default case of the X86InstrInfo::convertToThreeAddress switch as unreachable.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 2 13:52:16 PDT 2019


Author: ctopper
Date: Tue Apr  2 13:52:16 2019
New Revision: 357529

URL: http://llvm.org/viewvc/llvm-project?rev=357529&view=rev
Log:
[X86] Mark the default case of the X86InstrInfo::convertToThreeAddress switch as unreachable.

This function should only be called with instructions that are really convertible. And all
convertible instructions need to be handled by the switch. So nothing should use the default.

Modified:
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=357529&r1=357528&r2=357529&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Apr  2 13:52:16 2019
@@ -869,7 +869,7 @@ X86InstrInfo::convertToThreeAddress(Mach
   bool Is8BitOp = false;
   unsigned MIOpc = MI.getOpcode();
   switch (MIOpc) {
-  default: return nullptr;
+  default: llvm_unreachable("Unreachable!");
   case X86::SHL64ri: {
     assert(MI.getNumOperands() >= 3 && "Unknown shift instruction!");
     unsigned ShAmt = getTruncatedShiftCount(MI, 2);




More information about the llvm-commits mailing list