[llvm] r276952 - [InstCombine] Handle failures from ConstantFoldConstantExpression
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 10 15:05:43 PDT 2016
After discussing on IRC, we decided to not merge this to 3.9 as we'd
need to pull in more patches.
On Mon, Aug 8, 2016 at 1:35 PM, Hans Wennborg <hwennborg at google.com> wrote:
> Ping?
>
> Apologies if this has been mentioned somewhere else. Should we merge
> this, or is it an ancient/hard-to-hit bug?
>
> On Mon, Aug 1, 2016 at 1:39 PM, Hans Wennborg <hwennborg at google.com> wrote:
>> Ping?
>>
>> On Thu, Jul 28, 2016 at 8:51 AM, Hans Wennborg <hwennborg at google.com> wrote:
>>> Something for 3.9?
>>>
>>> On Wed, Jul 27, 2016 at 7:29 PM, David Majnemer via llvm-commits
>>> <llvm-commits at lists.llvm.org> wrote:
>>>> Author: majnemer
>>>> Date: Wed Jul 27 21:29:06 2016
>>>> New Revision: 276952
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=276952&view=rev
>>>> Log:
>>>> [InstCombine] Handle failures from ConstantFoldConstantExpression
>>>>
>>>> ConstantFoldConstantExpression returns null when folding fails.
>>>>
>>>> This fixes PR28745.
>>>>
>>>> Modified:
>>>> llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
>>>> llvm/trunk/test/Transforms/InstCombine/cast.ll
>>>>
>>>> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=276952&r1=276951&r2=276952&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
>>>> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Wed Jul 27 21:29:06 2016
>>>> @@ -162,7 +162,8 @@ Value *InstCombiner::EvaluateInDifferent
>>>> C = ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/);
>>>> // If we got a constantexpr back, try to simplify it with DL info.
>>>> if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
>>>> - C = ConstantFoldConstantExpression(CE, DL, TLI);
>>>> + if (Constant *FoldedC = ConstantFoldConstantExpression(CE, DL, TLI))
>>>> + C = FoldedC;
>>>> return C;
>>>> }
>>>>
>>>>
>>>> Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=276952&r1=276951&r2=276952&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/test/Transforms/InstCombine/cast.ll (original)
>>>> +++ llvm/trunk/test/Transforms/InstCombine/cast.ll Wed Jul 27 21:29:06 2016
>>>> @@ -1372,3 +1372,11 @@ define i16 @PR24763(i8 %V) {
>>>> %t = trunc i32 %l to i16
>>>> ret i16 %t
>>>> }
>>>> +
>>>> +define i64 @PR28745() {
>>>> +; CHECK-LABEL: @PR28745(
>>>> +; CHECK-NEXT: ret i64 zext (i32 extractvalue ({ i32 } select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), { i32 } { i32 1 }, { i32 } zeroinitializer), 0) to i64)
>>>> +
>>>> + %b = zext i32 extractvalue ({ i32 } select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), { i32 } { i32 1 }, { i32 } zeroinitializer), 0) to i64
>>>> + ret i64 %b
>>>> +}
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list