[llvm] e3a45a2 - [ARM][Thumb2InstrInfo] Fix default `0` opcode when rewriting frame indices

David Tellenbach via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 12:00:09 PDT 2019


Author: David Tellenbach
Date: 2019-10-28T18:58:45Z
New Revision: e3a45a24d1077e2afc917024032715afa70fb2ac

URL: https://github.com/llvm/llvm-project/commit/e3a45a24d1077e2afc917024032715afa70fb2ac
DIFF: https://github.com/llvm/llvm-project/commit/e3a45a24d1077e2afc917024032715afa70fb2ac.diff

LOG: [ARM][Thumb2InstrInfo] Fix default `0` opcode when rewriting frame indices

The static functions `positiveOffsetOpcode`, `negativeOffsetOpcode` and
`immediateOffsetOpcode` (lib/Target/ARM/Thumb2InstrInfo.cpp) currently can
return `0` as default opcode which is meaningless in this situation.

This patch replaces this default value by llvm_unreachable.

Reviewers: t.p.northover, tellenbach

Reviewed By: tellenbach

Subscribers: tellenbach, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D69432

Patch By: Lorenzo Casalino <lorenzo.casalino93 at gmail.com>

Added: 
    

Modified: 
    llvm/lib/Target/ARM/Thumb2InstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
index af1f0aeb27ba..ded7c48fd21b 100644
--- a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
+++ b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
@@ -388,10 +388,8 @@ negativeOffsetOpcode(unsigned opcode)
     return opcode;
 
   default:
-    break;
+    llvm_unreachable("unknown thumb2 opcode.");
   }
-
-  return 0;
 }
 
 static unsigned
@@ -420,10 +418,8 @@ positiveOffsetOpcode(unsigned opcode)
     return opcode;
 
   default:
-    break;
+    llvm_unreachable("unknown thumb2 opcode.");
   }
-
-  return 0;
 }
 
 static unsigned
@@ -461,10 +457,8 @@ immediateOffsetOpcode(unsigned opcode)
     return opcode;
 
   default:
-    break;
+    llvm_unreachable("unknown thumb2 opcode.");
   }
-
-  return 0;
 }
 
 bool llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,


        


More information about the llvm-commits mailing list