[llvm-commits] SHR Patch (Updated) #2/3 [noninstcombine part]

Chris Lattner clattner at apple.com
Thu Nov 2 21:29:14 PST 2006


On Nov 2, 2006, at 3:33 PM, Reid Spencer wrote:

> Here are the SHR patches updated for recent changes on the HEAD. These
> replace the previous submission on Tuesday.  If you're reviewing  
> the SHR
> patches, please use this version now.
>
> ***NOTE: This is for review only, please don't commit any of this.
>
> Reid.
> <SHR.patch>
> <SHR.llvmgcc.patch>
>

*** In LangRef.html, please make the "Overview" sections of each  
instr mention the word "logical" or "arithmetic".

*** In a follow-on patch, please replace all uses of ConstantExpr::get 
[US]Shr with ConstantExpr::get[LA]Shr.  Please do this after  
committing this patch though, to ease review.

*** I should have asked for this before, but in  
CWriter::printConstExprCast, please name 'result' something more  
useful, like "NeedsExplicitCast" or something.  likewise in  
writeInstructionCast.

*** In SROA::ConvertUsesToScalar, the shift should always be a  
logical shift.  Since the top bits are truncated away, it doesn't  
matter which one you use and lshr is cheaper.

*** In ConstantFolding.cpp, all of these cases:
    static Constant *Shl(const ConstantPacked *V1, const  
ConstantPacked *V2) {
      return EvalVectorOp(V1, V2, ConstantExpr::getShl);
    }
-  static Constant *Shr(const ConstantPacked *V1, const  
ConstantPacked *V2) {
-    return EvalVectorOp(V1, V2, ConstantExpr::getShr);
+  static Constant *LShr(const ConstantPacked *V1, const  
ConstantPacked *V2) {
+    return EvalVectorOp(V1, V2, ConstantExpr::getLShr);
+  }
+  static Constant *AShr(const ConstantPacked *V1, const  
ConstantPacked *V2) {
+    return EvalVectorOp(V1, V2, ConstantExpr::getAShr);
    }

are dead, because we don't support shifting of vectors.


*** In ConstantFolding.cpp, this comment is incorrect:

+    case Instruction::AShr:
+      if (!isa<UndefValue>(V2))
+        return const_cast<Constant*>(V1);           // undef ashr X  
--> X

It is actually "... --> undef".


Otherwise, looks good.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20061102/e67034fd/attachment.html>


More information about the llvm-commits mailing list