[PATCH] D77699: [JumpThreading] NFC: Simplify ComputeValueKnownInPredecessorsImpl

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 19:05:09 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG91eb442fdef0: [JumpThreading] NFC: Simplify ComputeValueKnownInPredecessorsImpl (authored by kazu).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77699/new/

https://reviews.llvm.org/D77699

Files:
  llvm/include/llvm/Transforms/Scalar/JumpThreading.h
  llvm/lib/Transforms/Scalar/JumpThreading.cpp


Index: llvm/lib/Transforms/Scalar/JumpThreading.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -611,14 +611,13 @@
 /// This returns true if there were any known values.
 bool JumpThreadingPass::ComputeValueKnownInPredecessorsImpl(
     Value *V, BasicBlock *BB, PredValueInfo &Result,
-    ConstantPreference Preference,
-    DenseSet<std::pair<Value *, BasicBlock *>> &RecursionSet,
+    ConstantPreference Preference, DenseSet<Value *> &RecursionSet,
     Instruction *CxtI) {
   // This method walks up use-def chains recursively.  Because of this, we could
   // get into an infinite loop going around loops in the use-def chain.  To
   // prevent this, keep track of what (value, block) pairs we've already visited
   // and terminate the search if we loop back to them
-  if (!RecursionSet.insert(std::make_pair(V, BB)).second)
+  if (!RecursionSet.insert(V).second)
     return false;
 
   // If V is a constant, then it is known in all predecessors.
Index: llvm/include/llvm/Transforms/Scalar/JumpThreading.h
===================================================================
--- llvm/include/llvm/Transforms/Scalar/JumpThreading.h
+++ llvm/include/llvm/Transforms/Scalar/JumpThreading.h
@@ -128,14 +128,13 @@
   bool ComputeValueKnownInPredecessorsImpl(
       Value *V, BasicBlock *BB, jumpthreading::PredValueInfo &Result,
       jumpthreading::ConstantPreference Preference,
-      DenseSet<std::pair<Value *, BasicBlock *>> &RecursionSet,
-      Instruction *CxtI = nullptr);
+      DenseSet<Value *> &RecursionSet, Instruction *CxtI = nullptr);
   bool
   ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,
                                   jumpthreading::PredValueInfo &Result,
                                   jumpthreading::ConstantPreference Preference,
                                   Instruction *CxtI = nullptr) {
-    DenseSet<std::pair<Value *, BasicBlock *>> RecursionSet;
+    DenseSet<Value *> RecursionSet;
     return ComputeValueKnownInPredecessorsImpl(V, BB, Result, Preference,
                                                RecursionSet, CxtI);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77699.255880.patch
Type: text/x-patch
Size: 2223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200408/c3e08973/attachment.bin>


More information about the llvm-commits mailing list