[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:16:39 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3210
+InstCombinerImpl::foldICmpInstWithConstantNotInt(ICmpInst &I,
+                                                 const SimplifyQuery &Q) {
   Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
----------------
As this is already on InstCombinerImpl, is the Q argument necessary?


================
Comment at: llvm/test/Transforms/InstCombine/assume-icmp-null-select.ll:20
+  %4 = icmp ne i8* %.0.i, null
+  call void @llvm.assume(i1 %4)
+  ret i8* %.0.i
----------------
I find the presence of assume in this example a bit confusing, as your transform does not actually use information from the assume. I'd replace it with a more generic "use".


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