[llvm-commits] [llvm] r150690 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp test/Transforms/InstSimplify/compare.ll
Benjamin Kramer
benny.kra at googlemail.com
Thu Feb 16 07:07:51 PST 2012
On 16.02.2012, at 15:10, Duncan Sands wrote:
> Hi Benjamin,
>
>> InstSimplify: Ignore pointer casts when constant folding compares between pointers.
>
>> --- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
>> +++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Thu Feb 16 07:49:39 2012
>> @@ -1591,8 +1591,11 @@
>> // to the case where LHS is a global variable address or null is pointless,
>> // since if both LHS and RHS are constants then we already constant folded
>> // the compare, and if only one of them is then we moved it to RHS already.
>> - if (isa<AllocaInst>(LHS)&& (isa<GlobalValue>(RHS) || isa<AllocaInst>(RHS) ||
>> - isa<ConstantPointerNull>(RHS)))
>> + Value *LHSPtr = LHS->stripPointerCasts();
>> + Value *RHSPtr = RHS->stripPointerCasts();
>
> how about doing
> LHS = LHS->stripPointerCasts();
> RHS = RHS->stripPointerCasts();
> right at the start of the routine?
Great idea! r150694.
- Ben
>
> Ciao, Duncan.
> _______________________________________________
> 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