You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ValueTracking analysis only tries to fill up trailing zeros when going through GEPs.
In particular, the analysis doesn't take advantage of the range information that may be available, resulting and suboptimal code.
As of e97e985, compute known bits performs the proper analysis on gep.
Next step is to teach instcombine that inttoptr (i64 523 to float*) is a compile time constant.
Extended Description
The ValueTracking analysis only tries to fill up trailing zeros when going through GEPs.
In particular, the analysis doesn't take advantage of the range information that may be available, resulting and suboptimal code.
Consider the following snippet:
Using the range information this example can be simplified into the following code, since 64 + 4*128 is guaranteed to be bigger than 523:
But given ValueTracking doesn't leverage the range information, no simplification happens.
Now, rewrite this code with an add like so:
And ValueTracking provides the proper known bits and the simplification can happen.
Not simplified.
opt -S -instcombine value_tracking_gep.ll -o -
Simplified.
opt -S -instcombine value_tracking_add.ll -o -
Note: I have to use a volatile load to prevent instcombine for dropping the range information. I'll file a separate PR for that.
The text was updated successfully, but these errors were encountered: