[PATCH] D88806: [SCEV] Model ptrtoint(SCEVUnknown) cast not as unknown, but as zext/trunc/self of SCEVUnknown

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 01:48:42 PDT 2020


lebedev.ri added a comment.

In D88806#2326961 <https://reviews.llvm.org/D88806#2326961>, @lebedev.ri wrote:

> In D88806#2326944 <https://reviews.llvm.org/D88806#2326944>, @uabelho wrote:
>
>> Hi,
>>
>> I got my share of doom too, even after the fix.
>> So
>>
>>   opt -S -o - bbi-48445.ll -indvars
>>
>> crashes with
>>
>>   opt: ../lib/IR/Constants.cpp:1896: static llvm::Constant *llvm::ConstantExpr::getZExt(llvm::Constant *, llvm::Type *, bool): Assertion `C->getType()->isIntOrIntVectorTy() && "ZEXt operand must be integral"' failed.
>>
>> for the following input:
>>
>>   target datalayout = "p:16:16"
>>   
>>   @a_i32 = external global [21 x i32], section ".bss,bss", align 1
>>   
>>   define void @test_array_ldm_i32() {
>>   entry:
>>     br label %for.body42
>>   
>>   crit_edge:                                        ; preds = %for.body42
>>     %split = phi i32 [ %add58, %for.body42 ]
>>     %add132 = add i32 %split, undef
>>     unreachable
>>   
>>   for.body42:                                       ; preds = %for.body42, %entry
>>     %sub.ptr.sub49 = sub i32 undef, ptrtoint ([21 x i32]* @a_i32 to i32)
>>     %sub.ptr.div50 = sdiv exact i32 %sub.ptr.sub49, 2
>>     %conv51 = sext i32 %sub.ptr.div50 to i64
>>     %cmp53 = icmp eq i64 %conv51, undef
>>     %cond55 = select i1 %cmp53, i16 0, i16 1
>>     %conv56 = sext i16 %cond55 to i32
>>     %add57 = add i32 65536, %conv56
>>     %add58 = add i32 undef, %add57
>>     br i1 false, label %for.body42, label %crit_edge
>>   }
>
> Perfect, thank you. That's the test case i was missing. Will fix in a moment.

Fixed in rG7324616660fc0995fa8c166e3c392361222d5dbc <https://reviews.llvm.org/rG7324616660fc0995fa8c166e3c392361222d5dbc>, thank you for the reproducer!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88806/new/

https://reviews.llvm.org/D88806



More information about the llvm-commits mailing list