[PATCH] D80156: [BPF] Prevent disassembly segfault for NOP insn

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 17:54:53 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGddff9799d2d0: [BPF] Prevent disassembly segfault for NOP insn (authored by yonghong-song).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80156/new/

https://reviews.llvm.org/D80156

Files:
  llvm/lib/Target/BPF/BPFInstrInfo.td
  llvm/test/CodeGen/BPF/objdump_nop.ll


Index: llvm/test/CodeGen/BPF/objdump_nop.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/BPF/objdump_nop.ll
@@ -0,0 +1,19 @@
+; RUN: llc -march=bpfel -filetype=obj -o - %s | llvm-objdump -d - | FileCheck %s
+;
+; Source:
+;   int test() {
+;     asm volatile("r0 = r0" ::);
+;     return 0;
+;   }
+; Compilation flag:
+;   clang -target bpf -O2 -S -emit-llvm t.c
+
+; Function Attrs: nounwind
+define dso_local i32 @test() local_unnamed_addr {
+entry:
+  tail call void asm sideeffect "r0 = r0", ""()
+  ret i32 0
+}
+; CHECK-LABEL: test
+; CHECK:       r0 = r0
+; CHECK:       r0 = 0
Index: llvm/lib/Target/BPF/BPFInstrInfo.td
===================================================================
--- llvm/lib/Target/BPF/BPFInstrInfo.td
+++ llvm/lib/Target/BPF/BPFInstrInfo.td
@@ -526,7 +526,7 @@
   let BPFClass = BPF_ALU64;
 }
 
-let hasSideEffects = 0 in
+let hasSideEffects = 0, isCodeGenOnly = 1 in
   def NOP : NOP_I<"nop">;
 
 class RET<string OpcodeStr>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80156.264760.patch
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/b30b0bd4/attachment.bin>


More information about the llvm-commits mailing list