summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen
diff options
context:
space:
mode:
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>2014-09-19 08:49:02 +0000
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>2014-09-19 08:49:02 +0000
commit77bd5ae3d9b7735109ff4d5593a0417ad18f68f2 (patch)
tree689dbd507a84637eee68af23c0576d7836703c58 /polly/lib/CodeGen
parent2e275142cd3993d89885d38e0fd291d0ffc6dde0 (diff)
downloadbcm5719-llvm-77bd5ae3d9b7735109ff4d5593a0417ad18f68f2.tar.gz
bcm5719-llvm-77bd5ae3d9b7735109ff4d5593a0417ad18f68f2.zip
[Fix] Allow pointer types as access elements and compare them correctly
This fixes two problems which are usualy caused together: 1) The elements of an isl AST access expression could be pointers not only integers, floats and vectores thereof. 2) The runtime alias checks need to compare pointers but if they are of a different type we need to cast them into a "max" type similar to the non pointer case. llvm-svn: 218113
Diffstat (limited to 'polly/lib/CodeGen')
-rw-r--r--polly/lib/CodeGen/IslExprBuilder.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/polly/lib/CodeGen/IslExprBuilder.cpp b/polly/lib/CodeGen/IslExprBuilder.cpp
index 18ba170dab9..f8bf4b7553e 100644
--- a/polly/lib/CodeGen/IslExprBuilder.cpp
+++ b/polly/lib/CodeGen/IslExprBuilder.cpp
@@ -130,7 +130,8 @@ Value *IslExprBuilder::createAccessAddress(isl_ast_expr *Expr) {
}
Indices.push_back(IndexOp);
- assert((PtrElTy->isIntOrIntVectorTy() || PtrElTy->isFPOrFPVectorTy()) &&
+ assert((PtrElTy->isIntOrIntVectorTy() || PtrElTy->isFPOrFPVectorTy() ||
+ PtrElTy->isPtrOrPtrVectorTy()) &&
"We do not yet change the type of the access base during code "
"generation.");
@@ -274,15 +275,23 @@ Value *IslExprBuilder::createOpICmp(__isl_take isl_ast_expr *Expr) {
assert((!IsPtrType || RHS->getType()->isPointerTy()) &&
"Both ICmp operators should be pointer types or none of them");
- if (!IsPtrType) {
- Type *MaxType = LHS->getType();
- MaxType = getWidestType(MaxType, RHS->getType());
-
- if (MaxType != RHS->getType())
- RHS = Builder.CreateSExt(RHS, MaxType);
-
- if (MaxType != LHS->getType())
- LHS = Builder.CreateSExt(LHS, MaxType);
+ if (LHS->getType() != RHS->getType()) {
+ if (IsPtrType) {
+ Type *I8PtrTy = Builder.getInt8PtrTy();
+ if (LHS->getType() != I8PtrTy)
+ LHS = Builder.CreateBitCast(LHS, I8PtrTy);
+ if (RHS->getType() != I8PtrTy)
+ RHS = Builder.CreateBitCast(RHS, I8PtrTy);
+ } else {
+ Type *MaxType = LHS->getType();
+ MaxType = getWidestType(MaxType, RHS->getType());
+
+ if (MaxType != RHS->getType())
+ RHS = Builder.CreateSExt(RHS, MaxType);
+
+ if (MaxType != LHS->getType())
+ LHS = Builder.CreateSExt(LHS, MaxType);
+ }
}
isl_ast_op_type OpType = isl_ast_expr_get_op_type(Expr);
OpenPOWER on IntegriCloud