summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-06-17 22:08:25 +0000
committerChad Rosier <mcrosier@apple.com>2011-06-17 22:08:25 +0000
commit66638b2333f326afd1b3cf35d6fc9b930d276511 (patch)
treec3d77f96c9dc72655a3baf38c2e88554f06e1979 /lib
parent50cb96931a497bba8d06af4dc046c1d2d4a23915 (diff)
downloadllvm-66638b2333f326afd1b3cf35d6fc9b930d276511.tar.gz
llvm-66638b2333f326afd1b3cf35d6fc9b930d276511.tar.bz2
llvm-66638b2333f326afd1b3cf35d6fc9b930d276511.tar.xz
Revert r133285. Causing odd failures on Dragonegg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133301 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCasts.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 48a747d764..601d9b42f3 100644
--- a/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -29,10 +29,6 @@ static Value *DecomposeSimpleLinearExpr(Value *Val, unsigned &Scale,
return ConstantInt::get(Val->getType(), 0);
}
- // Insist that the amount-to-allocate not overflow.
- OverflowingBinaryOperator *OBI = dyn_cast<OverflowingBinaryOperator>(Val);
- if (OBI && !OBI->hasNoUnsignedWrap()) return 0;
-
if (BinaryOperator *I = dyn_cast<BinaryOperator>(Val)) {
if (ConstantInt *RHS = dyn_cast<ConstantInt>(I->getOperand(1))) {
if (I->getOpcode() == Instruction::Shl) {
@@ -75,6 +71,11 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
// This requires TargetData to get the alloca alignment and size information.
if (!TD) return 0;
+ // Insist that the amount-to-allocate not overflow.
+ OverflowingBinaryOperator *OBI =
+ dyn_cast<OverflowingBinaryOperator>(AI.getOperand(0));
+ if (OBI && !(OBI->hasNoSignedWrap() || OBI->hasNoUnsignedWrap())) return 0;
+
const PointerType *PTy = cast<PointerType>(CI.getType());
BuilderTy AllocaBuilder(*Builder);