[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp

Reid Spencer reid at x10sys.com
Thu Apr 12 05:46:50 PDT 2007



Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.77 -> 1.78
---
Log message:

Fix a bug in PartSet. The replacement value needs to be zext or trunc to
the size of the value, not just zext. Also, give better names to two BBs.


---
Diffs of the changes:  (+7 -3)

 IntrinsicLowering.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.77 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.78
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.77	Wed Apr 11 21:48:46 2007
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp	Thu Apr 12 07:46:33 2007
@@ -512,8 +512,8 @@
     BasicBlock* entry = new BasicBlock("entry",F,0);
     BasicBlock* large = new BasicBlock("large",F,0);
     BasicBlock* small = new BasicBlock("small",F,0);
-    BasicBlock* forward = new BasicBlock("cond_true24",F,0);
-    BasicBlock* reverse = new BasicBlock("cond_next60",F,0);
+    BasicBlock* forward = new BasicBlock("forward",F,0);
+    BasicBlock* reverse = new BasicBlock("reverse",F,0);
 
     // Block entry (entry)
     // First, convert Lo and Hi to ValTy bit width
@@ -546,7 +546,11 @@
     Rep3->reserveOperandSpace(2);
     Rep3->addIncoming(Rep2, small);
     Rep3->addIncoming(Rep, entry);
-    CastInst* Rep4 = new ZExtInst(Rep3, ValTy, "", small);
+    Value* Rep4 = Rep3;
+    if (ValBits > RepBits)
+      Rep4 = new ZExtInst(Rep3, ValTy, "", small);
+    else if (ValBits < RepBits)
+      Rep4 = new TruncInst(Rep3, ValTy, "", small);
     ICmpInst* is_reverse = 
       new ICmpInst(ICmpInst::ICMP_UGT, Lo, Hi, "", small);
     new BranchInst(reverse, forward, is_reverse, small);






More information about the llvm-commits mailing list