2626#define TSAR_MEMORY_SET_INFO_H
2727
2828#include " tsar/Analysis/Memory/MemoryLocationRange.h"
29+ #include " tsar/Support/SCEVUtils.h"
2930#include < llvm/Analysis/ScalarEvolutionExpressions.h>
3031
31- using llvm::cast;
32- using llvm::dyn_cast;
33- using llvm::isa;
34- using llvm::SCEVConstant;
35-
3632namespace tsar {
3733// / Provide traits for objects stored in a MemorySet.
3834// /
@@ -243,10 +239,13 @@ template<> struct MemorySetInfo<MemoryLocationRange> {
243239 auto &Right = RHS.DimList [I];
244240 if (Left == Right)
245241 continue ;
246- assert (isa<SCEVConstant>(Left.Step ) && isa<SCEVConstant>(Right.Step ) &&
247- " Dimension step must be constant!" );
248- if (!isa<SCEVConstant>(Left.Start ) || !isa<SCEVConstant>(Left.End ) ||
249- !isa<SCEVConstant>(Right.Start ) || !isa<SCEVConstant>(Right.End )) {
242+ assert (llvm::isa<llvm::SCEVConstant>(Left.Step ) &&
243+ llvm::isa<llvm::SCEVConstant>(Right.Step ) &&
244+ " Dimension step must be constant!" );
245+ if (!llvm::isa<llvm::SCEVConstant>(Left.Start ) ||
246+ !llvm::isa<llvm::SCEVConstant>(Left.End ) ||
247+ !llvm::isa<llvm::SCEVConstant>(Right.Start ) ||
248+ !llvm::isa<llvm::SCEVConstant>(Right.End )) {
250249 auto CmpLeftStartRightEnd = compareSCEVs (Left.Start , Right.End , SE);
251250 auto CmpRightStartLeftEnd = compareSCEVs (Right.Start , Left.End , SE);
252251 if (CmpLeftStartRightEnd &&
@@ -255,20 +254,20 @@ template<> struct MemorySetInfo<MemoryLocationRange> {
255254 (*CmpRightStartLeftEnd == 0 || *CmpRightStartLeftEnd == 1 )) {
256255 ++JoinableDimCount;
257256 continue ;
258- } else
259- return false ;
257+ }
258+ return false ;
260259 }
261- auto LeftStart = cast<SCEVConstant>(Left.Start )->
260+ auto LeftStart = llvm:: cast<llvm:: SCEVConstant>(Left.Start )->
262261 getValue ()->getZExtValue ();
263- auto LeftEnd = cast<SCEVConstant>(Left.End )->
262+ auto LeftEnd = llvm:: cast<llvm:: SCEVConstant>(Left.End )->
264263 getValue ()->getZExtValue ();
265- auto LeftStep = cast<SCEVConstant>(Left.Step )->
264+ auto LeftStep = llvm:: cast<llvm:: SCEVConstant>(Left.Step )->
266265 getValue ()->getZExtValue ();
267- auto RightStart = cast<SCEVConstant>(Right.Start )->
266+ auto RightStart = llvm:: cast<llvm:: SCEVConstant>(Right.Start )->
268267 getValue ()->getZExtValue ();
269- auto RightEnd = cast<SCEVConstant>(Right.End )->
268+ auto RightEnd = llvm:: cast<llvm:: SCEVConstant>(Right.End )->
270269 getValue ()->getZExtValue ();
271- auto RightStep = cast<SCEVConstant>(Right.Step )->
270+ auto RightStep = llvm:: cast<llvm:: SCEVConstant>(Right.Step )->
272271 getValue ()->getZExtValue ();
273272 assert (LeftStart <= LeftEnd && RightStart <= RightEnd &&
274273 " Start of dimension must be less or equal than End." );
@@ -306,10 +305,10 @@ template<> struct MemorySetInfo<MemoryLocationRange> {
306305 for (size_t I = 0 ; I < To.DimList .size (); I++) {
307306 auto &DimTo = To.DimList [I];
308307 auto &DimFrom = What.DimList [I];
309- if (!isa<SCEVConstant>(DimTo.Start ) ||
310- !isa<SCEVConstant>(DimTo.End ) ||
311- !isa<SCEVConstant>(DimFrom.Start ) ||
312- !isa<SCEVConstant>(DimFrom.End )) {
308+ if (!llvm:: isa<llvm:: SCEVConstant>(DimTo.Start ) ||
309+ !llvm:: isa<llvm:: SCEVConstant>(DimTo.End ) ||
310+ !llvm:: isa<llvm:: SCEVConstant>(DimFrom.Start ) ||
311+ !llvm:: isa<llvm:: SCEVConstant>(DimFrom.End )) {
313312 auto CmpFromEndToStart = compareSCEVs (DimTo.Start , DimFrom.End , SE);
314313 auto CmpToEndFromStart = compareSCEVs (DimFrom.Start , DimTo.End , SE);
315314 if (CmpFromEndToStart &&
0 commit comments