-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for LLVM 3.8 #900
Support for LLVM 3.8 #900
Conversation
sudo apt-get install -y llvm-${LLVM_VERSION}-tools clang-${LLVM_VERSION} | ||
sudo apt-get install -y clang-${LLVM_VERSION} | ||
if [ "${LLVM_VERSION}" != "3.8" ]; then | ||
sudo apt-get install -y llvm-${LLVM_VERSION}-tools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is llvm-3.8-tools not needed anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this was needed before we started using llvm-toolchain repos. It should not be needed now. I will try to drop it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 3.8, this is still needed, because:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
llvm-3.8-tools : Depends: llvm-3.8-dev (= 1:3.8~svn278388-1~exp1) but 1:3.8-2ubuntu3~trusty5 is to be installed
E: Unable to correct problems, you have held broken packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for having a look. Do you know if it's needed at all, considering llvm-3.8 works without it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kren1 llvm-tools contains FileCheck
and not
, so you we need for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this means no testing for llvm-3.8? I guess for those two programs we could use an different llvm-tools version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But tests are run and succeed AFAICT. So the tools are maybe in different package in 3.8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, FileCheck
and not
are downloaded if not available, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jirislaby Yes, exactly. And we can either use lit provided with LLVM or the python package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what't the solution here? I feel like we don't need to special case this for 3.8.
@@ -2210,8 +2210,13 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) { | |||
!fpWidthToSemantics(right->getWidth())) | |||
return terminateStateOnExecError(state, "Unsupported FRem operation"); | |||
llvm::APFloat Res(*fpWidthToSemantics(left->getWidth()), left->getAPValue()); | |||
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) | |||
Res.mod( | |||
APFloat(*fpWidthToSemantics(right->getWidth()), right->getAPValue())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rounding was removed because it was never needed: llvm-mirror/llvm@ff278be
Codecov Report
@@ Coverage Diff @@
## master #900 +/- ##
==========================================
- Coverage 65.91% 65.91% -0.01%
==========================================
Files 141 141
Lines 16152 16154 +2
Branches 3739 3739
==========================================
+ Hits 10647 10648 +1
- Misses 3816 3817 +1
Partials 1689 1689
Continue to review full report at Codecov.
|
lib/Module/IntrinsicCleaner.cpp
Outdated
@@ -110,8 +114,12 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { | |||
case Intrinsic::uadd_with_overflow: | |||
case Intrinsic::usub_with_overflow: | |||
case Intrinsic::umul_with_overflow: { | |||
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) | |||
// ctor needs the iterator, but we already increased ours | |||
IRBuilder<> builder(ii->getParent(), i_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I missing something, but I can't see why this would be necessary in 3.8, the constructros doesn't seem to have changed?
lib/Module/Optimize.cpp
Outdated
@@ -102,7 +102,12 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) { | |||
addPass(PM, createCFGSimplificationPass()); // Clean up after IPCP & DAE | |||
|
|||
addPass(PM, createPruneEHPass()); // Remove dead EH info | |||
addPass(PM, createFunctionAttrsPass()); // Deduce function attrs | |||
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) | |||
addPass(PM, createPostOrderFunctionAttrsPass()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be a refactoring in llvm-mirror/llvm@e96fb9a
lib/Module/Optimize.cpp
Outdated
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) | ||
addPass(Passes, createPostOrderFunctionAttrsPass()); | ||
addPass(Passes, createReversePostOrderFunctionAttrsPass()); | ||
// addPass(Passes, createGlobalsAAWrapperPass()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray comment.
raw_svector_ostream ds(d); ds << i; ds.flush(); | ||
raw_svector_ostream ds(d); | ||
ds << i; | ||
// SmallString is always up-to-date, no need to flush. See Support/raw_ostream.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in llvm-mirror/llvm@d4177b2
e7100fa
to
41c0eb6
Compare
@jirislaby , what's the status with this one? I guess it's ready for a rebase? |
@jirislaby Do you have time to rebase your patch? Otherwise I can try to do it. |
@MartinNowack coincidently I have been working on this today. It was tough due to rework in ef90f1e but it's done. |
@jirislaby Fantastic!! I assumed there was some pain involved - sorry for that. |
@MartinNowack , do you know why the Travis logs are so verbose since the switch to Docker? It would be nice to reduce verbosity a bit if possible. |
@ccadar Yes, that't true - but that is only when they are building LLVM. Otherwise it should be much shorter. |
But why was LLVM built? I thought we don't do this. Also, what was the source of the initial Travis CI failures? (I see you restarted it and it worked the second time) |
@ccadar The llvm images were not built/rebuild to fix a bug with the coverage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jirislaby I like the changes.
Please:
- fix my minor comments
- rebase
- merge commits
Beside that, I think we are ready to go.
@@ -162,8 +162,12 @@ static bool linkTwoModules(llvm::Module *Dest, | |||
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be rearranged as the error message is not propagated anymore.
Therefore we have to generate our own.
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
// Get the potential error message (Src is moved and won't be available later)
errorMsg =
"Linking module " + src->getModuleIdentifier() + " failed";
auto linkResult = Linker::linkModules(*Dest, std::move(Src));
#else if LLVM_VERSION_CODE >= LLVM_VERSION(3,6)
...
lib/Module/ModuleUtil.cpp
Outdated
std::error_code ec = memberNameErr.getError(); | ||
std::error_code ec; | ||
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8) | ||
ErrorOr<object::Archive::Child> childErr = *AI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use auto
if possible.
I would prefere childOrErr
to indicate that it contains a child or an error.
lib/Module/ModuleUtil.cpp
Outdated
return false; | ||
} | ||
#else | ||
object::Archive::child_iterator childErr = AI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto as well.
The rounding was removed because it was never needed: llvm-mirror/llvm@ff278be 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>
No need to flush it, see llvm-mirror/llvm@d4177b2 Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
@MartinNowack rebaed and fixed. What do you mean by merging commits? You mean squash them together? But as we did for llvm 3.7, the multiple commits are easier to follow (even in history). |
@jirislaby Yes, i meant merging them but looking at your messages. I'm fine with it. |
@jirislaby
Should be:
|
LLVM commit d912be98f8eb changed the prototype of linkModules to accept std::unique_ptr. Adapt to that. 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 eac309550f25 removed implicit iterator conversions. So we have to get the iterators explicitly now. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
alias in LLVM 3.8 has a new format, it adds an AliaseeTy parameter. So handle this in the tests. [v2] add comments about what was changed and why Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
@jirislaby Thanks a lot for your hard work. The zero change in coverage for diff is expected as LLVM 3.8 code is not exercised for coverage runs. Reduction in general is also expected, new code is added but additional code not tested. |
The story never ends...