[PATCH] D60772: [AMDGPU] Add optional bounds checking for scratch accesses

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 19:32:27 PDT 2019


arsenm added inline comments.


================
Comment at: lib/Target/AMDGPU/AMDGPUTargetMachine.cpp:899
   }
+  addPass(createSIInsertScratchBoundsPass());
   addPass(createSIWholeQuadModePass());
----------------
I would expect this kind of handling to be done as part of selection, not a pretty late pass


================
Comment at: lib/Target/AMDGPU/SIFixScratchSize.cpp:62
+  const MachineFrameInfo &FrameInfo = MF.getFrameInfo();
+  const uint64_t StackSize = FrameInfo.getStackSize();
+
----------------
This whole pass doesn't work when there's dynamic stack usage?


================
Comment at: lib/Target/AMDGPU/SIFixScratchSize.cpp:65
+  bool Changed = false;
+
+  for (MachineBasicBlock &MBB : MF) {
----------------
Can early exit if there is no stack usage


================
Comment at: lib/Target/AMDGPU/SIFixScratchSize.cpp:68
+    for (MachineInstr &MI : MBB) {
+      if (MI.getOpcode() == AMDGPU::S_MOV_B32) {
+        MachineOperand& Src = MI.getOperand(1);
----------------
Can't assume the instruction use


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60772





More information about the llvm-commits mailing list