[llvm-commits] [dragonegg] r164765 - in /dragonegg/trunk: src/Convert.cpp test/validator/c++/2012-09-27-param-align.cpp
Duncan Sands
baldrick at free.fr
Thu Sep 27 02:51:47 PDT 2012
Author: baldrick
Date: Thu Sep 27 04:51:47 2012
New Revision: 164765
URL: http://llvm.org/viewvc/llvm-project?rev=164765&view=rev
Log:
The ABI code was generating loads and stores with too high an alignment, which
is probably the cause the the gcc-4.7 buildbot failure (generation of movaps
for memory that isn't aligned enough).
Added:
dragonegg/trunk/test/validator/c++/2012-09-27-param-align.cpp
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=164765&r1=164764&r2=164765&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Thu Sep 27 04:51:47 2012
@@ -699,7 +699,8 @@
} else {
// This cast only involves pointers, therefore BitCast.
Loc = Builder.CreateBitCast(Loc, LLVMTy->getPointerTo());
- Builder.CreateStore(ArgVal, Loc);
+ // FIXME: Pass down the alignment so we can do better than using 1 here.
+ Builder.CreateAlignedStore(ArgVal, Loc, 1);
}
}
@@ -3019,7 +3020,8 @@
if (Loc) {
// An address. Convert to the right type and load the value out.
Loc = Builder.CreateBitCast(Loc, Ty->getPointerTo());
- return Builder.CreateLoad(Loc, "val");
+ // FIXME: Pass alignment information down rather than just using 1 here.
+ return Builder.CreateAlignedLoad(Loc, 1, "val");
} else {
// A value - just return it.
assert(TheValue->getType() == Ty && "Value not of expected type!");
Added: dragonegg/trunk/test/validator/c++/2012-09-27-param-align.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/validator/c%2B%2B/2012-09-27-param-align.cpp?rev=164765&view=auto
==============================================================================
--- dragonegg/trunk/test/validator/c++/2012-09-27-param-align.cpp (added)
+++ dragonegg/trunk/test/validator/c++/2012-09-27-param-align.cpp Thu Sep 27 04:51:47 2012
@@ -0,0 +1,16 @@
+// RUN: %dragonegg -S %s -o - | FileCheck %s
+// ABI code was producing naturally aligned i64 loads and stores to memory that
+// was not as aligned as an i64.
+
+struct InReg {
+ unsigned a;
+ unsigned b;
+};
+
+void bar(InReg);
+
+void foo(InReg x) {
+ bar(x);
+// CHECK: store i64 {{.*}}, align
+// CHECK: load i64* {{.*}}, align
+}
More information about the llvm-commits
mailing list