[PATCH] D74228: [PatternMatch] Match XOR variant of unsigned-add overflow check.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 09:58:52 PST 2020


lebedev.ri added a comment.

Tests missing.
What about commutted variant?



================
Comment at: llvm/include/llvm/IR/PatternMatch.h:1708
 
+    if (Pred == ICmpInst::ICMP_ULT) {
+      Value *Op1;
----------------
```
// (a ^ -1 <u b) 
```



================
Comment at: llvm/include/llvm/IR/PatternMatch.h:1711
+      auto NotExpr = m_OneUse(m_Xor(m_Value(Op1), m_SpecificInt(-1)));
+      if (NotExpr.match(ICmpLHS))
+        return L.match(Op1) && R.match(ICmpRHS) && S.match(ICmpLHS);
----------------
Will avoiding variable result in 80-char column overflow?


================
Comment at: llvm/test/Transforms/CodeGenPrepare/X86/overflow-intrinsics.ll:1
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -codegenprepare -S < %s | FileCheck %s
----------------
This doesn't seem right..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74228





More information about the llvm-commits mailing list