Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 22a277c

Browse files
committed
Disable inapplicable PNaCl SIMD lowering passes.
1 parent 3de1835 commit 22a277c

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

lib/Transforms/NaCl/PNaClABISimplify.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,28 @@ void llvm::PNaClABISimplifyAddPostOptPasses(PassManagerBase &PM) {
129129

130130
// Vector simplifications.
131131
//
132+
#if 0 // EMSCRIPTEN: We can handle vector shuffles.
132133
// The following pass relies on ConstantInsertExtractElementIndex running
133134
// after it, and it must run before GlobalizeConstantVectors because the mask
134135
// argument of shufflevector must be a constant (the pass would otherwise
135136
// violate this requirement).
136137
PM.add(createExpandShuffleVectorPass());
138+
#endif
137139
// We should not place arbitrary passes after ExpandConstantExpr
138140
// because they might reintroduce ConstantExprs.
139141
PM.add(createExpandConstantExprPass());
142+
#if 0 // EMSCRIPTEN: We can handle constant vectors.
140143
// GlobalizeConstantVectors does not handle nested ConstantExprs, so we
141144
// run ExpandConstantExpr first.
142145
PM.add(createGlobalizeConstantVectorsPass());
146+
#endif
143147
// The following pass inserts GEPs, it must precede ExpandGetElementPtr. It
144148
// also creates vector loads and stores, the subsequent pass cleans them up to
145149
// fix their alignment.
146150
PM.add(createConstantInsertExtractElementIndexPass());
151+
#if 0 // EMSCRIPTEN: We can handle unaligned vector loads and stores.
147152
PM.add(createFixVectorLoadStoreAlignmentPass());
153+
#endif
148154

149155
// Optimization passes and ExpandByVal introduce
150156
// memset/memcpy/memmove intrinsics with a 64-bit size argument.

lib/Transforms/NaCl/PromoteIntegers.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,24 @@ static bool shouldConvert(Value *Val) {
112112
// Return a constant which has been promoted to a legal size.
113113
static Value *convertConstant(Constant *C, bool SignExt=false) {
114114
assert(shouldConvert(C));
115+
#if 0 // EMSCRIPTEN: Generalize this code to work on any width and any constant
115116
if (isa<UndefValue>(C)) {
116117
return UndefValue::get(getPromotedType(C->getType()));
117118
} else if (ConstantInt *CInt = dyn_cast<ConstantInt>(C)) {
118-
#if 0 // XXX EMSCRIPTEN: Generalize this code to work on any bit width.
119119
return ConstantInt::get(
120120
getPromotedType(C->getType()),
121121
SignExt ? CInt->getSExtValue() : CInt->getZExtValue(),
122122
/*isSigned=*/SignExt);
123-
#else
124-
unsigned BitWidth = getPromotedType(C->getType())->getIntegerBitWidth();
125-
const APInt &Value = CInt->getValue();
126-
return ConstantInt::get(C->getContext(),
127-
SignExt ? Value.sext(BitWidth) : Value.zext(BitWidth));
128-
#endif
129123
} else {
130124
errs() << "Value: " << *C << "\n";
131125
report_fatal_error("Unexpected constant value");
132126
}
127+
#else
128+
Type *ProTy = getPromotedType(C->getType());
129+
return SignExt ?
130+
ConstantExpr::getSExt(C, ProTy) :
131+
ConstantExpr::getZExt(C, ProTy);
132+
#endif
133133
}
134134

135135
namespace {

0 commit comments

Comments
 (0)