llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Missed DSE case

Open lattner opened this issue 18 years ago • 4 comments

Bugzilla Link 2599
Resolution FIXED
Resolved on Jul 28, 2008 11:32
Version 1.0
OS All
CC @asl

Extended Description

DSE should delete a store to a location when the stored value is the same as the loaded one. For example:

void foo(_Complex int *x) { *x = ~*x; }

compiles to:

define void @​foo({ i32, i32 }* %x) nounwind { entry: getelementptr { i32, i32 }* %x, i32 0, i32 0 ; <i32*>:0 [#uses=2] load i32* %0, align 4 ; :1 [#uses=1] getelementptr { i32, i32 }* %x, i32 0, i32 1 ; <i32*>:2 [#uses=2] load i32* %2, align 4 ; :3 [#uses=1] sub i32 0, %3 ; :4 [#uses=1] store i32 %1, i32* %0, align 4 store i32 %4, i32* %2, align 4 ret void }

The load+store to %0 should be nuked, which would happen if DSE deleted the store to %0.

lattner avatar Jul 26 '08 01:07 lattner

mentioned in issue llvm/llvm-bugzilla-archive#45795

fhahn avatar Nov 27 '21 03:11 fhahn

mentioned in issue llvm/llvm-bugzilla-archive#32342

devincoughlin avatar Nov 26 '21 23:11 devincoughlin

Fixed in r54133.

llvmbot avatar Jul 28 '08 18:07 llvmbot

This shouldn't be hard to catch. I'll poke at it this weekend.

llvmbot avatar Jul 26 '08 01:07 llvmbot