[all-commits] [llvm/llvm-project] 0d674c: [Mem2Reg] Extract code for converting !nonull to a...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Thu Jan 12 07:42:02 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0d674cf0eae84a7b83999d2122c1609a8ee2b16d
https://github.com/llvm/llvm-project/commit/0d674cf0eae84a7b83999d2122c1609a8ee2b16d
Author: Nikita Popov <npopov at redhat.com>
Date: 2023-01-12 (Thu, 12 Jan 2023)
Changed paths:
M llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
Log Message:
-----------
[Mem2Reg] Extract code for converting !nonull to assume (NFC)
Commit: 4f772b095525059521f2f88112d29dcfaa178101
https://github.com/llvm/llvm-project/commit/4f772b095525059521f2f88112d29dcfaa178101
Author: Nikita Popov <npopov at redhat.com>
Date: 2023-01-12 (Thu, 12 Jan 2023)
Changed paths:
M llvm/include/llvm/Analysis/LazyValueInfo.h
M llvm/lib/Analysis/LazyValueInfo.cpp
M llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
M llvm/test/Transforms/CorrelatedValuePropagation/cond-at-use.ll
Log Message:
-----------
[LVI][CVP] Make use of condition known at use
When an instruction is only used in a select or phi operand, we might
be able to make use of additional information from the select/branch
condition. For example in
%sub = call i16 @llvm.usub.sat.i16(i16 %x, i16 10)
%cmp = icmp uge i16 %x, 10
%sel = select i1 %cmp, i16 %sub, i16 42
the usub.sat is only used in a select where %x uge 10 is known to
hold, so we can fold it based on that knowledge.
This addresses the regression reported at
https://reviews.llvm.org/D140798#4039748, but also provides a
solution to a recurring problem we've had, where we fail to make
use of range information after a branch+phi has been converted
into a select. Our current solution to this is to hope that IPSCCP
can perform the fold before that happens, but handling this in LVI
is a somewhat more general solution.
Currently we only make use of this for the willNotOverflow() fold,
but I plan to adjust other folds to use the new API as well.
Differential Revision: https://reviews.llvm.org/D141482
Compare: https://github.com/llvm/llvm-project/compare/bff31d0836bf...4f772b095525
More information about the All-commits
mailing list