aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-21 16:44:13 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-21 16:44:13 -0800
commitb2fea7f30dba545a6eadf0ae108cf7cd4825c097 (patch)
treee182364407aa42efffab44541c38d0ced17d5032 /lib
parent6198caf10c3640721f70fca49671fd4081f0064e (diff)
keep alignment info
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/NaCl/StripAttributes.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/NaCl/StripAttributes.cpp b/lib/Transforms/NaCl/StripAttributes.cpp
index 184e06aba1..d4dc172530 100644
--- a/lib/Transforms/NaCl/StripAttributes.cpp
+++ b/lib/Transforms/NaCl/StripAttributes.cpp
@@ -162,6 +162,7 @@ void stripGlobalValueAttrs(GlobalValue *GV) {
static unsigned normalizeAlignment(DataLayout *DL, unsigned Alignment,
Type *Ty, bool IsAtomic) {
+#if 0
unsigned MaxAllowed = 1;
if (Ty->isDoubleTy() || Ty->isFloatTy() || IsAtomic)
MaxAllowed = DL->getTypeAllocSize(Ty);
@@ -170,6 +171,9 @@ static unsigned normalizeAlignment(DataLayout *DL, unsigned Alignment,
if (Alignment == 0 || Alignment >= MaxAllowed)
return MaxAllowed;
return 1;
+#else
+ return Alignment; // EMSCRIPTEN: no need to change alignment
+#endif
}
void stripFunctionAttrs(DataLayout *DL, Function *Func) {
@@ -188,12 +192,14 @@ void stripFunctionAttrs(DataLayout *DL, Function *Func) {
Call.setAttributes(AttributeSet());
Call.setCallingConv(CallingConv::C);
+#if 0 // EMSCRIPTEN: we do support alignment info in these calls
// Set memcpy(), memmove() and memset() to use pessimistic
// alignment assumptions.
if (MemIntrinsic *MemOp = dyn_cast<MemIntrinsic>(Inst)) {
Type *AlignTy = MemOp->getAlignmentCst()->getType();
MemOp->setAlignment(ConstantInt::get(AlignTy, 1));
}
+#endif
} else if (OverflowingBinaryOperator *Op =
dyn_cast<OverflowingBinaryOperator>(Inst)) {
cast<BinaryOperator>(Op)->setHasNoUnsignedWrap(false);