[safestack] Fix alignment of dynamic allocas.
[oota-llvm.git] / lib / Transforms / Instrumentation / SafeStack.cpp
index e51822f6942d6f76ccc72a8807e297c80669fa53..6071ca5a87543c42f6f80a1702e8e95ff53ee036 100644 (file)
@@ -541,7 +541,7 @@ void SafeStack::moveDynamicAllocasToUnsafeStack(
     if (DynamicTop)
       IRB.CreateStore(NewTop, DynamicTop);
 
-    Value *NewAI = IRB.CreateIntToPtr(SP, AI->getType());
+    Value *NewAI = IRB.CreatePointerCast(NewTop, AI->getType());
     if (AI->hasName() && isa<Instruction>(NewAI))
       NewAI->takeName(AI);