[polly] r245203 - [FIX] Create location if a needed value was not yet demoted
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 02:38:46 PDT 2015
Author: jdoerfert
Date: Mon Aug 17 04:38:46 2015
New Revision: 245203
URL: http://llvm.org/viewvc/llvm-project?rev=245203&view=rev
Log:
[FIX] Create location if a needed value was not yet demoted
This allows the code generation to continue working even if a needed
value (that is reloaded anyway) was not yet demoted. Instead of
failing it will now create the location for future demotion to memory
and load from that location. The stores will use the same location and
by construction execute before the load even if the textual order in
the generated AST is otherwise.
Reviewers: grosser, Meinersbur
Subscribers: #polly
Differential Revision: http://reviews.llvm.org/D12072
Modified:
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/test/Isl/CodeGen/assumed_context_empty_domain_restriction.ll
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=245203&r1=245202&r2=245203&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Mon Aug 17 04:38:46 2015
@@ -474,9 +474,7 @@ Value *BlockGenerator::getNewScalarValue
return /* Case (3a) */ ScalarValueCopy;
// Case (3b)
- assert(ReloadMap.count(ScalarValueInst) &&
- "ScalarInst not mapped in the block and not in the given reload map!");
- Value *ReloadAddr = ReloadMap[ScalarValueInst];
+ Value *ReloadAddr = getOrCreateAlloca(ScalarValueInst, ReloadMap, ".s2a");
ScalarValue =
Builder.CreateLoad(ReloadAddr, ReloadAddr->getName() + ".reload");
Modified: polly/trunk/test/Isl/CodeGen/assumed_context_empty_domain_restriction.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/assumed_context_empty_domain_restriction.ll?rev=245203&r1=245202&r2=245203&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/assumed_context_empty_domain_restriction.ll (original)
+++ polly/trunk/test/Isl/CodeGen/assumed_context_empty_domain_restriction.ll Mon Aug 17 04:38:46 2015
@@ -1,35 +1,9 @@
-; RUN: opt %loadPolly -S -polly-opt-isl -polly-codegen < %s
+; RUN: opt %loadPolly -S -polly-opt-isl -polly-codegen < %s | FileCheck %s
;
-; TODO: This test will crash the scalar code generation. The problem step by step:
-; 1) The assumed context is empty because of the out-of-bounds array access.
-; 2) The dependence analysis will use the assumed context and determine
-; that there are not iterations executed, hence no dependences.
-; 3) The scheduler will transform the program somehow according to
-; the orginal domains and empty dependences but not the assumed context.
-; The new ast is shown below.
-; 4) The code generation will look for the new value of %0 when the
-; for_body_328_lr_ph statement is copied, however it has not yet seen %0
-; as the for_end_310 statement has been moved after for_body_328_lr_ph.
-; 5) Crash as no new value of %0 can be found.
-;
-; AST:
-;
-; if (0)
-; {
-; for (int c0 = 0; c0 <= 32; c0 += 1)
-; Stmt_for_body_328(c0);
-; Stmt_for_body_328_lr_ph();
-; Stmt_for_end_310();
-; }
-; else
-; { /* original code */ }
+; This test used to crash the scalar code generation.
;
; CHECK: polly.start
;
-; TODO: This test should not crash Polly.
-;
-; XFAIL: *
-;
@endposition = external global i32, align 4
@Bit = external global [0 x i32], align 4
@Init = external global [0 x i32], align 4
More information about the llvm-commits
mailing list