Skip to content

Commit f0a787b

Browse files
authored
[DFAJumpThreading] Set MadeChanges only if threading happened (#162241)
Threading may fail due to legality and profitability checks. This patch preserves the analysis if no threading happens.
1 parent b178821 commit f0a787b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -820,11 +820,13 @@ struct TransformDFA {
820820
: SwitchPaths(SwitchPaths), DT(DT), AC(AC), TTI(TTI), ORE(ORE),
821821
EphValues(EphValues) {}
822822

823-
void run() {
823+
bool run() {
824824
if (isLegalAndProfitableToTransform()) {
825825
createAllExitPaths();
826826
NumTransforms++;
827+
return true;
827828
}
829+
return false;
828830
}
829831

830832
private:
@@ -1426,9 +1428,8 @@ bool DFAJumpThreading::run(Function &F) {
14261428

14271429
for (AllSwitchPaths SwitchPaths : ThreadableLoops) {
14281430
TransformDFA Transform(&SwitchPaths, DT, AC, TTI, ORE, EphValues);
1429-
Transform.run();
1430-
MadeChanges = true;
1431-
LoopInfoBroken = true;
1431+
if (Transform.run())
1432+
MadeChanges = LoopInfoBroken = true;
14321433
}
14331434

14341435
#ifdef EXPENSIVE_CHECKS

0 commit comments

Comments
 (0)