File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -5248,7 +5248,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
5248
5248
return error (
5249
5249
" Invalid record: operand number exceeded available operands" );
5250
5250
5251
- unsigned PredVal = Record[OpNum];
5251
+ CmpInst::Predicate PredVal = CmpInst::Predicate ( Record[OpNum]) ;
5252
5252
bool IsFP = LHS->getType ()->isFPOrFPVectorTy ();
5253
5253
FastMathFlags FMF;
5254
5254
if (IsFP && Record.size () > OpNum+1 )
@@ -5257,10 +5257,15 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
5257
5257
if (OpNum+1 != Record.size ())
5258
5258
return error (" Invalid record" );
5259
5259
5260
- if (LHS->getType ()->isFPOrFPVectorTy ())
5261
- I = new FCmpInst ((FCmpInst::Predicate)PredVal, LHS, RHS);
5262
- else
5263
- I = new ICmpInst ((ICmpInst::Predicate)PredVal, LHS, RHS);
5260
+ if (IsFP) {
5261
+ if (!CmpInst::isFPPredicate (PredVal))
5262
+ return error (" Invalid fcmp predicate" );
5263
+ I = new FCmpInst (PredVal, LHS, RHS);
5264
+ } else {
5265
+ if (!CmpInst::isIntPredicate (PredVal))
5266
+ return error (" Invalid icmp predicate" );
5267
+ I = new ICmpInst (PredVal, LHS, RHS);
5268
+ }
5264
5269
5265
5270
ResTypeID = getVirtualTypeID (I->getType ()->getScalarType ());
5266
5271
if (LHS->getType ()->isVectorTy ())
You can’t perform that action at this time.
0 commit comments