[llvm-dev] LSR/SCEV problem/question

Geoff Berry via llvm-dev llvm-dev at lists.llvm.org
Thu May 26 15:06:55 PDT 2016

Hi Sanjoy,

I know it's been a while, but I finally got back to this and have made 
an attempt at fixing this issue w/ SCEV using approach (2) as previously 


Let me know what you think when you get a chance.



On 3/29/2016 11:48 PM, Sanjoy Das wrote:
> Hi Geoff,
> Thanks for the detailed reproduction instruction -- they were very
> helpful, and I can now see the bug.
> Generally, I think (2) is the better solution.  It should be up to
> SCEVExpander to keep its state consistent.  The fact that we're trying
> to optimize instructions as we insert them makes that trickier, but I
> still think that is the right invariant to have.
> I don't see why (2) would be particularly ugly though (perhaps I'm not
> being sufficiently imaginative :) ).  I think
> IRBuilder::SetInsertPoint(Instruction *) is safe, since it always sets
> BB and IP in sync with each other.  So I think we basically need to
> sync things at restoreIP() (which is called only once in the file) and
> at places that potentially move insertion points (like hoistIVInc)
> using something like
> "Builder.SetInsertPoint(&*Builder.GetInsertPoint())".  Are there any
> other places that need to be fixed too?
> We should also add a LSRInserter that asserts that the basic block
> we're inserting into is the same as the insertee's parent.
> -- Sanjoy

Geoff Berry
Employee of Qualcomm Innovation Center, Inc.
  Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

More information about the llvm-dev mailing list