[ValueTracking] Refine known bits for linear interpolation patterns (#166378) In this patch, we try to detect the lerp pattern: a * (b - c) + c * d where a >= 0, b >= 0, c >= 0, d >= 0, and b >= c. In that particular case, we can use the following chain of reasoning: a * (b - c) + c * d <= a' * (b - c) + a' * c = a' * b where a' = max(a, d) Since that is true for arbitrary a, b, c and d within our constraints, we can conclude that: max(a * (b - c) + c * d) <= max(max(a), max(d)) * max(b) = U Considering that any result of the lerp would be less or equal to U, it would have at least the number of leading 0s as in U. While being quite a specific situation, it is fairly common in computer graphics in the shape of alpha blending. In conjunction with #165877, increases vectorization factor for lerp loops.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.