[Polly] Ensure i1 preload condition
If the preload condition is a constant, ExprBuilder::create returns an integer of the native integer while an i1 is expected. Cast the result to i1 if that happens. Fixes #123932
This commit is contained in:
parent
7b1becd940
commit
610e33a547
@ -135,6 +135,9 @@ public:
|
||||
/// @return The llvm::Value* containing the result of the computation.
|
||||
llvm::Value *create(__isl_take isl_ast_expr *Expr);
|
||||
|
||||
/// Create LLVM-IR for an isl_ast_expr[ession] and cast it to i1.
|
||||
llvm::Value *createBool(__isl_take isl_ast_expr *Expr);
|
||||
|
||||
/// Return the largest of two types.
|
||||
///
|
||||
/// @param T1 The first type.
|
||||
|
@ -790,3 +790,10 @@ Value *IslExprBuilder::create(__isl_take isl_ast_expr *Expr) {
|
||||
|
||||
llvm_unreachable("Unexpected enum value");
|
||||
}
|
||||
|
||||
llvm::Value *IslExprBuilder::createBool(__isl_take isl_ast_expr *Expr) {
|
||||
Value *Result = create(Expr);
|
||||
if (!Result->getType()->isIntegerTy(1))
|
||||
Result = Builder.CreateICmpNE(Result, Builder.getInt1(false));
|
||||
return Result;
|
||||
}
|
||||
|
@ -1103,7 +1103,7 @@ Value *IslNodeBuilder::preloadInvariantLoad(const MemoryAccess &MA,
|
||||
Domain = nullptr;
|
||||
|
||||
ExprBuilder.setTrackOverflow(true);
|
||||
Value *Cond = ExprBuilder.create(DomainCond);
|
||||
Value *Cond = ExprBuilder.createBool(DomainCond);
|
||||
Value *OverflowHappened = Builder.CreateNot(ExprBuilder.getOverflowState(),
|
||||
"polly.preload.cond.overflown");
|
||||
Cond = Builder.CreateAnd(Cond, OverflowHappened, "polly.preload.cond.result");
|
||||
|
Loading…
x
Reference in New Issue
Block a user