[LLVMdev] LLVM 3.6 and ConstantExpr::replaceUsesOfWithOnConstant(...) strange behavior
gael.jobin at switzerlandmail.ch
Mon Mar 23 08:31:46 PDT 2015
Le 20.03.2015 15:33, Duncan Exon Smith a écrit :
> AFK right now, but IIRC, this function is supposed to be internal to replaceAllUsesWith() and it's not really supposed to be called directly. Constants aren't supposed to change.
> Why can't you just call replaceAllUsesWith()?
> -- dpnes
Because it does not do what I want. Basically, my algorithm is
interested in some GlobalVariable that are used by constant expression.
My goal is to replace the GlobalVariable reference inside the constant
expression by another GlobalVariable. If I use REPLACEALLUSESWITH(...)
on the constant expression, I should pass as argument a constant
expression recreated from scratch. In the other hand, if I call
REPLACEALLUSESWITH(...) on the GlobalVariable "a" with the new
GlobalVariable "b", it will replace all variables "a" with "b" in the
whole module and I still need the "a" for my algorithm.
The best solution would be the first but, during my research, I found
the function REPLACEUSESOFWITHONCONSTANT(...) that does exactly the job
(with some improvment like the "in-place" replacement) and started using
But now, it doesn't work anymore in LLVM 3.6... So, I was interested in
the change made between the two versions. And, apart for my algorithm, I
think that maybe the new implementation was not very logical. Like I
said, the REPLACEOPERANDSINPLACE(...) seems designed to work with and
without a given Use/NumUpdated argument (using an improvment for the
first case). So, for me, it makes no sense to force using an Use
argument for REPLACEUSESOFWITHONCONSTANT(...) because it can handle both
cases with minor changes.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev