[llvm] [BOLT] Skip functions with unsupported Linux kernel features (PR #86345)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 14:54:35 PDT 2024


================
@@ -1126,6 +1134,27 @@ Error LinuxKernelRewriter::readParaInstructions() {
   return Error::success();
 }
 
+Error LinuxKernelRewriter::rewriteParaInstructions() {
+  // Disable output of functions with paravirtual instructions before the
+  // rewrite support is complete.
+  for (BinaryFunction &BF : llvm::make_second_range(BC.getBinaryFunctions())) {
+    if (!BC.shouldEmit(BF))
+      continue;
+    for (const BinaryBasicBlock &BB : BF) {
+      if (!BC.shouldEmit(BF))
+        break;
+      for (const MCInst &Inst : BB) {
+        if (BC.MIB->hasAnnotation(Inst, "ParaSite")) {
+          BF.setSimple(false);
+          break;
+        }
+      }
----------------
aaupov wrote:

I'm fine with it as-is, but this can help reduce indentation:
```suggestion
      bool HasParaSite = llvm::any_of(BB, [&](const MCInst &Inst) { return BC.MIB->hasAnnotation(Inst, "ParaSite"); });
      if (HasParaSite)
        BF.setSimple(false);
```

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


More information about the llvm-commits mailing list