MaskRay added inline comments.

================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:33-37
+  std::vector<CalleeSavedInfo> &CSI = MF.getFrameInfo().getCalleeSavedInfo();
+  if (std::none_of(CSI.begin(), CSI.end(), [](CalleeSavedInfo &CSR) {
+        return CSR.getReg() == RISCV::X1;
+      }))
+    return;
----------------
jrtc27 wrote:
> ```
>     if (find(CSI, RISCV::X1) == CSI.end())
>       return;
> ```
> (using `llvm::find` as a convenient wrapper around `std::find`, ie shorthand 
> for `std::find(CSI.begin(), CSI.end(), RISCV::X1)`). Though personally I'd 
> prefer to see X1 come from `RI.getRARegister()` rather than be hard-coded; 
> other functions in this file already hard-code it, but in our CHERI fork we 
> need to replace RISCV::X1 with RISCV::C1 everywhere so have changed those. 
> Having said that, CHERI renders a shadow call stack unnecessary, so I don't 
> particularly care if it's broken there, personally. But I still think it's 
> nicer code.
`!llvm::is_contained(CSI, RISCV::X1)`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84414



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to