[llvm-bugs] [Bug 42574] New: Non-deterministic result due to use of SmallPtrSet in llvm::removeUnreachableBlocks
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 10 23:05:42 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42574
Bug ID: 42574
Summary: Non-deterministic result due to use of SmallPtrSet in
llvm::removeUnreachableBlocks
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Transformation Utilities
Assignee: unassignedbugs at nondot.org
Reporter: mikael.holmen at ericsson.com
CC: llvm-bugs at lists.llvm.org
Created attachment 22222
--> https://bugs.llvm.org/attachment.cgi?id=22222&action=edit
reproducer
Running
opt -simplifycfg -o foo.ll in3.ll -S --preserve-ll-uselistorder
a number of times with a clang 8 built opt we see that the produced output
differs now and then like:
< uselistorder i16 0, { 2, 3, 4, 1, 5, 0, 6 }
---
> uselistorder i16 0, { 3, 2, 4, 1, 5, 0, 6 }
I think it's the DeadBlockSet that is the cause:
- // Loop over all of the basic blocks that are not reachable, dropping all of
- // their internal references. Update DTU and LVI if available.
- std::vector <DominatorTree::UpdateType> Updates;
+ SmallPtrSet<BasicBlock *, 16> DeadBlockSet;
As far as I can see, as long as a SmallPtrSet is "small", the iteration order
is deterministic (== insertion order), but I strongly suspect that when the set
grows to being "big", then it's not deterministic anymore.
DeadBlockSet as above was introduced in r339951:
Update MemorySSA in Local utils removing blocks.
Summary: Extend Local utils to update MemorySSA.
Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits
Differential Revision: https://reviews.llvm.org/D48790
llvm-svn: 339951
Later this caused SCEV and LSR in llc to draw different conclusions and
produce different code.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190711/bf60cd41/attachment.html>
More information about the llvm-bugs
mailing list