Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Better debug information
|
|
Compilers are allowed to hoist function calls and do GVE.
This is currently done even without `--optimization` enabled.
This is unfortunate in the context of KLEE function calls that might
depend on specific code position without direct control flow
dependencies. In such cases, function calls can be hoisted.
To circumvent this, disallow to optimise functions that contain such
calls by default. This might reduce optimisation for some functions
containing such function calls but still allows it for all others.
This patch adds an additional pass, that detects all functions starting with a
prefix `klee_` and disable optimisations for functions containing such
calls.
This is enabled by default but can be disabled by
`--klee-call-optimisation=false`.
|
|
|
|
|
|
KModule.cpp in there
|
|
function and updated some .ll tests to use --optimize=false instead of --disable-opt
|
|
|
|
provides a workaround for LLVM bug PR39177, which affects LLVM
versions 3.9 - 7.0.0: https://bugs.llvm.org/show_bug.cgi?id=39177
This commit is intended to be reverted once support for LLVM
versions <= 7 is dropped from KLEE.
|
|
createLowerSwitchPass moved in llvm commit 49ca55e3813c to Utils.h.
createInstructionCombiningPass moved in llvm commitb5b7fce64c1d to
InstCombine.h. So add the includes where needed.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
Since llvm commit 06d6207c1c63, WriteBitcodeToFile accepts Module &, not
Module *.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
Some headers were moved from llvm/Target/ to llvm/CodeGen/. Handle that.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
Modify the IntrinsicCleaner accordingly.
We do not do anything with the third argument as we do not handle the
first argument in any way.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
llvm 5, moved file_magic to BinaryFormat in commit
19ca2b0f9daed883c21730285d7f04424e5f5f88, so adapt to that.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
llvm 5 does not terminate getOrInsertFunction parameters with NULL, take
care of that.
Since commit 9d54400bba7eb04bca80fce97fa170452d19eaf1.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
As the shift checker could be executed multiple times, we need to avoid
that shift instructions are instrumented multiple times as well.
Mark the instrumented instruction using metadata and avoid it in
successive runs.
|
|
Do not instrument shift operations with constant shift operations that
are smaller than the type size.
|
|
Use llvm::Builder instead of Inst::Create* to create instruction. This
handles metadata automatically and does instruction folding if possible.
Updated to C++11 and clang-formatted.
|
|
DivChecker can be executed multiple times due to the new linking
process.
Avoid instrumenting div instructions multiple times by annotating
checked instructions with marker. Only unmarked div instructions will be
instrumented.
|
|
Do not instrument divisions which do have a constant non-zero value.
|
|
Use llvm::Builder instead of raw `*Inst::create()` functions.
Builder automatically manages metadata (e.g. debug, TBAA, ..) such that
we don't have to take care of this automatically.
Updated code to C++11 and clang-formated it.
|
|
Simplify the handling of metadata attached to LLVM IR that is specific
to KLEE.
|
|
|
|
|
|
|
|
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
LLVM 4 renamed and splitted some headers. Take this into account in
includes.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
|
|
Validate if the user-selected entry function exists. Do not assume it is
`main`.
|
|
Replace the remaining occurrences of `Inst::Create()` with
`llvm::Builder` to manage metadata automatically and to fold
instructions.
C++11 it and clang-format
|
|
|
|
|
|
* handle BlockAddress (which is not a valid function pointer)
* there is no instruction with opcode 0
* add test for functionality
|
|
With version 3.5, LLVM introduced a subtle semantic change in the API of
`Value`. With that change, `use_begin()` is renamed to `user_begin()`.
Additionally, a new method `use_begin()` with a different meaning was
introduced. Now, `use_begin()` actually iterates over `Use`s, whereas
before, dereferencing it would give a `User *`. For further details,
please refer to https://reviews.llvm.org/rL203364.
Due to the reintroduction of `use_begin()`, existing code may still
compile, although the semantics have changed. In the code changed with
this patch, all `dyn_cast`s for `Use` fail and the else branch is
always taken.
|
|
LLVM commit eac309550f25 removed implicit iterator conversions. So we
have to get the iterators explicitly now.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
After LLVM commit 25569fdcdab0, archive iterator returns
object::Archive::Child instead of child_iterator, adapt to that.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
LLVM commit d912be98f8eb changed the prototype of linkModules to accept
std::unique_ptr. Adapt to that.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
createFunctionAttrsPass was split to createPostOrderFunctionAttrsPass
and createReversePostOrderFunctionAttrsPass in LLVM commit e96fb9ab15d4.
createGlobalsModRefPass was changed to createGlobalsAAWrapperPass in
LLVM commit 9146833fa313.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
Link intrinsic library before executing optimizations.
This makes sure that any optimization run by KLEE on the module
is executed for the intrinsic library as well.
Support .ll files as input for KLEE as well.
|
|
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
LLVM 3.7 added a PointeeType parameter to GetElementPtrInst::Create.
Let's handle that by a macro called KLEE_LLVM_GEP_TYPE, defined in
Version.h.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
|