[llvm] [X86][ARM] Invert the low bit to get the inverse predicate (NFC) (PR #151748)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 1 11:51:25 PDT 2025


================
@@ -85,7 +85,11 @@ unsigned getNonNDVariant(unsigned Opc);
 
 /// GetOppositeBranchCondition - Return the inverse of the specified cond,
 /// e.g. turning COND_E to COND_NE.
-CondCode GetOppositeBranchCondition(CondCode CC);
+CondCode GetOppositeBranchCondition(CondCode CC) {
+  // To reverse a condition it's necessary to only invert the low bit:
----------------
topperc wrote:

Add an assert for COND_INVALID

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


More information about the llvm-commits mailing list