Domain = NewDomain;
}
+// @brief Get the data-type of the elements accessed
+static Type *getAccessType(IRAccess &Access, Instruction *AccessInst) {
+ if (Access.isPHI())
+ return Access.getBase()->getType();
+
+ if (StoreInst *Store = dyn_cast<StoreInst>(AccessInst))
+ return Store->getValueOperand()->getType();
+ if (BranchInst *Branch = dyn_cast<BranchInst>(AccessInst))
+ return Branch->getCondition()->getType();
+ return AccessInst->getType();
+}
+
void ScopStmt::buildAccesses(TempScop &tempScop, BasicBlock *Block,
bool isApproximated) {
AccFuncSetType *AFS = tempScop.getAccessFunctions(Block);
for (auto &AccessPair : *AFS) {
IRAccess &Access = AccessPair.first;
Instruction *AccessInst = AccessPair.second;
+ Type *ElementType = getAccessType(Access, AccessInst);
- Type *ElementType = getAccessInstType(AccessInst);
const ScopArrayInfo *SAI = getParent()->getOrCreateScopArrayInfo(
Access.getBase(), ElementType, Access.Sizes, Access.isPHI());
return 0;
}
-Type *polly::getAccessInstType(Instruction *AccInst) {
- if (StoreInst *Store = dyn_cast<StoreInst>(AccInst))
- return Store->getValueOperand()->getType();
- if (BranchInst *Branch = dyn_cast<BranchInst>(AccInst))
- return Branch->getCondition()->getType();
- return AccInst->getType();
-}
-
bool polly::hasInvokeEdge(const PHINode *PN) {
for (unsigned i = 0, e = PN->getNumIncomingValues(); i < e; ++i)
if (InvokeInst *II = dyn_cast<InvokeInst>(PN->getIncomingValue(i)))
--- /dev/null
+; RUN: opt %loadPolly -polly-codegen -polly-no-early-exit -S < %s | FileCheck %s
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+
+; CHECK: polly.stmt.bb3: ; preds = %polly.stmt.bb3.entry
+; CHECK: %polly.subregion.iv = phi i32 [ 0, %polly.stmt.bb3.entry ]
+; CHECK: %polly.tmp = phi i64 [ %tmp.phiops.reload, %polly.stmt.bb3.entry ]
+; CHECK: %tmp6_p_scalar_ = load double, double* %arg11, !alias.scope !0, !noalias !2
+; CHECK: %p_tmp7 = fadd double undef, %tmp6_p_scalar_
+; CHECK: %p_tmp8 = fcmp olt double undef, %p_tmp7
+; CHECK: %polly.subregion.iv.inc = add i32 %polly.subregion.iv, 1
+; CHECK: br i1 %p_tmp8, label %polly.stmt.bb9, label %polly.stmt.bb10
+
+; CHECK: polly.stmt.bb9: ; preds = %polly.stmt.bb3
+; CHECK: store double 1.000000e+00, double* %tmp12.phiops
+; CHECK: br label %polly.stmt.bb11.exit
+
+; CHECK: polly.stmt.bb10: ; preds = %polly.stmt.bb3
+; CHECK: store double 2.000000e+00, double* %tmp12.phiops
+; CHECK: br label %polly.stmt.bb11.exit
+
+
+define void @hoge(i32 %arg, [1024 x double]* %arg1) {
+bb:
+ br label %bb2
+
+bb2: ; preds = %bb
+ br label %bb3
+
+bb3: ; preds = %bb11, %bb2
+ %tmp = phi i64 [ 0, %bb11 ], [ 0, %bb2 ]
+ %tmp4 = icmp sgt i32 %arg, 0
+ %tmp5 = getelementptr inbounds [1024 x double], [1024 x double]* %arg1, i64 0, i64 0
+ %tmp6 = load double, double* %tmp5
+ %tmp7 = fadd double undef, %tmp6
+ %tmp8 = fcmp olt double undef, %tmp7
+ br i1 %tmp8, label %bb9, label %bb10
+
+bb9: ; preds = %bb3
+ br label %bb11
+
+bb10: ; preds = %bb3
+ br label %bb11
+
+bb11: ; preds = %bb10, %bb9
+ %tmp12 = phi double [ 1.0, %bb9 ], [ 2.0, %bb10 ]
+ %tmp13 = getelementptr inbounds [1024 x double], [1024 x double]* %arg1, i64 %tmp, i64 0
+ store double %tmp12, double* %tmp13
+ %tmp14 = add nuw nsw i64 0, 1
+ %tmp15 = trunc i64 %tmp14 to i32
+ br i1 false, label %bb3, label %bb16
+
+bb16: ; preds = %bb11
+ br label %bb17
+
+bb17: ; preds = %bb16
+ ret void
+}