Index: lib/IR/ConstantFold.cpp =================================================================== --- lib/IR/ConstantFold.cpp +++ lib/IR/ConstantFold.cpp @@ -998,9 +998,16 @@ return C1; // undef << X -> 0 return Constant::getNullValue(C1->getType()); + default: + // We don't know how to handle UNDEFs in this instruction. + return nullptr; } } + // At this point neither constant should be an UndefValue. + assert(!isa(C1) && !isa(C2) && + "Unexpected UndefValue"); + // Handle simplifications when the RHS is a constant int. if (ConstantInt *CI2 = dyn_cast(C2)) { switch (Opcode) { @@ -1102,7 +1109,6 @@ return ConstantExpr::get(Opcode, C2, C1); } - // At this point we know neither constant is an UndefValue. if (ConstantInt *CI1 = dyn_cast(C1)) { if (ConstantInt *CI2 = dyn_cast(C2)) { const APInt &C1V = CI1->getValue();