|
45 | 45 | using namespace llvm; |
46 | 46 |
|
47 | 47 | static cl::opt<bool> |
48 | | -DisablePromotion("disable-type-promotion", cl::Hidden, cl::init(false), |
| 48 | +DisablePromotion("disable-type-promotion", cl::Hidden, cl::init(true), |
49 | 49 | cl::desc("Disable type promotion pass")); |
50 | 50 |
|
51 | 51 | // The goal of this pass is to enable more efficient code generation for |
@@ -899,34 +899,16 @@ bool TypePromotion::TryToPromote(Value *V, unsigned PromotedWidth) { |
899 | 899 | for (auto *I : CurrentVisited) |
900 | 900 | I->dump(); |
901 | 901 | ); |
902 | | - |
903 | | - // Check that promoting this at the IR level is most likely beneficial. It's |
904 | | - // more likely if we're operating over multiple blocks and handling wrapping |
905 | | - // instructions. |
906 | 902 | unsigned ToPromote = 0; |
907 | | - unsigned NonFreeArgs = 0; |
908 | | - SmallPtrSet<BasicBlock*, 4> Blocks; |
909 | 903 | for (auto *V : CurrentVisited) { |
910 | | - if (auto *I = dyn_cast<Instruction>(V)) |
911 | | - Blocks.insert(I->getParent()); |
912 | | - |
913 | | - if (Sources.count(V)) { |
914 | | - if (auto *Arg = dyn_cast<Argument>(V)) { |
915 | | - if (!Arg->hasZExtAttr() && !Arg->hasSExtAttr()) |
916 | | - ++NonFreeArgs; |
917 | | - } |
| 904 | + if (Sources.count(V)) |
918 | 905 | continue; |
919 | | - } |
920 | | - |
921 | 906 | if (Sinks.count(cast<Instruction>(V))) |
922 | 907 | continue; |
923 | | - |
924 | 908 | ++ToPromote; |
925 | 909 | } |
926 | 910 |
|
927 | | - // DAG optimisations should be able to handle these cases better, especially |
928 | | - // for function arguments. |
929 | | - if (ToPromote < 2 || (Blocks.size() == 1 && (NonFreeArgs > SafeWrap.size()))) |
| 911 | + if (ToPromote < 2) |
930 | 912 | return false; |
931 | 913 |
|
932 | 914 | Promoter->Mutate(OrigTy, PromotedWidth, CurrentVisited, Sources, Sinks, |
|
0 commit comments