[PATCH] D150033: fix stack probe lowering for x86_intrcc

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 6 08:00:16 PDT 2023


pengfei added a comment.

> To be honest I don't quite understand why this didn't lead to more noticeable miscompilations previously.

I don't know much about `STACKALLOC_W_PROBING`, just curious what's special to `x86_intrcc`? My real concern is if it's still well defined behavior if the function takes an error code.



================
Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:655
+  while (1) {
+    auto Where = llvm::find_if(PrologMBB, [](MachineInstr &MI) {
+      return MI.getOpcode() == X86::STACKALLOC_W_PROBING;
----------------
Use `for (MachineInstr &MI : PrologMBB) {` to iterate rather than loop `find_if`.


================
Comment at: llvm/test/CodeGen/X86/x86-64-intrcc.ll:181
+  
+  ; Ensure that STACKALLOC_W_PROBING isn't emitted.
+  ; CHECK-NOT: # fixed size alloca with probing
----------------
Maybe better to use `;;` for comments. The same below.


================
Comment at: llvm/test/CodeGen/X86/x86-64-intrcc.ll:187-188
+  %some_allocation = alloca i64
+  ; Call a un-inlineable function to ensure the allocation isn't put in the red
+  ; zone.
+  call void @external_function(ptr %some_allocation)
----------------
This can be in one line. There's no strict column limitation for test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150033



More information about the llvm-commits mailing list