diff --git a/bolt/include/bolt/Core/MCPlusBuilder.h b/bolt/include/bolt/Core/MCPlusBuilder.h --- a/bolt/include/bolt/Core/MCPlusBuilder.h +++ b/bolt/include/bolt/Core/MCPlusBuilder.h @@ -614,13 +614,11 @@ virtual bool isMoveMem2Reg(const MCInst &Inst) const { return false; } virtual bool isLoad(const MCInst &Inst) const { - llvm_unreachable("not implemented"); - return false; + return Info->get(Inst.getOpcode()).mayLoad(); } virtual bool isStore(const MCInst &Inst) const { - llvm_unreachable("not implemented"); - return false; + return Info->get(Inst.getOpcode()).mayStore(); } virtual bool isCleanRegXOR(const MCInst &Inst) const { diff --git a/bolt/test/RISCV/load-store.s b/bolt/test/RISCV/load-store.s new file mode 100644 --- /dev/null +++ b/bolt/test/RISCV/load-store.s @@ -0,0 +1,16 @@ +// RUN: %clang %cflags -o %t %s +// RUN: link_fdata --no-lbr %s %t %t.fdata +// RUN: llvm-bolt %t -o /dev/null -data=%t.fdata -dyno-stats | FileCheck %s + +// CHECK: BOLT-INFO: program-wide dynostats after all optimizations before SCTC and FOP (no change): +// CHECK: 3000 : executed instructions +// CHECK: 1000 : executed load instructions +// CHECK: 1000 : executed store instructions + + .globl _start +_start: +# FDATA: 1 _start #_start# 1 + ld t0, (gp) + sd t0, (gp) + ret + .size _start, .-_start