[PATCH] D82892: [NFC] Added comparision for all types in haveSameSpecialState() of Instruction.cpp

Aditya Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 10:27:40 PDT 2020


hiraditya added inline comments.


================
Comment at: llvm/lib/IR/Instructions.cpp:58
+
+static int compareBools(bool L, bool R) {
+  if ((int)L < (int)R)
----------------
Can we do:
```
if (L==R)
  return 0;
if (L)
  return 1;
return -1;
```


================
Comment at: llvm/lib/IR/Instructions.cpp:66
+
+static int compareOrderings(AtomicOrdering L, AtomicOrdering R) {
+  if ((int)L < (int)R)
----------------
SInce `AtomicOrdering` is unsinged. We should be able to just return their difference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82892



More information about the llvm-commits mailing list