[PATCH] D66678: [GlobalISel] Replace hard coded dynamic alloca handling with G_DYN_STACKALLOC

Petar Avramovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 05:56:34 PDT 2019


Petar.Avramovic added a comment.

One nit, inlined, other then that looks good.



================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:3940
+  Register AllocSize = MI.getOperand(1).getReg();
+  unsigned Align = MI.getOperand(2).getImm();
+
----------------
uint64_t or int64_t instead of unsigned?


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:3957
+  if (Align) {
+    auto AlignCst = MIRBuilder.buildConstant(IntPtrTy, -Align);
+    Alloc = MIRBuilder.buildAnd(IntPtrTy, Alloc, AlignCst);
----------------
Or use explicit APInt for -Align here just to be sure we make bitmask of appropriate size/value.


================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/legalize-dyn-alloca.mir:97
+    ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[PTRTOINT]], [[AND]]
+    ; CHECK: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967264
+    ; CHECK: [[AND1:%[0-9]+]]:_(s64) = G_AND [[SUB]], [[C3]]
----------------
This bitmask seems strange, it looks like zeroextended 32 bit value -32 to a 64 bit value. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66678





More information about the llvm-commits mailing list