[llvm] cd46151 - [X86] Assert that we've found a terminator instruction. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 08:18:00 PDT 2020


Author: Simon Pilgrim
Date: 2020-09-16T16:17:49+01:00
New Revision: cd4615120233c54034b42bafc3d2bcc9f29db63d

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

LOG: [X86] Assert that we've found a terminator instruction. NFCI.

Fixes clang static analayzer null dereference warning.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86SpeculativeExecutionSideEffectSuppression.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86SpeculativeExecutionSideEffectSuppression.cpp b/llvm/lib/Target/X86/X86SpeculativeExecutionSideEffectSuppression.cpp
index 7e91c37367d2..d57871130b0c 100644
--- a/llvm/lib/Target/X86/X86SpeculativeExecutionSideEffectSuppression.cpp
+++ b/llvm/lib/Target/X86/X86SpeculativeExecutionSideEffectSuppression.cpp
@@ -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;


        


More information about the llvm-commits mailing list