[llvm] r286975 - Revert "[JumpThreading] Prevent non-deterministic use lists"
Pablo Barrio via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 07:42:18 PST 2016
Author: pabbar01
Date: Tue Nov 15 09:42:17 2016
New Revision: 286975
URL: http://llvm.org/viewvc/llvm-project?rev=286975&view=rev
Log:
Revert "[JumpThreading] Prevent non-deterministic use lists"
This reverts commit f2c2f5354070469dac253373c66527ca971ddc66.
Modified:
llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=286975&r1=286974&r2=286975&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue Nov 15 09:42:17 2016
@@ -2042,18 +2042,19 @@ bool JumpThreadingPass::TryToUnfoldSelec
// Look for scalar booleans used in selects as conditions. If there are
// several selects that use the same boolean, they are candidates for jump
// threading and therefore we should unfold them.
- for (Use& U : I.uses()) {
- auto *SI = dyn_cast<SelectInst>(U.getUser());
- if (SI && U.getOperandNo() == 0)
+ for (Value *U : I.users())
+ if (auto *SI = dyn_cast<SelectInst>(U))
Selects.push_back(SI);
- }
-
if (Selects.size() <= 1)
continue;
+ // Remove duplicates
+ std::sort(Selects.begin(), Selects.end());
+ auto NewEnd = std::unique(Selects.begin(), Selects.end());
+
Changed = true;
- for (auto SI : Selects)
- expandSelect(SI);
+ for (auto SI = Selects.begin(); SI != NewEnd; ++SI)
+ expandSelect(*SI);
}
}
More information about the llvm-commits
mailing list