[llvm-commits] [llvm] r168711 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Transforms/IndVarSimplify/eliminate-comparison.ll
Benjamin Kramer
benny.kra at gmail.com
Thu Nov 29 08:00:39 PST 2012
On 29.11.2012, at 16:55, Pawel Wodnicki <pawel at 32bitmicro.com> wrote:
> Ben,
>
> Have you heard from Chris about r168711 approval?
Not yet.
- Ben
>
>>
>> On 27.11.2012, at 19:16, Benjamin Kramer <benny.kra at googlemail.com> wrote:
>>
>>> Author: d0k
>>> Date: Tue Nov 27 12:16:32 2012
>>> New Revision: 168711
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=168711&view=rev
>>> Log:
>>> SCEV: Even if the latch terminator is foldable we can't deduce the result of an unrelated condition with it.
>>>
>>> Fixes PR14432.
>>
>> Chris, can you approve this for 3.2? It fixes a miscompilation and is apparently a regression from 3.1.
>>
>> - Ben
>>
>>>
>>> Modified:
>>> llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>>> llvm/trunk/test/Transforms/IndVarSimplify/eliminate-comparison.ll
>>>
>>> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=168711&r1=168710&r2=168711&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
>>> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Nov 27 12:16:32 2012
>>> @@ -6149,9 +6149,10 @@
>>> if (SimplifyICmpOperands(Pred, LHS, RHS))
>>> if (LHS == RHS)
>>> return CmpInst::isTrueWhenEqual(Pred);
>>> - if (SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS))
>>> - if (FoundLHS == FoundRHS)
>>> - return CmpInst::isFalseWhenEqual(Pred);
>>> +
>>> + // Canonicalize the found cond too. We can't conclude a result from the
>>> + // simplified values.
>>> + SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS);
>>>
>>> // Check to see if we can make the LHS or RHS match.
>>> if (LHS == FoundRHS || RHS == FoundLHS) {
>>>
>>> Modified: llvm/trunk/test/Transforms/IndVarSimplify/eliminate-comparison.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/eliminate-comparison.ll?rev=168711&r1=168710&r2=168711&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/test/Transforms/IndVarSimplify/eliminate-comparison.ll (original)
>>> +++ llvm/trunk/test/Transforms/IndVarSimplify/eliminate-comparison.ll Tue Nov 27 12:16:32 2012
>>> @@ -106,3 +106,57 @@
>>> return:
>>> ret void
>>> }
>>> +
>>> +; PR14432
>>> +; Indvars should not turn the second loop into an infinite one.
>>> +
>>> +; CHECK: @func_11
>>> +; CHECK: %tmp5 = icmp slt i32 %__key6.0, 10
>>> +; CHECK-NOT: br i1 true, label %noassert68, label %unrolledend
>>> +
>>> +define i32 @func_11() nounwind uwtable {
>>> +entry:
>>> + br label %forcond
>>> +
>>> +forcond: ; preds = %noassert, %entry
>>> + %__key6.0 = phi i32 [ 2, %entry ], [ %tmp37, %noassert ]
>>> + %tmp5 = icmp slt i32 %__key6.0, 10
>>> + br i1 %tmp5, label %noassert, label %forcond38.preheader
>>> +
>>> +forcond38.preheader: ; preds = %forcond
>>> + br label %forcond38
>>> +
>>> +noassert: ; preds = %forbody
>>> + %tmp13 = sdiv i32 -32768, %__key6.0
>>> + %tmp2936 = shl i32 %tmp13, 24
>>> + %sext23 = shl i32 %tmp13, 24
>>> + %tmp32 = icmp eq i32 %tmp2936, %sext23
>>> + %tmp37 = add i32 %__key6.0, 1
>>> + br i1 %tmp32, label %forcond, label %assert33
>>> +
>>> +assert33: ; preds = %noassert
>>> + tail call void @llvm.trap()
>>> + unreachable
>>> +
>>> +forcond38: ; preds = %noassert68, %forcond38.preheader
>>> + %__key8.0 = phi i32 [ %tmp81, %noassert68 ], [ 2, %forcond38.preheader ]
>>> + %tmp46 = icmp slt i32 %__key8.0, 10
>>> + br i1 %tmp46, label %noassert68, label %unrolledend
>>> +
>>> +noassert68: ; preds = %forbody39
>>> + %tmp57 = sdiv i32 -32768, %__key8.0
>>> + %sext34 = shl i32 %tmp57, 16
>>> + %sext21 = shl i32 %tmp57, 16
>>> + %tmp76 = icmp eq i32 %sext34, %sext21
>>> + %tmp81 = add i32 %__key8.0, 1
>>> + br i1 %tmp76, label %forcond38, label %assert77
>>> +
>>> +assert77: ; preds = %noassert68
>>> + tail call void @llvm.trap()
>>> + unreachable
>>> +
>>> +unrolledend: ; preds = %forcond38
>>> + ret i32 0
>>> +}
>>> +
>>> +declare void @llvm.trap() noreturn nounwind
>>>
>>>
>>> _______________________________________________
>>> 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