diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-06-09 19:00:55 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-06-09 19:00:55 +0000 |
commit | 5ac1d23d3d2d7a79fe520978927e9c47f65e27eb (patch) | |
tree | 477aa096689d0d417219302e02e86d748703d288 | |
parent | ae83e1f5cbfb120c20965b8d3294888d8a97a785 (diff) | |
download | bcm5719-llvm-5ac1d23d3d2d7a79fe520978927e9c47f65e27eb.tar.gz bcm5719-llvm-5ac1d23d3d2d7a79fe520978927e9c47f65e27eb.zip |
It's an error to translate this:
%reg1025 = <sext> %reg1024
...
%reg1026 = SUBREG_TO_REG 0, %reg1024, 4
into this:
%reg1025 = <sext> %reg1024
...
%reg1027 = EXTRACT_SUBREG %reg1025, 4
%reg1026 = SUBREG_TO_REG 0, %reg1027, 4
The problem here is that SUBREG_TO_REG is there to assert that an implicit zext
occurs. It doesn't insert a zext instruction. If we allow the EXTRACT_SUBREG
here, it will give us the value after the <sext>, not the original value of
%reg1024 before <sext>.
llvm-svn: 105741
-rw-r--r-- | llvm/lib/CodeGen/OptimizeExts.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/OptimizeExts.cpp b/llvm/lib/CodeGen/OptimizeExts.cpp index 41fc2040744..38f3cf7e41c 100644 --- a/llvm/lib/CodeGen/OptimizeExts.cpp +++ b/llvm/lib/CodeGen/OptimizeExts.cpp @@ -118,6 +118,26 @@ bool OptimizeExts::OptimizeInstr(MachineInstr *MI, MachineBasicBlock *MBB, continue; } + // It's an error to translate this: + // + // %reg1025 = <sext> %reg1024 + // ... + // %reg1026 = SUBREG_TO_REG 0, %reg1024, 4 + // + // into this: + // + // %reg1025 = <sext> %reg1024 + // ... + // %reg1027 = EXTRACT_SUBREG %reg1025, 4 + // %reg1026 = SUBREG_TO_REG 0, %reg1027, 4 + // + // The problem here is that SUBREG_TO_REG is there to assert that an + // implicit zext occurs. It doesn't insert a zext instruction. If we allow + // the EXTRACT_SUBREG here, it will give us the value after the <sext>, + // not the original value of %reg1024 before <sext>. + if (UseMI->getOpcode() == TargetOpcode::SUBREG_TO_REG) + continue; + MachineBasicBlock *UseMBB = UseMI->getParent(); if (UseMBB == MBB) { // Local uses that come after the extension. |