@@ -48,10 +48,14 @@ static bool fixI8TruncUseChain(Instruction &I,
4848 Type *InstrType = IntegerType::get (I.getContext (), 32 );
4949 for (unsigned OpIdx = 0 ; OpIdx < I.getNumOperands (); ++OpIdx) {
5050 Value *Op = I.getOperand (OpIdx);
51- if (ReplacedValues.count (Op)) {
51+ if (ReplacedValues.count (Op))
5252 InstrType = ReplacedValues[Op]->getType ();
53+ }
54+ for (unsigned OpIdx = 0 ; OpIdx < I.getNumOperands (); ++OpIdx) {
55+ Value *Op = I.getOperand (OpIdx);
56+ if (ReplacedValues.count (Op))
5357 NewOperands.push_back (ReplacedValues[Op]);
54- } else if (auto *Imm = dyn_cast<ConstantInt>(Op)) {
58+ else if (auto *Imm = dyn_cast<ConstantInt>(Op)) {
5559 APInt Value = Imm->getValue ();
5660 unsigned NewBitWidth = InstrType->getIntegerBitWidth ();
5761 // Note: options here are sext or sextOrTrunc.
@@ -142,7 +146,7 @@ class DXILLegalizationPipeline {
142146 bool MadeChanges = false ;
143147 for (auto &I : instructions (F)) {
144148 for (auto &LegalizationFn : LegalizationPipeline) {
145- MadeChanges = LegalizationFn (I, ToRemove, ReplacedValues);
149+ MadeChanges | = LegalizationFn (I, ToRemove, ReplacedValues);
146150 }
147151 }
148152 while (!ToRemove.empty ()) {
0 commit comments