llvm.org GIT mirror llvm / 5e66eea
ScalarEvolution: Derive element size from the type of the loaded element Before, we where looking at the size of the pointer type that specifies the location from which to load the element. This did not make any sense at all. This change fixes a bug in the delinearization where we failed to delinerize certain load instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210435 91177308-0d34-0410-b5e6-96231b3b80d8 Tobias Grosser 6 years ago
2 changed file(s) with 12 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
73647364 if (StoreInst *Store = dyn_cast(Inst))
73657365 Ty = Store->getValueOperand()->getType();
73667366 else if (LoadInst *Load = dyn_cast(Inst))
7367 Ty = Load->getPointerOperand()->getType();
7367 Ty = Load->getType();
73687368 else
73697369 return nullptr;
73707370
77 ; A[i][j] = 1.0;
88 ; }
99
10 ; Inst: %val = load double* %arrayidx
11 ; In Loop with Header: for.j
12 ; AddRec: {{0,+,(%m * sizeof(double))}<%for.i>,+,sizeof(double)}<%for.j>
13 ; Base offset: %A
14 ; ArrayDecl[UnknownSize][%m] with elements of sizeof(double) bytes.
15 ; ArrayRef[{0,+,1}<%for.i>][{0,+,1}<%for.j>]
16
17 ; Inst: store double %val, double* %arrayidx
18 ; In Loop with Header: for.j
1019 ; AddRec: {{%A,+,(8 * %m)}<%for.i>,+,8}<%for.j>
1120 ; CHECK: Base offset: %A
1221 ; CHECK: ArrayDecl[UnknownSize][%m] with elements of sizeof(double) bytes.
2534 %j = phi i64 [ 0, %for.i ], [ %j.inc, %for.j ]
2635 %vlaarrayidx.sum = add i64 %j, %tmp
2736 %arrayidx = getelementptr inbounds double* %A, i64 %vlaarrayidx.sum
28 store double 1.0, double* %arrayidx
37 %val = load double* %arrayidx
38 store double %val, double* %arrayidx
2939 %j.inc = add nsw i64 %j, 1
3040 %j.exitcond = icmp eq i64 %j.inc, %m
3141 br i1 %j.exitcond, label %for.i.inc, label %for.j