Skip to content

Commit 032ac76

Browse files
committed
Move CVP before instcombine in the pass pipeline
I was investigating why LLVM was unable to remove the boundscheck that was causing the test failure in #48066 and it turned out that the check was removable by instcombine, but only if cvp ran first. However, we ran the passes in the opposite order and then loop-rotated the condition away before instcombine ran again. I think it makes sense to run cvp before instcombine to make sure that instcombine can make use of the overflow flags inferred by cvp. For the particular case in #48066, we also need https://reviews.llvm.org/D140933 (and we may need it in general, since we like to emit our conditionals as negations), but overall this seems like a better place for cvp in our pass pipeline.
1 parent 7a561bd commit 032ac76

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/aotcompile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,16 +863,16 @@ void addOptimizationPasses(legacy::PassManagerBase *PM, int opt_level,
863863
// merging the `alloca` for the unboxed data and the `alloca` created by the `alloc_opt`
864864
// pass.
865865
PM->add(createAllocOptPass());
866+
PM->add(createInstSimplifyLegacyPass());
867+
PM->add(createJumpThreadingPass());
868+
PM->add(createCorrelatedValuePropagationPass());
869+
PM->add(createCFGSimplificationPass(basicSimplifyCFGOptions));
866870
// consider AggressiveInstCombinePass at optlevel > 2
867871
PM->add(createInstructionCombiningPass());
868-
PM->add(createCFGSimplificationPass(basicSimplifyCFGOptions));
869872
if (dump_native)
870873
PM->add(createMultiVersioningPass(external_use));
871874
PM->add(createCPUFeaturesPass());
872875
PM->add(createSROAPass());
873-
PM->add(createInstSimplifyLegacyPass());
874-
PM->add(createJumpThreadingPass());
875-
PM->add(createCorrelatedValuePropagationPass());
876876

877877
PM->add(createReassociatePass());
878878

0 commit comments

Comments
 (0)