[llvm-commits] [dragonegg] r164942 - in /dragonegg/trunk: src/Convert.cpp test/validator/c/2012-10-01-Alloca.c
Duncan Sands
baldrick at free.fr
Mon Oct 1 05:59:53 PDT 2012
Author: baldrick
Date: Mon Oct 1 07:59:53 2012
New Revision: 164942
URL: http://llvm.org/viewvc/llvm-project?rev=164942&view=rev
Log:
GCC's builtin alloca (the version without an explicit alignment) should be
aligned maximally, while we were aligning it minimally (1).
Added:
dragonegg/trunk/test/validator/c/2012-10-01-Alloca.c
Modified:
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=164942&r1=164941&r2=164942&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Mon Oct 1 07:59:53 2012
@@ -5763,7 +5763,9 @@
if (!validate_gimple_arglist(stmt, INTEGER_TYPE, VOID_TYPE))
return false;
Value *Amt = EmitMemory(gimple_call_arg(stmt, 0));
- Result = Builder.CreateAlloca(Type::getInt8Ty(Context), Amt);
+ AllocaInst *Alloca = Builder.CreateAlloca(Type::getInt8Ty(Context), Amt);
+ Alloca->setAlignment(BIGGEST_ALIGNMENT / 8);
+ Result = Alloca;
return true;
}
Added: dragonegg/trunk/test/validator/c/2012-10-01-Alloca.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c/2012-10-01-Alloca.c?rev=164942&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c/2012-10-01-Alloca.c (added)
+++ dragonegg/trunk/test/validator/c/2012-10-01-Alloca.c Mon Oct 1 07:59:53 2012
@@ -0,0 +1,11 @@
+// RUN: %dragonegg -S %s -o - | FileCheck %s
+// XFAIL: gcc-4.7
+
+void use(int*);
+
+void foo(int n, int i) {
+// CHECK: foo
+ int a[n];
+// CHECK: alloca i8, i64 {{.*}}, align 16
+ use(&a[i]);
+}
More information about the llvm-commits
mailing list