[llvm-dev] [Scalar Evolution] Builder Insertion Point is PHI at the top of the loop resulting in an assert.

Stefan Pintilie via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 7 14:08:32 PDT 2018


Hi All, 

I've been looking at this bug:
https://bugs.llvm.org/show_bug.cgi?id=37004 

In this function:
SCEVExpander::ReuseOrCreateCast
we use the builder insertion point (BIP in the code) to check dominance in 
an assert. Namely, the inserted cast must dominate the BIP.
However, I've come across a situation where the BIP is actually the PHI at 
the top of the loop basic block. Since it's a PHI inside a loop nothing 
inside that loop will dominate it and the assert will fail.

When tracking down this bug I am assuming that the BIP being a PHI is not 
correct and that SCEVExpander::ReuseOrCreateCast should not be called with 
a PHI as the insertion point. 
To those who understand the SCEV Expander does that assumption make sense? 
Or am I not understanding how this works?

Thank you,
Stefan 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180907/fb17edfd/attachment.html>


More information about the llvm-dev mailing list