From 45fa0fd758dd4eb20cca6f36d1b43dd1274c5ad7 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Thu, 16 Jun 2016 22:34:04 +0000 Subject: [safestack] Sink unsafe address computation to each use. This is a fix for PR27844. When replacing uses of unsafe allocas, emit the new location immediately after each use. Without this, the pointer stays live from the function entry to the last use, while it's usually cheaper to recalculate. llvm-svn: 272969 --- llvm/test/Transforms/SafeStack/array-aligned.ll | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'llvm/test/Transforms/SafeStack/array-aligned.ll') diff --git a/llvm/test/Transforms/SafeStack/array-aligned.ll b/llvm/test/Transforms/SafeStack/array-aligned.ll index 4676903ec77..26558e4fa81 100644 --- a/llvm/test/Transforms/SafeStack/array-aligned.ll +++ b/llvm/test/Transforms/SafeStack/array-aligned.ll @@ -13,16 +13,15 @@ entry: ; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr - ; CHECK: %[[AADDR:.*]] = alloca i8*, align 8 %a.addr = alloca i8*, align 8 - - ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, i8* %[[USP]], i32 -16 - ; CHECK: %[[BUFPTR2:.*]] = bitcast i8* %[[BUFPTR]] to [16 x i8]* %buf = alloca [16 x i8], align 16 + ; CHECK: %[[AADDR:.*]] = alloca i8*, align 8 ; CHECK: store i8* {{.*}}, i8** %[[AADDR]], align 8 store i8* %a, i8** %a.addr, align 8 + ; CHECK: %[[BUFPTR:.*]] = getelementptr i8, i8* %[[USP]], i32 -16 + ; CHECK: %[[BUFPTR2:.*]] = bitcast i8* %[[BUFPTR]] to [16 x i8]* ; CHECK: %[[GEP:.*]] = getelementptr inbounds [16 x i8], [16 x i8]* %[[BUFPTR2]], i32 0, i32 0 %gep = getelementptr inbounds [16 x i8], [16 x i8]* %buf, i32 0, i32 0 -- cgit v1.2.3