Index: src/IceTargetLoweringX8632.cpp |
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp |
index 756508ec4d7ccc17dc011d67a86bbb0cb2c50e2c..c3a6e4d33fb247a6e882d1cc787bb9a4a9db78a7 100644 |
--- a/src/IceTargetLoweringX8632.cpp |
+++ b/src/IceTargetLoweringX8632.cpp |
@@ -1118,6 +1118,9 @@ void TargetX8632::lowerAlloca(const InstAlloca *Inst) { |
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); |