projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7283e7c
)
Do not call getTypeSize on a type that has no size
author
Chris Lattner
<sabre@nondot.org>
Fri, 2 Jul 2004 22:55:47 +0000
(22:55 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Fri, 2 Jul 2004 22:55:47 +0000
(22:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14584
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Transforms/Scalar/InstructionCombining.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Scalar/InstructionCombining.cpp
b/lib/Transforms/Scalar/InstructionCombining.cpp
index 28e2eec0b41e5736c1654c2642dd23f886c7f5ec..bf5711948640f2ee89d797ce1e753cf16952e837 100644
(file)
--- a/
lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/
lib/Transforms/Scalar/InstructionCombining.cpp
@@
-2854,7
+2854,8
@@
Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) {
// If alloca'ing a zero byte object, replace the alloca with a null pointer.
// Note that we only do this for alloca's, because malloc should allocate and
// return a unique pointer, even for a zero byte allocation.
- if (isa<AllocaInst>(AI) && TD->getTypeSize(AI.getAllocatedType()) == 0)
+ if (isa<AllocaInst>(AI) && AI.getAllocatedType()->isSized() &&
+ TD->getTypeSize(AI.getAllocatedType()) == 0)
return ReplaceInstUsesWith(AI, Constant::getNullValue(AI.getType()));
return 0;