summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-01-23 17:52:29 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-01-23 17:52:29 +0000
commite4c46fec738596f551df6b2678cddc1f0aa09e30 (patch)
tree6d75709ea50f7bac75230a14ffa98e44fc51198f /llvm/lib/Transforms
parentd15bb30dba1a657590e574a0d21ca22434f7c93c (diff)
downloadbcm5719-llvm-e4c46fec738596f551df6b2678cddc1f0aa09e30.tar.gz
bcm5719-llvm-e4c46fec738596f551df6b2678cddc1f0aa09e30.zip
Revert "InstCombine: Clean up weird code that talks about a modulus that's long gone."
This causes crashes during the build of compiler-rt during selfhost. Add a testcase for coverage. llvm-svn: 173279
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index e9e05ceb658..dc7fe5cf6b5 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -758,7 +758,12 @@ Type *InstCombiner::FindElementAtOffset(Type *Ty, int64_t Offset,
FirstIdx = Offset/TySize;
Offset -= FirstIdx*TySize;
- assert(Offset >= 0 && "Offset should never be negative!");
+ // Handle hosts where % returns negative instead of values [0..TySize).
+ if (Offset < 0) {
+ --FirstIdx;
+ Offset += TySize;
+ assert(Offset >= 0);
+ }
assert((uint64_t)Offset < (uint64_t)TySize && "Out of range offset");
}
OpenPOWER on IntegriCloud