diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-29 11:24:45 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-29 11:24:45 -0800 |
commit | bc9762214128743353e01a4115f9824a9a70ecc5 (patch) | |
tree | 97f2664a18b97bb950bd0482264737ac14bd66ef | |
parent | 367115837d692e9ed9fb3790a1762ec80c38a8d4 (diff) |
handle constants of >64 bits in legalizer
-rw-r--r-- | lib/Transforms/NaCl/ExpandI64.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Transforms/NaCl/ExpandI64.cpp b/lib/Transforms/NaCl/ExpandI64.cpp index 2a9761ab05..22cd917f30 100644 --- a/lib/Transforms/NaCl/ExpandI64.cpp +++ b/lib/Transforms/NaCl/ExpandI64.cpp @@ -696,19 +696,27 @@ void ExpandI64::splitInst(Instruction *I, DataLayout& DL) { ChunksVec ExpandI64::getChunks(Value *V) { Type *i32 = Type::getInt32Ty(V->getContext()); + Value *Zero = ConstantInt::get(i32, 0); + + int Num = getNumChunks(V->getType()); + if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) { uint64_t C = CI->getZExtValue(); ChunksVec Chunks; Chunks.push_back(ConstantInt::get(i32, (uint32_t)C)); Chunks.push_back(ConstantInt::get(i32, (uint32_t)(C >> 32))); + for (int i = 2; i < Num; i++) { + Chunks.push_back(Zero); + } return Chunks; } else if (Instruction *I = dyn_cast<Instruction>(V)) { assert(Splits.find(I) != Splits.end()); return Splits[I].Chunks; } else if (isa<UndefValue>(V)) { ChunksVec Chunks; - Chunks.push_back(ConstantInt::get(i32, 0)); - Chunks.push_back(ConstantInt::get(i32, 0)); + for (int i = 0; i < Num; i++) { + Chunks.push_back(Zero); + } return Chunks; } else { assert(SplitArgs.find(V) != SplitArgs.end()); |