[llvm] r204538 - [Constant Hoisting] Erase dead cast instructions.

Juergen Ributzka juergen at apple.com
Wed Apr 2 16:13:12 PDT 2014


Added a test case in r205484.

On Mar 31, 2014, at 4:15 PM, Eric Christopher <echristo at gmail.com> wrote:

> Testcase? Should be trivial to notice that an extra and dead IR
> instruction is left in after...
> 
> -eric
> 
> On Fri, Mar 21, 2014 at 6:49 PM, Juergen Ributzka <juergen at apple.com> wrote:
>> Author: ributzka
>> Date: Fri Mar 21 20:49:30 2014
>> New Revision: 204538
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=204538&view=rev
>> Log:
>> [Constant Hoisting] Erase dead cast instructions.
>> 
>> The cleanup code that removes dead cast instructions only removed them from the
>> basic block, but didn't delete them. This fix erases them now too.
>> 
>> Modified:
>>    llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp
>> 
>> Modified: llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp?rev=204538&r1=204537&r2=204538&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp Fri Mar 21 20:49:30 2014
>> @@ -595,7 +595,7 @@ bool ConstantHoisting::emitBaseConstants
>> void ConstantHoisting::deleteDeadCastInst() const {
>>   for (auto const &I : ClonedCastMap)
>>     if (I.first->use_empty())
>> -      I.first->removeFromParent();
>> +      I.first->eraseFromParent();
>> }
>> 
>> /// \brief Optimize expensive integer constants in the given function.
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list