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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 09:14:32 PST 2020


spatel added a comment.

In D74228#1867093 <https://reviews.llvm.org/D74228#1867093>, @fhahn wrote:

> InstCombine started turning (a + b <u a)  into (a ^ -1 <u b), but CGP looks for  (a + b <u a)  and misses the case now. Does that answer your question?


Ah, I see it now. I wasn't reading the diff in InstCombiner::visitICmpInst() correctly. Might be nicer to include something like:

  // m_UAddWithOverflow can match patterns that do not include
  // an explicit "add" instruction, so check the opcode of the matched op.
   

> It might be good to have tests that run instcombine & CGP to catch regressions such as this?

Yes, that would be an improvement. Two potential options:

1. Add 'opt' RUNs that include CGP to llvm/test/Transforms/PhaseOrdering (this is probably stretching the intent of "PhaseOrdering"; we'll need a new target-specific test directory because CGP will require that we pick a target).
2. Add full end-to-end tests for C --> asm to test-suite.


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