[PATCH] D154192: [LoongArch] Explicitly specify instruction properties

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 02:49:24 PDT 2023


xen0n added a comment.

The diff is missing context lines, I guess you created the patch with plain `git diff` and posted the diff with the web interface... Checkout the recommendations <https://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface> or set up Arcanist and use `arc diff`. (In case of Arcanist you may have to apply some PHP 8 fixes <https://discourse.llvm.org/t/arcanist-deprecation-errors-on-php-8/63231> but it should be straight-forward otherwise.)



================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.td:779
 def STPTR_D : STORE_2RI14<0b00100111, "stptr.d">;
+let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
 def PRELDX : FmtPRELDX<(outs), (ins uimm5:$imm5, GPR:$rj, GPR:$rk), "preldx",
----------------
I checked PPC and RISCV and it seems prefetch instructions should have `mayLoad = 1, mayStore = 1`. Otherwise I expect them to get incorrectly optimized away...


================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.td:1915
 // TLB Maintenance Instructions
+let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
 def TLBSRCH  : FmtI32<0b00000110010010000010100000000000, "tlbsrch">;
----------------
These instructions should probably be `hasSideEffects = 1` because they instruct the hardware to perform certain actions. Otherwise they will probably get deleted too given they don't return anything...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154192



More information about the llvm-commits mailing list