Drive by comment, should probably be "getNumberOfVectorRegisters" or some sort of query with vector in the name :)
-eric On Mon, Sep 9, 2013 at 8:43 AM, Arnold Schwaighofer <[email protected]> wrote: > Hi Robert, > > I think Nadav meant to add code to the LoopVectorizer and SLPVectorizer that > calls "TTI.getNumberOfRegisters(true)” and stops vectorization if it returns > 0. Something like: > > --- a/lib/Transforms/Vectorize/LoopVectorize.cpp > +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp > @@ -906,6 +906,11 @@ struct LoopVectorize : public LoopPass { > DT = &getAnalysis<DominatorTree>(); > TLI = getAnalysisIfAvailable<TargetLibraryInfo>(); > > + // If the target claims to have no vector registers don't attempt > + // vectorization. > + if (!TTI->getNumberOfRegisters(true)) > + return false; > + > if (DL == NULL) { > DEBUG(dbgs() << "LV: Not vectorizing because of missing data layout"); > return false; > > > > diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp > b/lib/Transforms/Vectorize/SLPVectorizer.cpp > index 1f288bc..6ddcc51 100644 > --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp > +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp > @@ -1565,6 +1565,11 @@ struct SLPVectorizer : public FunctionPass { > if (!DL) > return false; > > + // If the target claims to have no vector registers don't attempt > + // vectorization. > + if (!TTI->getNumberOfRegisters(true)) > + return false; > + > // Don't vectorize when the attribute NoImplicitFloat is used. > if (F.hasFnAttribute(Attribute::NoImplicitFloat)) > return false; > > On Sep 9, 2013, at 7:13 AM, Robert Lytton <[email protected]> wrote: > >> Hi Rafael, Nadav, >> >> Thank you for the input but I don't follow where the change needs to be made. >> >> Are you suggesting changes to llvm's >> lib/Transforms/IPO/PassManagerBuilder.cpp? >> This approach would make the '-vectorize-loops' & '-vectorize-slp' flags >> only relevant for targets with vector registers? >> >> Or in clang/lib/Driver/Tools.cpp? >> >> In either case, I can't see how to get hold of the TargetTransformInfo >> cleanly. >> >> Robert >> >> ________________________________________ >> From: Rafael Espíndola [[email protected]] >> Sent: 06 September 2013 18:43 >> To: Nadav Rotem >> Cc: Robert Lytton; [email protected]; Arnold Schwaighofer >> Subject: Re: XCore target: disable vectorization >> >>> unsigned TargetVectorRegisters = TTI.getNumberOfRegisters(true); >> >> And not vectorize if the target says 0? I like that idea. >> >> Cheers, >> Rafael > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
