[llvm] r322125 - [IPSCCP] Remove calls without side effects

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 12:38:36 PST 2018


On 1/10/2018 3:36 PM, Philip Reames via llvm-commits wrote:
> I think this is wrong.  In particular, an ordered memory operation is 
> NOT safe to remove during constant propagation, even if it's result is 
> known.  The ordered load has a side effect of ordering other loads 
> which is not safe to remove.  The entire *point* of having side 
> effects is that there's an effect other than the result of the 
> instruction.

An atomic load with no users is trivially dead.  Per the atomics model, 
the only "side-effect" of a load is the potential synchronizes-with edge 
with an earlier store.  But there is no edge unless the load reads a 
value produced by a "release" store... and you can't prove it does 
without using the value. wouldInstructionBeTriviallyDead should handle 
this, but currently doesn't.

I don't think SCCP tries to fold any other atomic operations.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list