[llvm] r254109 - [safestack] Fix alignment of dynamic allocas.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 14:52:30 PST 2015


Author: eugenis
Date: Wed Nov 25 16:52:30 2015
New Revision: 254109

URL: http://llvm.org/viewvc/llvm-project?rev=254109&view=rev
Log:
[safestack] Fix alignment of dynamic allocas.

Fixes PR25588.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/SafeStack.cpp
    llvm/trunk/test/Transforms/SafeStack/setjmp2.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/SafeStack.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SafeStack.cpp?rev=254109&r1=254108&r2=254109&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/SafeStack.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/SafeStack.cpp Wed Nov 25 16:52:30 2015
@@ -541,7 +541,7 @@ void SafeStack::moveDynamicAllocasToUnsa
     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);
 

Modified: llvm/trunk/test/Transforms/SafeStack/setjmp2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SafeStack/setjmp2.ll?rev=254109&r1=254108&r2=254109&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SafeStack/setjmp2.ll (original)
+++ llvm/trunk/test/Transforms/SafeStack/setjmp2.ll Wed Nov 25 16:52:30 2015
@@ -25,7 +25,7 @@ entry:
   ; 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




More information about the llvm-commits mailing list