aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-03 07:08:57 +0000
committerChris Lattner <sabre@nondot.org>2009-02-03 07:08:57 +0000
commit55a683d7f03b0acaf7807545fd7be319498277ff (patch)
tree623528275d2cd538adc0e1d2227b9c265b05b87e /lib
parent2eafb8b404311ffce66ab170baef0385e79cc2b6 (diff)
add another case of undefined behavior without crashing, PR3466.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 83572d65da..c67c67a4b6 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -1431,8 +1431,9 @@ Value *SROA::ConvertUsesOfLoadToScalar(LoadInst *LI, AllocaInst *NewAI,
// Finally, unconditionally truncate the integer to the right width.
unsigned LIBitWidth = TD->getTypeSizeInBits(LI->getType());
if (LIBitWidth < NTy->getBitWidth())
- NV = new TruncInst(NV, IntegerType::get(LIBitWidth),
- LI->getName(), LI);
+ NV = new TruncInst(NV, IntegerType::get(LIBitWidth), LI->getName(), LI);
+ else if (LIBitWidth > NTy->getBitWidth())
+ NV = new ZExtInst(NV, IntegerType::get(LIBitWidth), LI->getName(), LI);
// If the result is an integer, this is a trunc or bitcast.
if (isa<IntegerType>(LI->getType())) {