[llvm] [BOLT][BTI] Add MCPlusBuilder::insertBTI (PR #167329)

Gergely Bálint via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 03:26:19 PST 2025


================
@@ -2838,18 +2838,17 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
 
   void insertBTI(BinaryBasicBlock &BB, MCInst &Call) const override {
     auto II = BB.getFirstNonPseudo();
-    assert(II != BB.end() &&
-           "insertBTI should only be called on non-empty BasicBlocks");
-    // Make sure there is no crash in non-assertion builds when calling on empty
-    // BBs.
-    if (II != BB.end()) {
+    // Only check the first instruction for non-empty BasicBlocks
+    bool Empty = (II == BB.end());
+    if (!Empty) {
       if (isBTIVariantCoveringCall(Call, *II))
         return;
+    }
----------------
bgergely0 wrote:

ahh formatter caught it as well....

https://github.com/llvm/llvm-project/pull/167329


More information about the llvm-commits mailing list