if (StoreInst *PrevSI = dyn_cast<StoreInst>(BBI)) {
// Prev store isn't volatile, and stores to the same location?
- if (PrevSI->isUnordered() && equivalentAddressValues(PrevSI->getOperand(1),
- SI.getOperand(1))) {
+ if (PrevSI->isUnordered() &&
+ equivalentAddressValues(PrevSI->getOperand(1), SI.getOperand(1)) &&
+ PrevSI->getValueOperand()->getType() ==
+ SI.getValueOperand()->getType()) {
++NumDeadStore;
// Manually add back the original store to the worklist now, so it will
// be processed after the operands of the removed store, as this may
%s = select i1 %c, ptr %gep1, ptr %gep2
ret ptr %s
}
+
+define void @dse(ptr %p) {
+; CHECK-LABEL: @dse(
+; CHECK-NEXT: store i32 0, ptr [[P:%.*]], align 4
+; CHECK-NEXT: store i8 1, ptr [[P]], align 1
+; CHECK-NEXT: ret void
+;
+ store i32 0, ptr %p
+ store i8 1, ptr %p
+ ret void
+}