Skip to content
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

LLVM 4 #3

Open
wants to merge 36 commits into
base: llvm-4.0
Choose a base branch
from
Open

LLVM 4 #3

wants to merge 36 commits into from

Conversation

jcarlson23
Copy link

Alright, here goes again. I think this ought to be much better. That said, two areas I would look at (beyond the AvoidBv flag, for instance) are the IndVarSimplify.cc file, where in 4.0 there are a fair number of changes making the 3.8 into a legacy pass (and I did try to reference the 3.8 branch - that was helpful) and so I didn't move this into the llvm_seahorn namespace; and then similarly in the opt folder I included some of the current 4.0 code because it didn't seem as if it would hurt and figured it might make it easier to integrate then with 4.x...

But please, let me know if I've got something wrong. Thanks again for all the help and pointers, I definitely made this into more of a project than I needed to, but.. there's a first time to everything.

jcarlson23 added 30 commits May 17, 2017 21:42
…nying header); also changed the CMake file. This still has a linkage error but the missing symbols for the pass registration are not an issue any longer. This is more verbose and perhaps contains items not necessary than before, but with the new pass manager this is clearly the way to move (I think) and so... commit
…LLVM 4 build being built without RTTI, recompiling fixed that as that's what seems what is wanted.
…ping it as I did will make this a bit more teidious than it should be...
@caballa
Copy link
Contributor

caballa commented Jun 27, 2017

Sorry my fault this is taking too long.
I'll come back to you soon.

@jcarlson23
Copy link
Author

@caballa no worries... honestly, I've got a bunch to do before the 4th, so I wasn't even thinking of checking in until after the holiday, and I'm not in a rush.

Copy link
Contributor

@caballa caballa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking me so long. I hope you are still interested in this. If yes, please read the comments. They should be easy to fix.

@@ -488,16 +494,16 @@ void PassManagerBuilder::addLTOOptimizationPasses(PassManagerBase &PM) {
if (UseNewSROA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need of if-then-else here

@@ -1760,7 +1683,7 @@ Value *InstCombiner::FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
// 4) LowRange1 ^ LowRange2 and HighRange1 ^ HighRange2 are one-bit mask.
// This implies all values in the two ranges differ by exactly one bit.

if (!AvoidBv && (LHSCC == ICmpInst::ICMP_ULT || LHSCC == ICmpInst::ICMP_ULE) &&
if ((LHSCC == ICmpInst::ICMP_ULT || LHSCC == ICmpInst::ICMP_ULE) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot here to add (!AvoidBv)

bool MinimizeSize, bool ExpensiveCombines, AliasAnalysis *AA,
AssumptionCache &AC, TargetLibraryInfo &TLI,
DominatorTree &DT, const DataLayout &DL, LoopInfo *LI)
: Worklist(Worklist), Builder(Builder), MinimizeSize(MinimizeSize),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AvoidBv is not initialized. It should be initialized to true in the constructor.

class DbgDeclareInst;
class MemIntrinsic;
class MemSetInst;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the above forward declarations it should be part of the llvm_seahorn namespace


FunctionPass *llvm::createInstructionCombiningPass(bool ExpensiveCombines) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we keeping llvm::InstructionCombiningPass? We just care about llvm_seahorn::SeaInstructionCombiningPass

if (L->contains(BI->getSuccessor(0)))
P = ICmpInst::ICMP_SLT;
P = ICmpInst::ICMP_NE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be ICMP_SLT to avoid disequalities. This change is important, it was actually the main reason for duplicating IndVarSimplify.cc

else
P = ICmpInst::ICMP_EQ;

DEBUG(dbgs() << "INDVARS: Rewriting loop exit condition to:\n"
<< " LHS:" << *CmpIndVar << '\n'
<< " op:\t"
<< (P == ICmpInst::ICMP_EQ ? "==" : "<") << "\n"
<< (P == ICmpInst::ICMP_NE ? "!=" : "==") << "\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this accordingly

static void AddStandardLinkPasses(PassManagerBase &PM) {
llvm_seahorn::PassManagerBuilder Builder;
static void AddStandardLinkPasses(legacy::PassManagerBase &PM) {
PassManagerBuilder Builder;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be llvm_seahorn::PassManagerBuilder. Otherwise, we will use the llvm passes.

@@ -0,0 +1,1172 @@
//===- Parsing, selection, and construction of pass pipelines -------------===//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a comment in tools/opt/opt.cpp. We need to use the PassBuilder defined in llvm_seahorn, otherwise seaopt will call the llvm pass rather than the seahorn passes. So I don't think we need this file.

@@ -0,0 +1,314 @@
//===- Parsing, selection, and construction of pass pipelines --*- C++ -*--===//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this file for same reason as described in tools/opt/PassBuilder.cpp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants