[PATCH] D26450: [JumpThreading] Prevent non-deterministic use lists
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 9 12:55:56 PST 2016
efriedma added a comment.
Yes, it's kind of hard to write a good unit-test for determinism, precisely because it isn't deterministic. Maybe you could try something with opt -preserve-ll-uselistorder. If you can't come up with something that makes sense, don't worry about it.
================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:2048
if (auto *SI = dyn_cast<SelectInst>(U))
- Selects.push_back(SI);
+ Selects.insert(SI);
if (Selects.size() <= 1)
----------------
Looking at this a bit closer, there's another way you could write this: you can check whether the use is the condition of a select. Something like:
for (Use& U : I.uses()) {
auto *SI = dyn_cast<SelectInst>(U.getUser());
if (SI && U.getOperandNo() == 0)
Selects.push_back(SI);
}
That naturally avoids duplicates, and is probably a bit closer to your original intent.
https://reviews.llvm.org/D26450
More information about the llvm-commits
mailing list