Subzero: Make sure alloca with align=0 is handled correctly. 1. Modify dump() to match LLVM. 2. If it weren't for minimum stack alignment, the alignment code would be broken, so add a test in case the alignment code changes. BUG= none R=jvoung@chromium.org, kschimpf@google.com Review URL: https://codereview.chromium.org/557533003
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp index 756508e..c3a6e4d 100644 --- a/src/IceTargetLoweringX8632.cpp +++ b/src/IceTargetLoweringX8632.cpp
@@ -1118,6 +1118,9 @@ Operand *TotalSize = legalize(Inst->getSizeInBytes()); Variable *Dest = Inst->getDest(); uint32_t AlignmentParam = Inst->getAlignInBytes(); + // For default align=0, set it to the real value 1, to avoid any + // bit-manipulation problems below. + AlignmentParam = std::max(AlignmentParam, 1u); // LLVM enforces power of 2 alignment. assert((AlignmentParam & (AlignmentParam - 1)) == 0);