diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-09-21 23:36:40 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-09-21 23:36:40 +0000 |
commit | 225d4bdb07fc76dcc4f366d9c76761f877d674a8 (patch) | |
tree | c920131e6d90c63c9aba082a46bd5d5a00355320 /llvm/lib/Transforms | |
parent | 9fafe07da0e613862c81ae1eddb9de61d08d7d28 (diff) | |
download | bcm5719-llvm-225d4bdb07fc76dcc4f366d9c76761f877d674a8.tar.gz bcm5719-llvm-225d4bdb07fc76dcc4f366d9c76761f877d674a8.zip |
Fix a case where the new SROA pass failed to zap dead operands to
selects with a constant condition. This resulted in the operands
remaining live through the SROA rewriter. Most of the time, this just
caused some dead allocas to persist and get zapped by later passes, but
in one case found by Joerg, it caused a crash when we tried to *promote*
the alloca despite it having this dead use. We already have the
mechanisms in place to handle this, just wire select up to them.
llvm-svn: 164427
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 3b0cb383380..e1f02868568 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -901,6 +901,10 @@ private: // If the result of the constant fold will be the pointer, recurse // through the select as if we had RAUW'ed it. enqueueUsers(SI, Offset); + else + // Otherwise the operand to the select is dead, and we can replace it + // with undef. + P.DeadOperands.push_back(U); return; } |