[PATCH] D20263: X86: Avoid using _chkstk when lowering WIN_ALLOCA instructions

David Kreitzer via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 12:19:38 PDT 2016


DavidKreitzer added a comment.

I just have a couple other minor suggestions. Otherwise, LGTM.


================
Comment at: lib/Target/X86/X86WinAllocaExpander.cpp:116
@@ +115,3 @@
+  switch (MI.getOpcode()) {
+   case X86::PUSH32i8:
+   case X86::PUSH32r:
----------------
Isn't the formatting convention to line up "case" and "switch"?

================
Comment at: lib/Target/X86/X86WinAllocaExpander.cpp:153
@@ +152,3 @@
+  for (MachineBasicBlock *MBB : RPO) {
+    int64_t Offset = -1;
+    for (MachineBasicBlock *Pred : MBB->predecessors())
----------------
Ah, cool. That's good to know, thanks!

================
Comment at: lib/Target/X86/X86WinAllocaExpander.cpp:217
@@ +216,3 @@
+  if (Amount != -1) {
+    assert((Amount % SlotSize == 0) && "Stack would not be aligned!");
+  }
----------------
Since SlotSize is always a power of 2, a minor compile-time efficiency improvement would be to change the assert condition to (Amount & (SlotSize - 1)) == 0.


http://reviews.llvm.org/D20263





More information about the llvm-commits mailing list