@@ -6417,8 +6417,10 @@ bool CodeGenPrepare::optimizeUMulWithOverflow(Instruction *I) {
6417
6417
unsigned VTHalfBitWidth = VTBitWidth / 2 ;
6418
6418
auto *LegalTy = IntegerType::getIntNTy (I->getContext (), VTHalfBitWidth);
6419
6419
6420
- // Skip the optimizaiton if the type with HalfBitWidth is not legal for the target.
6421
- if (TLI->getTypeAction (I->getContext (), TLI->getValueType (*DL, LegalTy)) != TargetLowering::TypeLegal)
6420
+ // Skip the optimizaiton if the type with HalfBitWidth is not legal for the
6421
+ // target.
6422
+ if (TLI->getTypeAction (I->getContext (), TLI->getValueType (*DL, LegalTy)) !=
6423
+ TargetLowering::TypeLegal)
6422
6424
return false ;
6423
6425
6424
6426
I->getParent ()->setName (" overflow.res" );
@@ -6449,9 +6451,9 @@ bool CodeGenPrepare::optimizeUMulWithOverflow(Instruction *I) {
6449
6451
auto *HiLHS = Builder.CreateTrunc (ShrHiLHS, LegalTy, " hi.lhs.trunc" );
6450
6452
6451
6453
auto *CmpLHS = Builder.CreateCmp (ICmpInst::ICMP_NE, HiLHS,
6452
- ConstantInt::getNullValue (LegalTy));
6454
+ ConstantInt::getNullValue (LegalTy));
6453
6455
auto *CmpRHS = Builder.CreateCmp (ICmpInst::ICMP_NE, HiRHS,
6454
- ConstantInt::getNullValue (LegalTy));
6456
+ ConstantInt::getNullValue (LegalTy));
6455
6457
auto *Or = Builder.CreateOr (CmpLHS, CmpRHS, " or.lhs.rhs" );
6456
6458
Builder.CreateCondBr (Or, OverflowBB, NoOverflowBB);
6457
6459
OverflowoEntryBB->getTerminator ()->eraseFromParent ();
@@ -6462,14 +6464,14 @@ bool CodeGenPrepare::optimizeUMulWithOverflow(Instruction *I) {
6462
6464
auto *ExtLoLHS = Builder.CreateZExt (LoLHS, Ty, " lo.lhs.ext" );
6463
6465
auto *ExtLoRHS = Builder.CreateZExt (LoRHS, Ty, " lo.rhs.ext" );
6464
6466
auto *Mul = Builder.CreateMul (ExtLoLHS, ExtLoRHS, " mul.no.overflow" );
6465
- StructType *STy = StructType::get (I-> getContext (),
6466
- {Ty, IntegerType::getInt1Ty (I->getContext ())});
6467
+ StructType *STy = StructType::get (
6468
+ I-> getContext (), {Ty, IntegerType::getInt1Ty (I->getContext ())});
6467
6469
Value *StructValNoOverflow = PoisonValue::get (STy);
6468
6470
StructValNoOverflow =
6469
- Builder.CreateInsertValue (StructValNoOverflow, Mul, {0 });
6471
+ Builder.CreateInsertValue (StructValNoOverflow, Mul, {0 });
6470
6472
StructValNoOverflow = Builder.CreateInsertValue (
6471
6473
StructValNoOverflow, ConstantInt::getFalse (I->getContext ()), {1 });
6472
- Builder.CreateBr (OverflowResBB);
6474
+ Builder.CreateBr (OverflowResBB);
6473
6475
6474
6476
// ------------------------------------------------------------------------------
6475
6477
// BB overflow.res:
@@ -6514,8 +6516,10 @@ bool CodeGenPrepare::optimizeSMulWithOverflow(Instruction *I) {
6514
6516
unsigned VTHalfBitWidth = VTBitWidth / 2 ;
6515
6517
auto *LegalTy = IntegerType::getIntNTy (I->getContext (), VTHalfBitWidth);
6516
6518
6517
- // Skip the optimizaiton if the type with HalfBitWidth is not legal for the target.
6518
- if (TLI->getTypeAction (I->getContext (), TLI->getValueType (*DL, LegalTy)) != TargetLowering::TypeLegal)
6519
+ // Skip the optimizaiton if the type with HalfBitWidth is not legal for the
6520
+ // target.
6521
+ if (TLI->getTypeAction (I->getContext (), TLI->getValueType (*DL, LegalTy)) !=
6522
+ TargetLowering::TypeLegal)
6519
6523
return false ;
6520
6524
6521
6525
I->getParent ()->setName (" overflow.res" );
@@ -6540,13 +6544,13 @@ bool CodeGenPrepare::optimizeSMulWithOverflow(Instruction *I) {
6540
6544
IRBuilder<> Builder (OverflowoEntryBB->getTerminator ());
6541
6545
auto *LoRHS = Builder.CreateTrunc (RHS, LegalTy, " lo.rhs" );
6542
6546
auto *SignLoRHS =
6543
- Builder.CreateAShr (LoRHS, VTHalfBitWidth - 1 , " sign.lo.rhs" );
6547
+ Builder.CreateAShr (LoRHS, VTHalfBitWidth - 1 , " sign.lo.rhs" );
6544
6548
auto *HiRHS = Builder.CreateLShr (RHS, VTHalfBitWidth, " rhs.lsr" );
6545
6549
HiRHS = Builder.CreateTrunc (HiRHS, LegalTy, " hi.rhs" );
6546
6550
6547
6551
auto *LoLHS = Builder.CreateTrunc (LHS, LegalTy, " lo.lhs" );
6548
6552
auto *SignLoLHS =
6549
- Builder.CreateAShr (LoLHS, VTHalfBitWidth - 1 , " sign.lo.lhs" );
6553
+ Builder.CreateAShr (LoLHS, VTHalfBitWidth - 1 , " sign.lo.lhs" );
6550
6554
auto *HiLHS = Builder.CreateLShr (LHS, VTHalfBitWidth, " lhs.lsr" );
6551
6555
HiLHS = Builder.CreateTrunc (HiLHS, LegalTy, " hi.lhs" );
6552
6556
@@ -6562,14 +6566,14 @@ bool CodeGenPrepare::optimizeSMulWithOverflow(Instruction *I) {
6562
6566
auto *ExtLoLHS = Builder.CreateSExt (LoLHS, Ty, " lo.lhs.ext" );
6563
6567
auto *ExtLoRHS = Builder.CreateSExt (LoRHS, Ty, " lo.rhs.ext" );
6564
6568
auto *Mul = Builder.CreateMul (ExtLoLHS, ExtLoRHS, " mul.no.overflow" );
6565
- StructType * STy = StructType::get (I-> getContext (),
6566
- {Ty, IntegerType::getInt1Ty (I->getContext ())});
6569
+ StructType *STy = StructType::get (
6570
+ I-> getContext (), {Ty, IntegerType::getInt1Ty (I->getContext ())});
6567
6571
Value *StructValNoOverflow = PoisonValue::get (STy);
6568
6572
StructValNoOverflow =
6569
- Builder.CreateInsertValue (StructValNoOverflow, Mul, {0 });
6573
+ Builder.CreateInsertValue (StructValNoOverflow, Mul, {0 });
6570
6574
StructValNoOverflow = Builder.CreateInsertValue (
6571
6575
StructValNoOverflow, ConstantInt::getFalse (I->getContext ()), {1 });
6572
- Builder.CreateBr (OverflowResBB);
6576
+ Builder.CreateBr (OverflowResBB);
6573
6577
6574
6578
// ------------------------------------------------------------------------------
6575
6579
// BB overflow.res:
0 commit comments