aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-03-28 10:39:48 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-03-28 10:39:48 -0700
commit683aaef9c7a20fd10f132ae2fb118f5edd1c0b58 (patch)
tree1664d6a3e19ef9a2146373b8a602be8d3913eb83
parent9901f6970fb393d63b606624b1fce828ada7c7e3 (diff)
expand constantExprs for all illegal values, not just >=64bit, so that things like nested i24 CEs are fixed up by promoteIntegers
-rw-r--r--lib/Transforms/NaCl/ExpandConstantExpr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/NaCl/ExpandConstantExpr.cpp b/lib/Transforms/NaCl/ExpandConstantExpr.cpp
index 75098a1572..c4cf75279b 100644
--- a/lib/Transforms/NaCl/ExpandConstantExpr.cpp
+++ b/lib/Transforms/NaCl/ExpandConstantExpr.cpp
@@ -58,7 +58,10 @@ static Value *expandConstantExpr(Instruction *InsertPt, ConstantExpr *Expr) {
// XXX Emscripten: Utilities for illegal expressions.
static bool isIllegal(Type *T) {
- return T->isIntegerTy() && T->getIntegerBitWidth() > 32;
+ if (!T->isIntegerTy()) return false;
+ unsigned Bits = T->getIntegerBitWidth();
+ // we need to expand out not just 64-bit and larger values, but also i24s, so PromoteIntegers can process them
+ return Bits != 1 && Bits != 8 && Bits != 16 && Bits != 32;
}
static bool ContainsIllegalTypes(const Value *Expr) {
if (isIllegal(Expr->getType()))