[llvm-commits] [llvm] r159876 - in /llvm/trunk: lib/Transforms/InstCombine/InstructionCombining.cpp test/Transforms/InstCombine/badmalloc.ll test/Transforms/InstCombine/invoke.ll test/Transforms/InstCombine/malloc-free-delete.ll test/Transforms/InstCom
Nuno Lopes
nunoplopes at sapo.pt
Sun Jul 8 13:01:04 PDT 2012
>> --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
>> (original)
>> +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Fri
>> Jul 6 18:09:25 2012
>> @@ -1137,12 +1137,29 @@
>> }
>> }
>> if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(U)) {
>> - if (II->getIntrinsicID() == Intrinsic::lifetime_start ||
>> - II->getIntrinsicID() == Intrinsic::lifetime_end) {
>> + switch (II->getIntrinsicID()) {
>> + default: return false;
>> + case Intrinsic::memmove:
>> + case Intrinsic::memcpy:
>> + case Intrinsic::memset: {
>> + MemIntrinsic *MI = cast<MemIntrinsic>(II);
>> + if (MI->isVolatile() || MI->getRawDest() != V)
>
> why exclude volatile stores? If all that is being done to the allocated
> memory
> is doing a bunch of volatile stores to it, I don't see why you can't
> discard
> them and the allocation too.
I thought about that, but.. I guess it's better not to mess around with
volatiles. And I don't even think it's legal (C standard wise) to remove it.
Nuno
More information about the llvm-commits
mailing list