[PATCH] D17250: [Polly] [Refactor] Enable llvm's isa/cast/dyn_cast on MemAccInst

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 09:08:20 PST 2016


Meinersbur added inline comments.

================
Comment at: lib/Analysis/ScopInfo.cpp:619
@@ -618,5 +618,3 @@
 void MemoryAccess::buildMemIntrinsicAccessRelation() {
-  auto MAI = MemAccInst(getAccessInstruction());
-  (void)MAI;
-  assert(MAI.isMemIntrinsic());
+  assert(isa<MemIntrinsic>(MemAccInst(getAccessInstruction())));
   assert(Subscripts.size() == 2 && Sizes.size() == 0);
----------------
etherzhhb wrote:
> Meinersbur wrote:
> > Does this work was well?
> > ```
> > assert(isa<MemIntrinsic>(getAccessInstruction()));
> > ```
> if getAccessInstruction() return nullptr.
> 
> 
> ```
> assert(isa<MemIntrinsic>(MemAccInst(getAccessInstruction())));
> ```
> Trigger an assertion failure.
> 
> 
> ```
> assert(isa<MemIntrinsic>(getAccessInstruction()));
> ```
> 
> Trigger a SIGSEGV (suppose to ... no sure)
> 
> 
> Maybe we should write:
> ```
> assert(getAccessInstruction() && isa<MemIntrinsic>(getAccessInstruction()));```
isa<XYZ*>(nullptr) triggers the following assertion:
```
assert(Val && "isa<> used on a null pointer");
```
in llvm/Support/Casting.h:81/88/95/102


Repository:
  rL LLVM

http://reviews.llvm.org/D17250





More information about the llvm-commits mailing list