Skip to content

Commit 8a9fa55

Browse files
committed
EarlyCSE: fix CmpPredicate duplicate-hashing
Fixes #119893.
1 parent 62bdb85 commit 8a9fa55

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

llvm/include/llvm/IR/CmpPredicate.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,7 @@ class CmpPredicate {
7171

7272
/// Get the swapped predicate of a CmpInst.
7373
static CmpPredicate getSwapped(const CmpInst *Cmp);
74-
75-
/// Provided to facilitate storing a CmpPredicate in data structures that
76-
/// require hashing.
77-
friend hash_code hash_value(const CmpPredicate &Arg); // NOLINT
7874
};
79-
80-
[[nodiscard]] hash_code hash_value(const CmpPredicate &Arg);
8175
} // namespace llvm
8276

8377
#endif

llvm/lib/IR/Instructions.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3946,10 +3946,6 @@ CmpPredicate CmpPredicate::getSwapped(const CmpInst *Cmp) {
39463946
return getSwapped(get(Cmp));
39473947
}
39483948

3949-
hash_code llvm::hash_value(const CmpPredicate &Arg) { // NOLINT
3950-
return hash_combine(Arg.Pred, Arg.HasSameSign);
3951-
}
3952-
39533949
//===----------------------------------------------------------------------===//
39543950
// SwitchInst Implementation
39553951
//===----------------------------------------------------------------------===//

llvm/lib/Transforms/Scalar/EarlyCSE.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ static unsigned getHashValueImpl(SimpleValue Val) {
290290
Pred = CmpInst::getInversePredicate(Pred);
291291
std::swap(A, B);
292292
}
293-
return hash_combine(Inst->getOpcode(), Pred, X, Y, A, B);
293+
return hash_combine(Inst->getOpcode(),
294+
static_cast<CmpInst::Predicate>(Pred), X, Y, A, B);
294295
}
295296

296297
if (CastInst *CI = dyn_cast<CastInst>(Inst))

0 commit comments

Comments
 (0)