@@ -6399,7 +6399,7 @@ bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst,
63996399// Check the pattern we are interested in where there are maximum 2 uses
64006400// of the intrinsic which are the extract instructions.
64016401static bool matchOverflowPattern (Instruction *&I, ExtractValueInst *&MulExtract,
6402- ExtractValueInst *&OverflowExtract) {
6402+ ExtractValueInst *&OverflowExtract) {
64036403 if (I->getNumUses () > 2 )
64046404 return false ;
64056405
@@ -6413,7 +6413,8 @@ static bool matchOverflowPattern(Instruction *&I, ExtractValueInst *&MulExtract,
64136413 MulExtract = Extract;
64146414 else if (Index == 1 )
64156415 OverflowExtract = Extract;
6416- else return false ;
6416+ else
6417+ return false ;
64176418 }
64186419 return true ;
64196420}
@@ -6434,11 +6435,14 @@ static bool matchOverflowPattern(Instruction *&I, ExtractValueInst *&MulExtract,
64346435// overflow:
64356436// overflow.res:
64366437// \returns true if optimization was applied
6437- // TODO: This optimization can be further improved but it will get more complex, so we leave it for future work.
6438+ // TODO: This optimization can be further improved but it will get more complex,
6439+ // so we leave it for future work.
64386440bool CodeGenPrepare::optimizeMulWithOverflow (Instruction *I, bool IsSigned,
64396441 ModifyDT &ModifiedDT) {
64406442 // Check if target supports this optimization.
6441- if (!TLI->shouldOptimizeMulOverflowWithZeroHighBits (I->getContext (), TLI->getValueType (*DL, I->getType ()->getContainedType (0 ))))
6443+ if (!TLI->shouldOptimizeMulOverflowWithZeroHighBits (
6444+ I->getContext (),
6445+ TLI->getValueType (*DL, I->getType ()->getContainedType (0 ))))
64426446 return false ;
64436447
64446448 ExtractValueInst *MulExtract = nullptr , *OverflowExtract = nullptr ;
@@ -6459,7 +6463,8 @@ bool CodeGenPrepare::optimizeMulWithOverflow(Instruction *I, bool IsSigned,
64596463 std::string OriginalBlockName = I->getParent ()->getName ().str ();
64606464 BasicBlock *OverflowEntryBB =
64616465 I->getParent ()->splitBasicBlock (I, " overflow.entry" , /* Before*/ true );
6462- // Keep the 'br' instruction that is generated as a result of the split to be erased/replaced later.
6466+ // Keep the 'br' instruction that is generated as a result of the split to be
6467+ // erased/replaced later.
64636468 Instruction *OldTerminator = OverflowEntryBB->getTerminator ();
64646469 BasicBlock *NoOverflowBB =
64656470 BasicBlock::Create (I->getContext (), " overflow.no" , I->getFunction ());
@@ -6525,8 +6530,8 @@ bool CodeGenPrepare::optimizeMulWithOverflow(Instruction *I, bool IsSigned,
65256530
65266531 // BB overflow.res:
65276532 Builder.SetInsertPoint (OverflowResBB, OverflowResBB->getFirstInsertionPt ());
6528- // Create PHI nodes to merge results from no.overflow BB and overflow BB to replace the
6529- // extract instructions.
6533+ // Create PHI nodes to merge results from no.overflow BB and overflow BB to
6534+ // replace the extract instructions.
65306535 PHINode *OverflowResPHI = Builder.CreatePHI (Ty, 2 ),
65316536 *OverflowFlagPHI =
65326537 Builder.CreatePHI (IntegerType::getInt1Ty (I->getContext ()), 2 );
@@ -6546,7 +6551,8 @@ bool CodeGenPrepare::optimizeMulWithOverflow(Instruction *I, bool IsSigned,
65466551 OverflowExtract->eraseFromParent ();
65476552 }
65486553
6549- // Remove the intrinsic from parent (overflow.res BB) as it will be part of overflow BB
6554+ // Remove the intrinsic from parent (overflow.res BB) as it will be part of
6555+ // overflow BB
65506556 I->removeFromParent ();
65516557 // BB overflow:
65526558 I->insertInto (OverflowBB, OverflowBB->end ());
0 commit comments