Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[adce] is non deterministic #38695

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR39723
Status NEW
Importance P normal
Reported by Yann Laigle-Chapuy (yannlaiglechapuy@gmail.com)
Reported on 2018-11-20 08:49:36 -0800
Last modified on 2018-11-21 16:44:41 -0800
Version trunk
Hardware PC All
CC dblaikie@gmail.com, dcallahan@fb.com, hfinkel@anl.gov, llvm-bugs@lists.llvm.org, mikael.holmen@ericsson.com
Fixed by commit(s)
Attachments adce.ll (2568 bytes, text/plain)
Blocks
Blocked by
See also
Created attachment 21134
reduced test case

With the file attached ( adce.ll )

$ (for i in `seq 50`; do opt -adce -o - < red_adce.ll | shasum; done) | sort -u
| wc -l
2
Quuxplusone commented 5 years ago

Attached adce.ll (2568 bytes, text/plain): reduced test case

Quuxplusone commented 5 years ago
This might come from the iteration over a SmallPtrSet.

More precisely:

class AggressiveDeadCodeElimination {
    …
    SmallPtrSet<BasicBlock *, 16> BlocksWithDeadTerminators;
    …
};

void AggressiveDeadCodeElimination::updateDeadRegions() {
…
    for (auto *BB : BlocksWithDeadTerminators) {
        …
        makeUnconditional(BB, PreferredSucc->BB);
        …
    }
...
}
Quuxplusone commented 5 years ago

Might try replacing it with a SmallSetVector?

Quuxplusone commented 5 years ago
Seems plausible & worth an experiment.

As far as I got was that the textual IR difference is minimal - just in the
predecessor list:

29c29
< bb9:                                              ; preds = %bb8, %bb7
---
> bb9:                                              ; preds = %bb7, %bb8