[LLVMdev] How to prevent LLVM from undoing a custom lowering

Greg McGary greg at mcgary.org
Mon Apr 20 13:13:23 PDT 2009

My target has only logical shifts and lacks an arithmetic right shift 
I have a custom LowerSRA function that rewrites SRA as SHL + SIGN_EXTEND
when the shift width is either constant 16 or 24.  Unfortunately, I 
observe that a
later pass combines the SHL + SIGN_EXTEND back into SRA so we crash.

The idea I had for defeating this behavior is lower to a target-specific
version of SHL and/or SIGN_EXTEND, rather than using the generic ISD::SHL
and/or ISD::SIGN_EXTEND.  Is that the recommended way to do it?


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

More information about the llvm-dev mailing list