EXACT_DIV_EXPR can be used on signed operands, so it is wrong to always
turn it into UDiv.  Since EXACT_DIV_EXPR always gives the same result as
TRUNC_DIV_EXPR (it exists in gcc because it might give that result faster
on some targets, not because it gives a different result), it is pointless
to distinguish between the two in LLVM.

Index: gcc/llvm-convert.cpp
===================================================================
--- gcc/llvm-convert.cpp        (revision 248)
+++ gcc/llvm-convert.cpp        (working copy)
@@ -591,14 +591,12 @@
   case MINUS_EXPR:Result = EmitBinOp(exp, DestLoc, Instruction::Sub);break;
   case MULT_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Mul);break;
   case TRUNC_DIV_EXPR: 
+  case EXACT_DIV_EXPR: 
     if (TYPE_UNSIGNED(TREE_TYPE(exp)))
       Result = EmitBinOp(exp, DestLoc, Instruction::UDiv);
     else 
       Result = EmitBinOp(exp, DestLoc, Instruction::SDiv);
     break;
-  case EXACT_DIV_EXPR: 
-    Result = EmitBinOp(exp, DestLoc, Instruction::UDiv);
-    break;
   case RDIV_EXPR:      
     Result = EmitBinOp(exp, DestLoc, Instruction::FDiv);
     break;
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to