[polly] r255776 - ScopInfo: Introduce getNumberOfArrayAccesses
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 20 15:16:42 PST 2015
Why do we need to __count__ ArrayKind accesses for one llvm::Instruction?
I was always assuming each llvm::Instruction causes either 0 or 1
ArrayKind access, thus we are interested in a boolean predicate not a
number. If I am wrong please correct me, if not please write something
that does not return a bool but the ArrayKind access if it exists and
null otherwise.
On 12/16, Tobias Grosser via llvm-commits wrote:
> Author: grosser
> Date: Wed Dec 16 10:14:00 2015
> New Revision: 255776
>
> URL: http://llvm.org/viewvc/llvm-project?rev=255776&view=rev
> Log:
> ScopInfo: Introduce getNumberOfArrayAccesses
>
> Use the new function to clarify that we indeed only want to know it at least
> one array access is associated with an instruction.
>
> Modified:
> polly/trunk/include/polly/ScopInfo.h
> polly/trunk/lib/Analysis/ScopInfo.cpp
>
> Modified: polly/trunk/include/polly/ScopInfo.h
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=255776&r1=255775&r2=255776&view=diff
> ==============================================================================
> --- polly/trunk/include/polly/ScopInfo.h (original)
> +++ polly/trunk/include/polly/ScopInfo.h Wed Dec 16 10:14:00 2015
> @@ -992,6 +992,29 @@ public:
> return *ArrayAccess;
> }
>
> + /// @brief Get the number of array accesses associated with an instruction.
> + ///
> + /// @param Inst The instruction for which to obtain the access count.
> + /// @returns The number of array accesses associated with this instruction.
> + size_t getNumberOfArrayAccessesFor(const Instruction *Inst) const {
> + size_t NumAccesses = 0;
> + auto It = InstructionToAccess.find(Inst);
> + if (It == InstructionToAccess.end())
> + return 0;
> +
> + auto *Accesses = It->getSecond();
> +
> + if (!Accesses)
> + return 0;
> +
> + for (auto Access : *Accesses) {
> + if (Access->isArrayKind())
> + NumAccesses++;
> + }
> +
> + return NumAccesses;
> + }
> +
> /// @brief Return the __first__ (scalar) memory access for @p Inst if any.
> MemoryAccess *lookupAccessFor(const Instruction *Inst) const {
> auto It = InstructionToAccess.find(Inst);
>
> Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=255776&r1=255775&r2=255776&view=diff
> ==============================================================================
> --- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
> +++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Dec 16 10:14:00 2015
> @@ -2923,7 +2923,7 @@ void Scop::verifyInvariantLoads() {
> for (LoadInst *LI : RIL) {
> assert(LI && getRegion().contains(LI));
> ScopStmt *Stmt = getStmtForBasicBlock(LI->getParent());
> - if (Stmt && Stmt->lookupAccessesFor(LI)) {
> + if (Stmt && Stmt->getNumberOfArrayAccessesFor(LI) > 0) {
> invalidate(INVARIANTLOAD, LI->getDebugLoc());
> return;
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
--
Johannes Doerfert
Researcher / PhD Student
Compiler Design Lab (Prof. Hack)
Saarland University, Computer Science
Building E1.3, Room 4.31
Tel. +49 (0)681 302-57521 : doerfert at cs.uni-saarland.de
Fax. +49 (0)681 302-3065 : http://www.cdl.uni-saarland.de/people/doerfert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151221/458dc3b1/attachment.sig>
More information about the llvm-commits
mailing list