[PATCH] D96663: [InstCombine] Fold icmp (select c, const, arg), null if arg has nonnullattr

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 24 08:50:16 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3248
+        Argument *A = dyn_cast<Argument>(V);
+        if (A && A->hasNonNullAttr(true))
+          Op = SimplifyICmpInst(I.getPredicate(), A, RHSC, Q);
----------------
I don't really like this non-null attr specific case. I would suggest to simply always use SimplifyICmpInst for the isNullValue() case (and add a test for some non-attribute example).

I checked that doing so doesn't have any visible impact on CTMark (https://llvm-compile-time-tracker.com/compare.php?from=7baa2392fba0193c3e6631376c8e6a3c0318a743&to=45c227240929d8139da3dbee517e03d706555f23&stat=instructions).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96663



More information about the llvm-commits mailing list