1
- // ===--- ExpandFp.cpp - Expand fp instructions ----------------===//
1
+ // ===--- ExpandFp.cpp - Expand fp instructions ---------------------------- ===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
@@ -36,9 +36,9 @@ using namespace llvm;
36
36
37
37
static cl::opt<unsigned >
38
38
ExpandFpConvertBits (" expand-fp-convert-bits" , cl::Hidden,
39
- cl::init (llvm::IntegerType::MAX_INT_BITS),
40
- cl::desc(" fp convert instructions on integers with "
41
- " more than <N> bits are expanded." ));
39
+ cl::init (llvm::IntegerType::MAX_INT_BITS),
40
+ cl::desc(" fp convert instructions on integers with "
41
+ " more than <N> bits are expanded." ));
42
42
43
43
namespace {
44
44
// / This class implements a precise expansion of the frem instruction.
@@ -435,8 +435,8 @@ static bool expandFRem(BinaryOperator &I) {
435
435
// / br i1 %cmp6.not, label %if.end12, label %if.then8
436
436
// /
437
437
// / if.then8: ; preds = %if.end
438
- // / %cond11 = select i1 %tobool.not, i64 9223372036854775807, i64 -9223372036854775808
439
- // / br label %cleanup
438
+ // / %cond11 = select i1 %tobool.not, i64 9223372036854775807, i64
439
+ // / -9223372036854775808 br label %cleanup
440
440
// /
441
441
// / if.end12: ; preds = %if.end
442
442
// / %cmp13 = icmp ult i64 %shr, 150
@@ -454,9 +454,10 @@ static bool expandFRem(BinaryOperator &I) {
454
454
// / %mul19 = mul nsw i64 %shl, %conv
455
455
// / br label %cleanup
456
456
// /
457
- // / cleanup: ; preds = %entry, %if.else, %if.then15, %if.then8
458
- // / %retval.0 = phi i64 [ %cond11, %if.then8 ], [ %mul, %if.then15 ], [ %mul19, %if.else ], [ 0, %entry ]
459
- // / ret i64 %retval.0
457
+ // / cleanup: ; preds = %entry,
458
+ // / %if.else, %if.then15, %if.then8
459
+ // / %retval.0 = phi i64 [ %cond11, %if.then8 ], [ %mul, %if.then15 ], [
460
+ // / %mul19, %if.else ], [ 0, %entry ] ret i64 %retval.0
460
461
// / }
461
462
// /
462
463
// / Replace fp to integer with generated code.
@@ -640,13 +641,11 @@ static void expandFPToI(Instruction *FPToI) {
640
641
// / %or = or i64 %shr6, %conv11
641
642
// / br label %sw.epilog
642
643
// /
643
- // / sw.epilog: ; preds = %sw.default, %if.then4, %sw.bb
644
- // / %a.addr.0 = phi i64 [ %or, %sw.default ], [ %sub, %if.then4 ], [ %shl, %sw.bb ]
645
- // / %1 = lshr i64 %a.addr.0, 2
646
- // / %2 = and i64 %1, 1
647
- // / %or16 = or i64 %2, %a.addr.0
648
- // / %inc = add nsw i64 %or16, 1
649
- // / %3 = and i64 %inc, 67108864
644
+ // / sw.epilog: ; preds = %sw.default,
645
+ // / %if.then4, %sw.bb
646
+ // / %a.addr.0 = phi i64 [ %or, %sw.default ], [ %sub, %if.then4 ], [ %shl,
647
+ // / %sw.bb ] %1 = lshr i64 %a.addr.0, 2 %2 = and i64 %1, 1 %or16 = or i64 %2,
648
+ // / %a.addr.0 %inc = add nsw i64 %or16, 1 %3 = and i64 %inc, 67108864
650
649
// / %tobool.not = icmp eq i64 %3, 0
651
650
// / %spec.select.v = select i1 %tobool.not, i64 2, i64 3
652
651
// / %spec.select = ashr i64 %inc, %spec.select.v
@@ -659,7 +658,8 @@ static void expandFPToI(Instruction *FPToI) {
659
658
// / %shl25 = shl i64 %sub, %sh_prom24
660
659
// / br label %if.end26
661
660
// /
662
- // / if.end26: ; preds = %sw.epilog, %if.else
661
+ // / if.end26: ; preds = %sw.epilog,
662
+ // / %if.else
663
663
// / %a.addr.1 = phi i64 [ %shl25, %if.else ], [ %spec.select, %sw.epilog ]
664
664
// / %e.0 = phi i32 [ %sub2, %if.else ], [ %spec.select56, %sw.epilog ]
665
665
// / %conv27 = trunc i64 %shr to i32
@@ -673,7 +673,8 @@ static void expandFPToI(Instruction *FPToI) {
673
673
// / %4 = bitcast i32 %or33 to float
674
674
// / br label %return
675
675
// /
676
- // / return: ; preds = %entry, %if.end26
676
+ // / return: ; preds = %entry,
677
+ // / %if.end26
677
678
// / %retval.0 = phi float [ %4, %if.end26 ], [ 0.000000e+00, %entry ]
678
679
// / ret float %retval.0
679
680
// / }
@@ -1052,8 +1053,7 @@ class ExpandFpLegacyPass : public FunctionPass {
1052
1053
static char ID;
1053
1054
1054
1055
ExpandFpLegacyPass () : FunctionPass(ID) {
1055
- initializeExpandFpLegacyPassPass (
1056
- *PassRegistry::getPassRegistry ());
1056
+ initializeExpandFpLegacyPassPass (*PassRegistry::getPassRegistry ());
1057
1057
}
1058
1058
1059
1059
bool runOnFunction (Function &F) override {
@@ -1070,8 +1070,7 @@ class ExpandFpLegacyPass : public FunctionPass {
1070
1070
};
1071
1071
} // namespace
1072
1072
1073
- PreservedAnalyses ExpandFpPass::run (Function &F,
1074
- FunctionAnalysisManager &FAM) {
1073
+ PreservedAnalyses ExpandFpPass::run (Function &F, FunctionAnalysisManager &FAM) {
1075
1074
const TargetSubtargetInfo *STI = TM->getSubtargetImpl (F);
1076
1075
return runImpl (F, *STI->getTargetLowering ()) ? PreservedAnalyses::none ()
1077
1076
: PreservedAnalyses::all ();
@@ -1080,9 +1079,6 @@ PreservedAnalyses ExpandFpPass::run(Function &F,
1080
1079
char ExpandFpLegacyPass::ID = 0 ;
1081
1080
INITIALIZE_PASS_BEGIN (ExpandFpLegacyPass, " expand-fp" ,
1082
1081
" Expand certain fp instructions" , false , false )
1083
- INITIALIZE_PASS_END(ExpandFpLegacyPass, " expand-fp" ,
1084
- " Expand fp" , false , false )
1082
+ INITIALIZE_PASS_END(ExpandFpLegacyPass, " expand-fp" , " Expand fp" , false , false )
1085
1083
1086
- FunctionPass *llvm::createExpandFpPass() {
1087
- return new ExpandFpLegacyPass ();
1088
- }
1084
+ FunctionPass *llvm::createExpandFpPass() { return new ExpandFpLegacyPass (); }
0 commit comments