[cfe-commits] r64001 - /cfe/trunk/lib/CodeGen/CGCall.cpp
Daniel Dunbar
daniel at zuster.org
Fri Feb 6 18:46:04 PST 2009
Author: ddunbar
Date: Fri Feb 6 20:46:03 2009
New Revision: 64001
URL: http://llvm.org/viewvc/llvm-project?rev=64001&view=rev
Log:
Set load/store alignment when doing ABI coercions.
- Currently, this is producing poor code, but we prefer correctness
to performance for now. Eventually we should be able to generally
avoid having to set the alignment when we control the alignment of
the alloca.
- This knocks out 33/1000 failures on my single argument ABI tests,
down to 22/1000 and 18 of these appear to be gcc bugs. Woot.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=64001&r1=64000&r2=64001&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Feb 6 20:46:03 2009
@@ -959,7 +959,10 @@
if (SrcSize == DstSize) {
llvm::Value *Casted =
CGF.Builder.CreateBitCast(SrcPtr, llvm::PointerType::getUnqual(Ty));
- return CGF.Builder.CreateLoad(Casted);
+ llvm::LoadInst *Load = CGF.Builder.CreateLoad(Casted);
+ // FIXME: Use better alignment / avoid requiring aligned load.
+ Load->setAlignment(1);
+ return Load;
} else {
assert(SrcSize < DstSize && "Coercion is losing source bits!");
@@ -968,7 +971,10 @@
llvm::Value *Tmp = CGF.CreateTempAlloca(Ty);
llvm::Value *Casted =
CGF.Builder.CreateBitCast(Tmp, llvm::PointerType::getUnqual(SrcTy));
- CGF.Builder.CreateStore(CGF.Builder.CreateLoad(SrcPtr), Casted);
+ llvm::StoreInst *Store =
+ CGF.Builder.CreateStore(CGF.Builder.CreateLoad(SrcPtr), Casted);
+ // FIXME: Use better alignment / avoid requiring aligned store.
+ Store->setAlignment(1);
return CGF.Builder.CreateLoad(Tmp);
}
}
@@ -992,7 +998,8 @@
if (SrcSize == DstSize) {
llvm::Value *Casted =
CGF.Builder.CreateBitCast(DstPtr, llvm::PointerType::getUnqual(SrcTy));
- CGF.Builder.CreateStore(Src, Casted);
+ // FIXME: Use better alignment / avoid requiring aligned store.
+ CGF.Builder.CreateStore(Src, Casted)->setAlignment(1);
} else {
assert(SrcSize > DstSize && "Coercion is missing bits!");
@@ -1002,7 +1009,10 @@
CGF.Builder.CreateStore(Src, Tmp);
llvm::Value *Casted =
CGF.Builder.CreateBitCast(Tmp, llvm::PointerType::getUnqual(DstTy));
- CGF.Builder.CreateStore(CGF.Builder.CreateLoad(Casted), DstPtr);
+ llvm::LoadInst *Load = CGF.Builder.CreateLoad(Casted);
+ // FIXME: Use better alignment / avoid requiring aligned load.
+ Load->setAlignment(1);
+ CGF.Builder.CreateStore(Load, DstPtr);
}
}
More information about the cfe-commits
mailing list