diff options
| author | Siddharth Bhat <siddu.druid@gmail.com> | 2017-05-18 16:47:13 +0000 |
|---|---|---|
| committer | Siddharth Bhat <siddu.druid@gmail.com> | 2017-05-18 16:47:13 +0000 |
| commit | 06e3c74d8318229986b6d744260fc4ebcb42a34d (patch) | |
| tree | d32327dd6b6d160da5feaea4822d24ecd538cb17 /polly/lib/Analysis/ScopBuilder.cpp | |
| parent | a6465bbb726badf86e520d15d29b6a65a2d1007d (diff) | |
| download | bcm5719-llvm-06e3c74d8318229986b6d744260fc4ebcb42a34d.tar.gz bcm5719-llvm-06e3c74d8318229986b6d744260fc4ebcb42a34d.zip | |
[Fortran Support] Change "global" pattern match to work for params
Summary:
- Rename global / local naming convention that did not make much sense
to Visible / Invisible, where the visible refers to whether the ALLOCATE
call to the Fortran array is present in the current module or not.
- This match now works on both cross fortran module globals and on
parameters to functions since neither of them are necessarily allocated
at the point of their usage.
- Add testcase that matches against both a load and a store against
function parameters.
Differential Revision: https://reviews.llvm.org/D33190
llvm-svn: 303356
Diffstat (limited to 'polly/lib/Analysis/ScopBuilder.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopBuilder.cpp | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp index bfb3af2844b..b7c9c6599ef 100644 --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -201,7 +201,7 @@ bool isFortranArrayDescriptor(Value *V) { return true; } -Value *ScopBuilder::findFADGlobalNonAlloc(MemAccInst Inst) { +Value *ScopBuilder::findFADAllocationVisible(MemAccInst Inst) { // match: 4.1 & 4.2 store/load if (!isa<LoadInst>(Inst) && !isa<StoreInst>(Inst)) return nullptr; @@ -272,15 +272,11 @@ Value *ScopBuilder::findFADGlobalNonAlloc(MemAccInst Inst) { return nullptr; } -Value *ScopBuilder::findFADGlobalAlloc(MemAccInst Inst) { +Value *ScopBuilder::findFADAllocationInvisible(MemAccInst Inst) { // match: 3 if (!isa<LoadInst>(Inst) && !isa<StoreInst>(Inst)) return nullptr; - // match: 3 - if (Inst.getAlignment() != 8) - return nullptr; - Value *Slot = Inst.getPointerOperand(); LoadInst *MemLoad = nullptr; @@ -311,40 +307,6 @@ Value *ScopBuilder::findFADGlobalAlloc(MemAccInst Inst) { return Descriptor; } -Value *ScopBuilder::findFADLocalNonAlloc(MemAccInst Inst) { - // match: 3 - if (!isa<LoadInst>(Inst) && !isa<StoreInst>(Inst)) - return nullptr; - - // match: 3 - if (Inst.getAlignment() != 8) - return nullptr; - - Value *Slot = Inst.getPointerOperand(); - - BitCastOperator *MemBitcast = nullptr; - // [match: 2] - if (auto *SlotGEP = dyn_cast<GetElementPtrInst>(Slot)) { - // match: 1 - MemBitcast = dyn_cast<BitCastOperator>(SlotGEP->getPointerOperand()); - } else { - // match: 1 - MemBitcast = dyn_cast<BitCastOperator>(Slot); - } - - if (!MemBitcast) - return nullptr; - - Value *Descriptor = dyn_cast<Value>(MemBitcast->getOperand(0)); - if (!Descriptor) - return nullptr; - - if (!isFortranArrayDescriptor(Descriptor)) - return nullptr; - - return Descriptor; -} - bool ScopBuilder::buildAccessMultiDimFixed(MemAccInst Inst, ScopStmt *Stmt) { Value *Val = Inst.getValueOperand(); Type *ElementType = Val->getType(); @@ -771,11 +733,9 @@ void ScopBuilder::addArrayAccess( if (!DetectFortranArrays) return; - if (Value *FAD = findFADGlobalNonAlloc(MemAccInst)) - MemAccess->setFortranArrayDescriptor(FAD); - else if (Value *FAD = findFADGlobalAlloc(MemAccInst)) + if (Value *FAD = findFADAllocationInvisible(MemAccInst)) MemAccess->setFortranArrayDescriptor(FAD); - else if (Value *FAD = findFADLocalNonAlloc(MemAccInst)) + else if (Value *FAD = findFADAllocationVisible(MemAccInst)) MemAccess->setFortranArrayDescriptor(FAD); } |

