Skip to content

Commit ef98039

Browse files
committed
Address review comments
Fixed outdated numebr of NOPs in RV32.
1 parent 4b99f6b commit ef98039

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compiler-rt/lib/xray/xray_riscv.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static inline bool patchSled(const bool Enable, const uint32_t FuncId,
8484
//
8585
// xray_sled_n:
8686
// J .tmpN
87-
// 25 or 33 C.NOPs (50 or 66 bytes)
87+
// 21 or 33 C.NOPs (42 or 66 bytes)
8888
// .tmpN
8989
//
9090
// With one of the following runtime patches:
@@ -158,11 +158,11 @@ static inline bool patchSled(const bool Enable, const uint32_t FuncId,
158158
size_t Idx = 1U;
159159
const uint32_t XLenBytes = __riscv_xlen / 8;
160160
#if __riscv_xlen == 64
161-
const unsigned LoadOp = PatchOpcodes::PO_LD;
162-
const unsigned StoreOp = PatchOpcodes::PO_SD;
161+
const uint32_t LoadOp = PatchOpcodes::PO_LD;
162+
const uint32_t StoreOp = PatchOpcodes::PO_SD;
163163
#elif __riscv_xlen == 32
164-
const unsigned LoadOp = PatchOpcodes::PO_LW;
165-
const unsigned StoreOp = PatchOpcodes::PO_SW;
164+
const uint32_t LoadOp = PatchOpcodes::PO_LW;
165+
const uint32_t StoreOp = PatchOpcodes::PO_SW;
166166
#endif
167167

168168
Address[Idx++] = encodeSTypeInstruction(StoreOp, RegNum::RN_SP,

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,9 +1591,9 @@ unsigned RISCVInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const {
15911591
// Number of C.NOP or NOP
15921592
return (STI.hasStdExtCOrZca() ? 2 : 4) * Num;
15931593
}
1594-
// XRay uses C.JAL + 25 or 33 C.NOP for each sled in RV32 and RV64,
1594+
// XRay uses C.JAL + 21 or 33 C.NOP for each sled in RV32 and RV64,
15951595
// respectively.
1596-
return STI.is64Bit() ? 68 : 52;
1596+
return STI.is64Bit() ? 68 : 44;
15971597
}
15981598
default:
15991599
return get(Opcode).getSize();

0 commit comments

Comments
 (0)