[llvm-branch-commits] [llvm] [BPF][GlobalISel] select non-PreISelGenericOpcode (PR #75034)

Yingchi Long via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Dec 11 01:39:19 PST 2023


https://github.com/inclyc created https://github.com/llvm/llvm-project/pull/75034

This selects non-PreISelGenericOpcode as-is.

>From 7684e98041fee0fbc5c6add0505ab414d4ff705a Mon Sep 17 00:00:00 2001
From: Yingchi Long <i at lyc.dev>
Date: Mon, 11 Dec 2023 17:33:40 +0800
Subject: [PATCH] [BPF][GlobalISel] select non-PreISelGenericOpcode

This selects non-PreISelGenericOpcode as-is.

Co-authored-by: Origami404 <Origami404 at foxmail.com>
---
 llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp  | 2 ++
 llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp b/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp
index 1effeb7a57b13..c7db93a260c47 100644
--- a/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp
+++ b/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp
@@ -76,6 +76,8 @@ BPFInstructionSelector::BPFInstructionSelector(const BPFTargetMachine &TM,
 }
 
 bool BPFInstructionSelector::select(MachineInstr &I) {
+  if (!isPreISelGenericOpcode(I.getOpcode()))
+    return true;
   if (selectImpl(I, *CoverageInfo))
     return true;
   return false;
diff --git a/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll b/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll
index 7a014f7841fc8..031e82dcb67bd 100644
--- a/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll
+++ b/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll
@@ -1,7 +1,12 @@
 ; RUN: llc -mtriple=bpfel -global-isel -verify-machineinstrs -stop-after=irtranslator < %s | FileCheck %s
+; RUN: llc -mtriple=bpfel -global-isel -verify-machineinstrs < %s | FileCheck --check-prefix=ISEL %s
 
 ; CHECK: name: f
 ; CHECK: RET
 define void @f() {
+; ISEL-LABEL: f:
+; ISEL:       # %bb.0:
+; ISEL-NEXT:  exit
+; ISEL-NEXT: .Lfunc_end0:
   ret void
 }



More information about the llvm-branch-commits mailing list