[PATCH] D96663: [InstCombine] Fold nonnull (select c,null,p) to nonnull p

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 20 00:05:37 PST 2021


aqjune updated this revision to Diff 325167.
aqjune added a comment.

It sounds like a good idea, I updated the patch to insert assume(cond).

I think this is allowed only when nonnull is accompanied with noundef attribute:
llvm.assume(cond) immediately raises UB whereas passing null to nonnull is equivalent
to passing poison; noundef is needed for this according to LangRef.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96663

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/nonnull-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96663.325167.patch
Type: text/x-patch
Size: 6865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210220/89ddc5b8/attachment.bin>


More information about the llvm-commits mailing list