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

Peter Waller via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 03:21:08 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;
+    }
----------------
peterwaller-arm wrote:

Something went wrong with indentation here:

https://github.com/llvm/llvm-project/blob/046edf083fb73b01543dc9ae3fa7f9ba5d7c6a22/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp#L2843-L2848

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


More information about the llvm-commits mailing list