Chromium Code Reviews| Index: src/IceInstX86Base.h |
| diff --git a/src/IceInstX86Base.h b/src/IceInstX86Base.h |
| index b53620847ad595498c485f85f480c7d553676acd..1f80ca4276fe4b639b49c32b47ac7318ec991ec2 100644 |
| --- a/src/IceInstX86Base.h |
| +++ b/src/IceInstX86Base.h |
| @@ -962,10 +962,10 @@ public: |
| // mov cl, ecx ==> redundant |
| // mov ch, ecx ==> not redundant due to different encodings |
| // mov ch, ebp ==> not redundant due to different base registers |
| - // TODO(stichnot): Don't consider "mov eax, eax" to be redundant when |
| - // used in 64-bit mode to clear the upper half of rax. |
| - int32_t SrcReg = SrcVar->getRegNum(); |
| - int32_t DestReg = this->Dest->getRegNum(); |
| + // mov ecx, ecx ==> reduntant, and dangerous in x86-64. i64 zexting |
|
Jim Stichnoth
2015/12/20 19:27:37
redundant
John
2015/12/21 13:41:31
Done.
|
| + // is handled by Inst86Zext. |
| + const int32_t SrcReg = SrcVar->getRegNum(); |
| + const int32_t DestReg = this->Dest->getRegNum(); |
| return (InstX86Base<Machine>::Traits::getEncoding(SrcReg) == |
| InstX86Base<Machine>::Traits::getEncoding(DestReg)) && |
| (InstX86Base<Machine>::Traits::getBaseReg(SrcReg) == |
| @@ -1169,6 +1169,9 @@ class InstX86Mov |
| : public InstX86BaseMovlike<Machine, InstX86Base<Machine>::Mov> { |
| public: |
| static InstX86Mov *create(Cfg *Func, Variable *Dest, Operand *Source) { |
| + assert(!isScalarIntegerType(Dest->getType()) || |
| + (typeWidthInBytes(Dest->getType()) <= |
| + typeWidthInBytes(Source->getType()))); |
| return new (Func->allocate<InstX86Mov>()) InstX86Mov(Func, Dest, Source); |
| } |