diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 87700284c48..adffe829202 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -915,8 +915,7 @@ bool BitcodeReader::ParseConstants() { dyn_cast_or_null(getTypeByID(Record[0])); if (OpTy == 0) return Error("Invalid CE_EXTRACTELT record"); Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy); - Constant *Op1 = ValueList.getConstantFwdRef(Record[2], - OpTy->getElementType()); + Constant *Op1 = ValueList.getConstantFwdRef(Record[2], Type::Int32Ty); V = ConstantExpr::getExtractElement(Op0, Op1); break; } diff --git a/test/Bitcode/extractelement.ll b/test/Bitcode/extractelement.ll new file mode 100644 index 00000000000..04cb131f6e7 --- /dev/null +++ b/test/Bitcode/extractelement.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -constprop | llvm-dis +; PR3465 + +define double @test() { + %tmp24 = extractelement <2 x double> bitcast (<1 x i128> < i128 85070591730234615870450834276742070272 > to <2 x double>), i32 0 + ret double %tmp24 +} +