aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <sunfish@google.com>2014-02-13 19:33:33 -0800
committerDan Gohman <sunfish@google.com>2014-02-14 11:08:48 -0800
commit4e87a5bfe9cc2da6b89de4f0d348388f8f8e3249 (patch)
tree3e84842e7889b51f8ecb7238bde6af55b1f17c1c
parenta8eadb7743e528ebac52835c7bd95d722bd3c751 (diff)
Fix a crash when an alloca has no ultimate users.
-rw-r--r--lib/Target/JSBackend/SimplifyAllocas.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Target/JSBackend/SimplifyAllocas.cpp b/lib/Target/JSBackend/SimplifyAllocas.cpp
index 2fda6be948..fb6d65cd4b 100644
--- a/lib/Target/JSBackend/SimplifyAllocas.cpp
+++ b/lib/Target/JSBackend/SimplifyAllocas.cpp
@@ -88,7 +88,7 @@ bool SimplifyAllocas::runOnFunction(Function &Func) {
}
if (!Fail) Aliases.push_back(U);
}
- if (!Fail && Aliases.size() > 0) {
+ if (!Fail && Aliases.size() > 0 && ActualType) {
// success, replace the alloca and the bitcast aliases with a single simple alloca
AllocaInst *NA = new AllocaInst(ActualType, ConstantInt::get(i32, 1), "", I);
NA->takeName(AI);