[llvm] [SimplifyCFG] Support trunc nuw in chain of comparisons. (PR #155087)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 24 08:50:37 PDT 2025


================
@@ -612,6 +612,15 @@ struct ConstantComparesGatherer {
   /// If CompValue is already set, the function is expected to fail if a match
   /// is found but the value compared to is different.
   bool matchInstruction(Instruction *I, bool isEQ) {
+    Value *Val;
+    if (!isEQ && match(I, m_NUWTrunc(m_Value(Val)))) {
----------------
andjo403 wrote:

Good catch, this was a more common case.

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


More information about the llvm-commits mailing list