diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-12 12:46:33 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-12 12:46:33 +0000 |
commit | 37958093c6462a1226f9cfaeebf4d736aaf3606e (patch) | |
tree | 5cb555b405164b16e2110532d4542409474272ab /lib/CodeGen | |
parent | 3a508c94a6c6f124e8b0549358ce76deb92ab662 (diff) | |
download | external_llvm-37958093c6462a1226f9cfaeebf4d736aaf3606e.zip external_llvm-37958093c6462a1226f9cfaeebf4d736aaf3606e.tar.gz external_llvm-37958093c6462a1226f9cfaeebf4d736aaf3606e.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35945 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/IntrinsicLowering.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index 907a5c0..7ef67d5 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -512,8 +512,8 @@ static Instruction *LowerPartSet(CallInst *CI) { 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 @@ static Instruction *LowerPartSet(CallInst *CI) { 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); |