Index: lib/CodeGen/PrologEpilogInserter.cpp =================================================================== --- lib/CodeGen/PrologEpilogInserter.cpp +++ lib/CodeGen/PrologEpilogInserter.cpp @@ -567,9 +567,8 @@ // objects on the stack because enter the translation cache at a different // alignment than most functions. unsigned Skew = 0; - if (LLVM_UNLIKELY(Fn.getFunction()->getCallingConv() == CallingConv::HHVM)) { + if (LLVM_UNLIKELY(Fn.getFunction()->getCallingConv() == CallingConv::HHVM)) Skew = 8; - } // If there are fixed sized objects that are preallocated in the local area, // non-fixed objects can't be allocated right at the start of local area. Index: unittests/Support/MathExtrasTest.cpp =================================================================== --- unittests/Support/MathExtrasTest.cpp +++ unittests/Support/MathExtrasTest.cpp @@ -183,6 +183,11 @@ EXPECT_EQ(8u, RoundUpToAlignment(5, 8)); EXPECT_EQ(24u, RoundUpToAlignment(17, 8)); EXPECT_EQ(0u, RoundUpToAlignment(~0LL, 8)); + + EXPECT_EQ(7u, RoundUpToAlignment(5, 8, 7)); + EXPECT_EQ(17u, RoundUpToAlignment(17, 8, 1)); + EXPECT_EQ(3u, RoundUpToAlignment(~0LL, 8, 3)); + EXPECT_EQ(552u, RoundUpToAlignment(321, 255, 42)); } }