[PATCH] D14974: [safestack] Fix alignment of dynamic allocas.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 17:27:30 PST 2015


eugenis created this revision.
eugenis added a reviewer: pcc.
eugenis added a subscriber: llvm-commits.
eugenis set the repository for this revision to rL LLVM.

Fixes PR25588.

Repository:
  rL LLVM

http://reviews.llvm.org/D14974

Files:
  lib/Transforms/Instrumentation/SafeStack.cpp
  test/Transforms/SafeStack/setjmp2.ll

Index: test/Transforms/SafeStack/setjmp2.ll
===================================================================
--- test/Transforms/SafeStack/setjmp2.ll
+++ test/Transforms/SafeStack/setjmp2.ll
@@ -25,7 +25,7 @@
   ; CHECK-NEXT: %[[INTTOPTR:.*]] = inttoptr i64 %[[AND]] to i8*
   ; CHECK-NEXT: store i8* %[[INTTOPTR]], i8** @__safestack_unsafe_stack_ptr
   ; CHECK-NEXT: store i8* %[[INTTOPTR]], i8** %unsafe_stack_dynamic_ptr
-  ; CHECK-NEXT: %[[ALLOCA:.*]] = inttoptr i64 %[[SUB]] to i32*
+  ; CHECK-NEXT: %[[ALLOCA:.*]] = bitcast i8* %[[INTTOPTR]] to i32*
   %a = alloca i32, i32 %size
 
   ; CHECK: setjmp
Index: lib/Transforms/Instrumentation/SafeStack.cpp
===================================================================
--- lib/Transforms/Instrumentation/SafeStack.cpp
+++ lib/Transforms/Instrumentation/SafeStack.cpp
@@ -541,7 +541,7 @@
     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);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14974.41101.patch
Type: text/x-patch
Size: 1121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151125/7ac02633/attachment.bin>


More information about the llvm-commits mailing list