DivCacheTy PerBBDivCache;
bool MadeChange = false;
- Instruction* Next = &*BB->begin();
+ Instruction *Next = &*BB->begin();
while (Next != nullptr) {
// We may add instructions immediately after I, but we want to skip over
// them.
- Instruction* I = Next;
+ Instruction *I = Next;
Next = Next->getNextNode();
+ // Ignore dead code to save time and avoid bugs.
+ if (I->hasNUses(0))
+ continue;
+
FastDivInsertionTask Task(I, BypassWidths);
if (Value *Replacement = Task.getReplacement(PerBBDivCache)) {
I->replaceAllUsesWith(Replacement);
%result = add i64 %resultdiv, %resultrem
ret i64 %result
}
+
+define void @PR43514(i32 %x, i32 %y) {
+; CHECK-LABEL: PR43514:
+; CHECK: # %bb.0:
+; CHECK-NEXT: retq
+ %z1 = zext i32 %x to i64
+ %z2 = zext i32 %y to i64
+ %s = srem i64 %z1, %z2
+ ret void
+}