@@ -6431,8 +6431,10 @@ bool CodeGenPrepare::optimizeUMulWithOverflow(Instruction *I) {
6431
6431
unsigned VTHalfBitWidth = VTBitWidth / 2 ;
6432
6432
auto *LegalTy = IntegerType::getIntNTy (I->getContext (), VTHalfBitWidth);
6433
6433
6434
- // Skip the optimizaiton if the type with HalfBitWidth is not legal for the target.
6435
- if (TLI->getTypeAction (I->getContext (), TLI->getValueType (*DL, LegalTy)) != TargetLowering::TypeLegal)
6434
+ // Skip the optimizaiton if the type with HalfBitWidth is not legal for the
6435
+ // target.
6436
+ if (TLI->getTypeAction (I->getContext (), TLI->getValueType (*DL, LegalTy)) !=
6437
+ TargetLowering::TypeLegal)
6436
6438
return false ;
6437
6439
6438
6440
I->getParent ()->setName (" overflow.res" );
@@ -6463,9 +6465,9 @@ bool CodeGenPrepare::optimizeUMulWithOverflow(Instruction *I) {
6463
6465
auto *HiLHS = Builder.CreateTrunc (ShrHiLHS, LegalTy, " hi.lhs.trunc" );
6464
6466
6465
6467
auto *CmpLHS = Builder.CreateCmp (ICmpInst::ICMP_NE, HiLHS,
6466
- ConstantInt::getNullValue (LegalTy));
6468
+ ConstantInt::getNullValue (LegalTy));
6467
6469
auto *CmpRHS = Builder.CreateCmp (ICmpInst::ICMP_NE, HiRHS,
6468
- ConstantInt::getNullValue (LegalTy));
6470
+ ConstantInt::getNullValue (LegalTy));
6469
6471
auto *Or = Builder.CreateOr (CmpLHS, CmpRHS, " or.lhs.rhs" );
6470
6472
Builder.CreateCondBr (Or, OverflowBB, NoOverflowBB);
6471
6473
OverflowoEntryBB->getTerminator ()->eraseFromParent ();
@@ -6476,14 +6478,14 @@ bool CodeGenPrepare::optimizeUMulWithOverflow(Instruction *I) {
6476
6478
auto *ExtLoLHS = Builder.CreateZExt (LoLHS, Ty, " lo.lhs.ext" );
6477
6479
auto *ExtLoRHS = Builder.CreateZExt (LoRHS, Ty, " lo.rhs.ext" );
6478
6480
auto *Mul = Builder.CreateMul (ExtLoLHS, ExtLoRHS, " mul.no.overflow" );
6479
- StructType *STy = StructType::get (I-> getContext (),
6480
- {Ty, IntegerType::getInt1Ty (I->getContext ())});
6481
+ StructType *STy = StructType::get (
6482
+ I-> getContext (), {Ty, IntegerType::getInt1Ty (I->getContext ())});
6481
6483
Value *StructValNoOverflow = PoisonValue::get (STy);
6482
6484
StructValNoOverflow =
6483
- Builder.CreateInsertValue (StructValNoOverflow, Mul, {0 });
6485
+ Builder.CreateInsertValue (StructValNoOverflow, Mul, {0 });
6484
6486
StructValNoOverflow = Builder.CreateInsertValue (
6485
6487
StructValNoOverflow, ConstantInt::getFalse (I->getContext ()), {1 });
6486
- Builder.CreateBr (OverflowResBB);
6488
+ Builder.CreateBr (OverflowResBB);
6487
6489
6488
6490
// ------------------------------------------------------------------------------
6489
6491
// BB overflow.res:
@@ -6528,8 +6530,10 @@ bool CodeGenPrepare::optimizeSMulWithOverflow(Instruction *I) {
6528
6530
unsigned VTHalfBitWidth = VTBitWidth / 2 ;
6529
6531
auto *LegalTy = IntegerType::getIntNTy (I->getContext (), VTHalfBitWidth);
6530
6532
6531
- // Skip the optimizaiton if the type with HalfBitWidth is not legal for the target.
6532
- if (TLI->getTypeAction (I->getContext (), TLI->getValueType (*DL, LegalTy)) != TargetLowering::TypeLegal)
6533
+ // Skip the optimizaiton if the type with HalfBitWidth is not legal for the
6534
+ // target.
6535
+ if (TLI->getTypeAction (I->getContext (), TLI->getValueType (*DL, LegalTy)) !=
6536
+ TargetLowering::TypeLegal)
6533
6537
return false ;
6534
6538
6535
6539
I->getParent ()->setName (" overflow.res" );
@@ -6554,13 +6558,13 @@ bool CodeGenPrepare::optimizeSMulWithOverflow(Instruction *I) {
6554
6558
IRBuilder<> Builder (OverflowoEntryBB->getTerminator ());
6555
6559
auto *LoRHS = Builder.CreateTrunc (RHS, LegalTy, " lo.rhs" );
6556
6560
auto *SignLoRHS =
6557
- Builder.CreateAShr (LoRHS, VTHalfBitWidth - 1 , " sign.lo.rhs" );
6561
+ Builder.CreateAShr (LoRHS, VTHalfBitWidth - 1 , " sign.lo.rhs" );
6558
6562
auto *HiRHS = Builder.CreateLShr (RHS, VTHalfBitWidth, " rhs.lsr" );
6559
6563
HiRHS = Builder.CreateTrunc (HiRHS, LegalTy, " hi.rhs" );
6560
6564
6561
6565
auto *LoLHS = Builder.CreateTrunc (LHS, LegalTy, " lo.lhs" );
6562
6566
auto *SignLoLHS =
6563
- Builder.CreateAShr (LoLHS, VTHalfBitWidth - 1 , " sign.lo.lhs" );
6567
+ Builder.CreateAShr (LoLHS, VTHalfBitWidth - 1 , " sign.lo.lhs" );
6564
6568
auto *HiLHS = Builder.CreateLShr (LHS, VTHalfBitWidth, " lhs.lsr" );
6565
6569
HiLHS = Builder.CreateTrunc (HiLHS, LegalTy, " hi.lhs" );
6566
6570
@@ -6576,14 +6580,14 @@ bool CodeGenPrepare::optimizeSMulWithOverflow(Instruction *I) {
6576
6580
auto *ExtLoLHS = Builder.CreateSExt (LoLHS, Ty, " lo.lhs.ext" );
6577
6581
auto *ExtLoRHS = Builder.CreateSExt (LoRHS, Ty, " lo.rhs.ext" );
6578
6582
auto *Mul = Builder.CreateMul (ExtLoLHS, ExtLoRHS, " mul.no.overflow" );
6579
- StructType * STy = StructType::get (I-> getContext (),
6580
- {Ty, IntegerType::getInt1Ty (I->getContext ())});
6583
+ StructType *STy = StructType::get (
6584
+ I-> getContext (), {Ty, IntegerType::getInt1Ty (I->getContext ())});
6581
6585
Value *StructValNoOverflow = PoisonValue::get (STy);
6582
6586
StructValNoOverflow =
6583
- Builder.CreateInsertValue (StructValNoOverflow, Mul, {0 });
6587
+ Builder.CreateInsertValue (StructValNoOverflow, Mul, {0 });
6584
6588
StructValNoOverflow = Builder.CreateInsertValue (
6585
6589
StructValNoOverflow, ConstantInt::getFalse (I->getContext ()), {1 });
6586
- Builder.CreateBr (OverflowResBB);
6590
+ Builder.CreateBr (OverflowResBB);
6587
6591
6588
6592
// ------------------------------------------------------------------------------
6589
6593
// BB overflow.res:
0 commit comments