File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1684,6 +1684,10 @@ bool SIFoldOperandsImpl::tryFoldClamp(MachineInstr &MI) {
1684
1684
return false ;
1685
1685
1686
1686
MachineInstr *Def = MRI->getVRegDef (ClampSrc->getReg ());
1687
+ MachineInstr *OrigDef = Def;
1688
+ // Look through COPY. COPY only observed with True16.
1689
+ if (Def->isCopy () && Def->getOperand (1 ).getReg ().isVirtual ())
1690
+ Def = MRI->getVRegDef (Def->getOperand (1 ).getReg ());
1687
1691
1688
1692
// The type of clamp must be compatible.
1689
1693
if (TII->getClampMask (*Def) != TII->getClampMask (MI))
@@ -1701,7 +1705,7 @@ bool SIFoldOperandsImpl::tryFoldClamp(MachineInstr &MI) {
1701
1705
// Clamp is applied after omod, so it is OK if omod is set.
1702
1706
DefClamp->setImm (1 );
1703
1707
1704
- Register DefReg = Def ->getOperand (0 ).getReg ();
1708
+ Register DefReg = OrigDef ->getOperand (0 ).getReg ();
1705
1709
Register MIDstReg = MI.getOperand (0 ).getReg ();
1706
1710
if (TRI->isSGPRReg (*MRI, DefReg)) {
1707
1711
// Pseudo scalar instructions have a SGPR for dst and clamp is a v_max*
You can’t perform that action at this time.
0 commit comments