[llvm] [ValueTracking] Filter out non-interesting conditions (PR #118493)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 7 00:58:11 PST 2024


================
@@ -18,18 +18,34 @@
 #define LLVM_ANALYSIS_DOMCONDITIONCACHE_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/BitmaskEnum.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
+#include <cstdint>
 
 namespace llvm {
 
 class Value;
 class BranchInst;
 
+enum class DomConditionFlag : uint8_t {
+  None = 0,
+  KnownBits = 1 << 0,
+  KnownFPClass = 1 << 1,
+  PowerOfTwo = 1 << 2,
+  ICmp = 1 << 3,
+};
+
+LLVM_DECLARE_ENUM_AS_BITMASK(
+    DomConditionFlag,
+    /*LargestValue=*/static_cast<uint8_t>(DomConditionFlag::ICmp));
+
 class DomConditionCache {
 private:
   /// A map of values about which a branch might be providing information.
-  using AffectedValuesMap = DenseMap<Value *, SmallVector<BranchInst *, 1>>;
+  using AffectedValuesMap =
----------------
andjo403 wrote:

hmm noticed now that you mentioned that it was the calls to registerBranch that was the problem in  https://github.com/llvm/llvm-project/pull/117442#discussion_r1855839736 and this will result in more work then.
but if it is the registerBranch that is the problem I assume that any filtering added will result in worse compile time.

https://github.com/llvm/llvm-project/pull/118493


More information about the llvm-commits mailing list