[PATCH] D159406: [SelectionDAG] Generalise SelectionDAG::computeOverflowKind to support other opcodes

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 4 08:13:22 PDT 2023


RKSimon added a comment.

> As I am a complete beginner with LLVM how can write tests? Is there any tutorial or example?

In this case the best reference tests are probably in combine-mulo.ll and xmulo.ll in the llvm-project/llvm/test/CodeGen/X86/ folder

I think you're only missing test coverage for the computeOverflowForSignedMul "SignBits == BitWidth + 1" knownbits cases.

You could investigate how InstCombine handles these cases - look inside llvm-project\llvm\test\Transforms\InstCombine for smul.overflow tests - you could try disabling the "SignBits == BitWidth + 1" handling in ValueTracking.cpp and then see which tests change/fail  with `ninja check-llvm-transforms-instcombine` - you might then be able to convert some of those to combine-mulo.ll / xmulo.ll


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

https://reviews.llvm.org/D159406



More information about the llvm-commits mailing list