summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/BlockGenerators.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'polly/lib/CodeGen/BlockGenerators.cpp')
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 5988fc88da0..53b6f500997 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -692,6 +692,13 @@ void BlockGenerator::generateScalarStores(
DT.dominates(cast<Instruction>(Address)->getParent(),
Builder.GetInsertBlock())) &&
"Domination violation");
+
+ // The new Val might have a different type than the old Val due to
+ // ScalarEvolution looking through bitcasts.
+ if (Val->getType() != Address->getType()->getPointerElementType())
+ Address = Builder.CreateBitOrPointerCast(
+ Address, Val->getType()->getPointerTo());
+
Builder.CreateStore(Val, Address);
});
OpenPOWER on IntegriCloud