[llvm-commits] [PATCH] PR970: isFloatingPoint audit 3 of 5

Gordon Henriksen gordonhenriksen at mac.com
Sat Jan 20 11:55:43 PST 2007


This patch includes two changes I'm not entirely certain of.

First, in PatternMatch.h, the m_Neg matcher is incorrect for VP  
vectors. It matches sub <+0.0, +0.0, ...>, %x but the correct pattern  
is sub <-0.0, -0.0, ...>, %x. Since this matcher is dead, I simply  
commented it out with a note that it was broken. It would be simple  
to delete or fix it instead. (In fact, patch 4 includes just such a  
fix.)

Second, in GlobalOpt.cpp, the ShrinkGlobalToBoolean transformation  
excludes FP, but allows vectors. It doesn't explain why. FP exclusion  
was added last November to fix a crash, it looks like. I made it  
exclude vectors, too, but there's no overwhelming reason why.

In addition to these, in LowerSelect.cpp:

bool LowerSelect::runOnFunction(Function &F) {
   bool Changed = false;
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
     for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I !=  
E; ++I) {
       if (SelectInst *SI = dyn_cast<SelectInst>(I))
         if (!OnlyFP || SI->getType()->isFloatingPoint()) {
           // Split this basic block in half right before the select  
instruction.

This pass is dead except for opt -lowerselect, so there's no client  
to say which (isFloatingPoint or isFPOrFPVector) is the correct  
behavior for the OnlyFP option. The pass could be deleted, the OnlyFP  
option deleted, the test switched to !OnlyFP || SI->getType()- 
 >isFPOrFPVector(), or the pass extended to lower any combination of  
FP and integer scalars and vectors. Or, of course, it could be left  
alone!

— Gordon



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070120/38468ed5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr970-3.patch
Type: application/octet-stream
Size: 1928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070120/38468ed5/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070120/38468ed5/attachment-0001.html>


More information about the llvm-commits mailing list