[PATCH] D55950: [ConstantFolding] Fold undef for integer intrinsics
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 20 12:39:54 PST 2018
nikic created this revision.
nikic added reviewers: RKSimon, spatel.
Herald added a subscriber: llvm-commits.
This fixes https://bugs.llvm.org/show_bug.cgi?id=40110.
This implements handling of undef operands for integer intrinsics in ConstantFolding. In particular the bitcounting intrinsics (ctpop, cttz, ctlz), the with overflow intrinsics, the saturating math intrinsics and the funnel shift intrinsics.
The undef behavior follows what InstSimplify does for the general case of non-constant operands. For the bitcount intrinsics (where InstSimplify doesn't do undef handling -- there cannot be a combination of an undef + non-constant operand) I'm using a 0 result if the intrinsic is defined for zero and undef otherwise.
Repository:
rL LLVM
https://reviews.llvm.org/D55950
Files:
lib/Analysis/ConstantFolding.cpp
test/Analysis/ConstantFolding/bitcount.ll
test/Analysis/ConstantFolding/funnel-shift.ll
test/Analysis/ConstantFolding/saturating-add-sub.ll
test/Transforms/ConstProp/overflow-ops.ll
test/Transforms/InstCombine/saturating-add-sub-vector.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55950.179129.patch
Type: text/x-patch
Size: 49761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181220/b090661f/attachment-0001.bin>
More information about the llvm-commits
mailing list