Skip to content

Commit 9842d61

Browse files
committedNov 25, 2015
[safestack] Fix alignment of dynamic allocas.
Fixes PR25588. llvm-svn: 254109
1 parent a62513c commit 9842d61

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎llvm/lib/Transforms/Instrumentation/SafeStack.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ void SafeStack::moveDynamicAllocasToUnsafeStack(
541541
if (DynamicTop)
542542
IRB.CreateStore(NewTop, DynamicTop);
543543

544-
Value *NewAI = IRB.CreateIntToPtr(SP, AI->getType());
544+
Value *NewAI = IRB.CreatePointerCast(NewTop, AI->getType());
545545
if (AI->hasName() && isa<Instruction>(NewAI))
546546
NewAI->takeName(AI);
547547

‎llvm/test/Transforms/SafeStack/setjmp2.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ entry:
2525
; CHECK-NEXT: %[[INTTOPTR:.*]] = inttoptr i64 %[[AND]] to i8*
2626
; CHECK-NEXT: store i8* %[[INTTOPTR]], i8** @__safestack_unsafe_stack_ptr
2727
; CHECK-NEXT: store i8* %[[INTTOPTR]], i8** %unsafe_stack_dynamic_ptr
28-
; CHECK-NEXT: %[[ALLOCA:.*]] = inttoptr i64 %[[SUB]] to i32*
28+
; CHECK-NEXT: %[[ALLOCA:.*]] = bitcast i8* %[[INTTOPTR]] to i32*
2929
%a = alloca i32, i32 %size
3030

3131
; CHECK: setjmp

0 commit comments

Comments
 (0)
Please sign in to comment.