Switch from specifying `libraries` and `pipelines` in `rp_initialize`
and `rp_manager_create` to the use of command-line options that are to
be passed via `argc` and `argv` in `rp_initialize`.
A bug introduced no loop promotion by mistake, we now correctly exit the
loop promotion routine if the loop has been already promoted to `while`
or `do-while` loop.
This commit teaches getExpectedModelType about the fact that various
bitwise operations are only allowed to have integer operands.
It also updates VMA, which uses getExpectedModelType, to take this
into account.
In SegregateStackAccesses sometimes we have to replace a call whose call
type does not match the callee type. Specifically when the return type
is a `StructType`, sometimes the call returns an identical `StructType`,
but with a different identity.
This commit adapts the return type of new calls on the fly.
This pass splits calls `*.with.overflow*` intrinsics into the a pair of
instructions: the underlying operation and a call to an `Helper`-tagged
function that computes whether such operation overflowed.
For instance, we go from:
%2 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 %1)
%3 = extractvalue { i32, i1 } %2, 1
br i1 %3, label %..., label %...
To:
%2 = mul i32 %0, %1
%3 = call i1 @mul_overflow_u32(i32 %0, i32 %1)
br i1 %3, label %..., label %...
This saves from handling `struct` in the backend.
This pass turns phis of invocations of pure functions into an invocation
of the pure functions with one phis per argument of the original
invocations.
This makes handling phis easier in the backend and is necessary after
the introduction of simplify-cfg with sinking enabled.
SegregateStackAccesses creates new functions. Iterating over existing
functions while creating new ones is problematic, so we now first
collect all the functions we want to inspect and then process them.
This commit introduces modelType, which supersedes `llvmIntToModelType`
in order to better handle translation of LLVM types into model types
after introduction of opaque pointer types. The main differences is
that `modelType` accepts the `Value` (instead of just the `Type`), so it
can better handle `AllocaInst` and `GlobalVariable`, which provide
information about the pointee.
Since MakeModelGEP works Use-wise, if a `Value` was used multiple times
in a phi, we used to replace them with distinct model GEPs. This led to
generate illegal IR.
This commit fixes this situation by detecting the situation and reusing
the same model GEP.