[X86] Assert that we've found a terminator instruction. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 16 Sep 2020 15:17:35 +0000 (16:17 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 16 Sep 2020 15:17:49 +0000 (16:17 +0100)
Fixes clang static analayzer null dereference warning.

llvm/lib/Target/X86/X86SpeculativeExecutionSideEffectSuppression.cpp

index 7e91c37..d578711 100644 (file)
@@ -161,6 +161,7 @@ bool X86SpeculativeExecutionSideEffectSuppression::runOnMachineFunction(
 
       // This branch requires adding an LFENCE.
       if (!PrevInstIsLFENCE) {
+        assert(FirstTerminator && "Unknown terminator instruction");
         BuildMI(MBB, FirstTerminator, DebugLoc(), TII->get(X86::LFENCE));
         NumLFENCEsInserted++;
         Modified = true;