Skip to content

Commit fa4e35a

Browse files
committed
fix a bitcode reader bug where it can't handle extractelement correctly:
the index of the value being extracted is always an i32. This fixes PR3465 llvm-svn: 63597
1 parent 6aa6b1f commit fa4e35a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,7 @@ bool BitcodeReader::ParseConstants() {
915915
dyn_cast_or_null<VectorType>(getTypeByID(Record[0]));
916916
if (OpTy == 0) return Error("Invalid CE_EXTRACTELT record");
917917
Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy);
918-
Constant *Op1 = ValueList.getConstantFwdRef(Record[2],
919-
OpTy->getElementType());
918+
Constant *Op1 = ValueList.getConstantFwdRef(Record[2], Type::Int32Ty);
920919
V = ConstantExpr::getExtractElement(Op0, Op1);
921920
break;
922921
}

llvm/test/Bitcode/extractelement.ll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
; RUN: llvm-as < %s | opt -constprop | llvm-dis
2+
; PR3465
3+
4+
define double @test() {
5+
%tmp24 = extractelement <2 x double> bitcast (<1 x i128> < i128 85070591730234615870450834276742070272 > to <2 x double>), i32 0
6+
ret double %tmp24
7+
}
8+

0 commit comments

Comments
 (0)