summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@imgtec.com>2016-03-01 16:50:08 +0000
committerPetar Jovanovic <petar.jovanovic@imgtec.com>2016-03-01 16:50:08 +0000
commit6315f3f9b709de850a081d5bac3201efca1c156d (patch)
treefa4a80286f1da1f6b037c11b6833ff1bb6f09be8 /llvm/lib
parentaa4dc20f09795133f1054a665ff8f35c5fd6b531 (diff)
downloadbcm5719-llvm-6315f3f9b709de850a081d5bac3201efca1c156d.tar.gz
bcm5719-llvm-6315f3f9b709de850a081d5bac3201efca1c156d.zip
Revert "calculate builtin_object_size if argument is a removable pointer"
Revert r262337 as "check-llvm ubsan" step failed on sanitizer-x86_64-linux-fast buildbot. llvm-svn: 262349
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index de4dfb5caeb..1b95e9334c1 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1942,25 +1942,6 @@ Instruction *InstCombiner::visitAllocSite(Instruction &MI) {
SmallVector<WeakVH, 64> Users;
if (isAllocSiteRemovable(&MI, Users, TLI)) {
for (unsigned i = 0, e = Users.size(); i != e; ++i) {
- // Lowering all @llvm.objectsize calls first because they may
- // use a bitcast/GEP of the alloca we are removing.
- Instruction *I = cast_or_null<Instruction>(&*Users[i]);
- if (!I) continue;
-
- if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
- if (II->getIntrinsicID() == Intrinsic::objectsize) {
- uint64_t Size;
- if (!getObjectSize(II->getArgOperand(0), Size, DL, TLI)) {
- ConstantInt *CI = cast<ConstantInt>(II->getArgOperand(1));
- Size = CI->isZero() ? -1ULL : 0;
- }
- replaceInstUsesWith(*I, ConstantInt::get(I->getType(), Size));
- eraseInstFromFunction(*I);
- Users[i] = nullptr; // Skip examining in the next loop.
- }
- }
- }
- for (unsigned i = 0, e = Users.size(); i != e; ++i) {
Instruction *I = cast_or_null<Instruction>(&*Users[i]);
if (!I) continue;
@@ -1970,6 +1951,12 @@ Instruction *InstCombiner::visitAllocSite(Instruction &MI) {
C->isFalseWhenEqual()));
} else if (isa<BitCastInst>(I) || isa<GetElementPtrInst>(I)) {
replaceInstUsesWith(*I, UndefValue::get(I->getType()));
+ } else if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
+ if (II->getIntrinsicID() == Intrinsic::objectsize) {
+ ConstantInt *CI = cast<ConstantInt>(II->getArgOperand(1));
+ uint64_t DontKnow = CI->isZero() ? -1ULL : 0;
+ replaceInstUsesWith(*I, ConstantInt::get(I->getType(), DontKnow));
+ }
}
eraseInstFromFunction(*I);
}
OpenPOWER on IntegriCloud