[PATCH] D127628: [NewGVN][LoadCoercion][3/3] Replace load with a phi node
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 22 01:40:39 PDT 2022
foad added a comment.
In example 2 you insert a new instruction `%V1 = load i32, i32* %P` at the end of BB2. I'm not sure this is safe in general. For example, if BB2 has other successors:
BB1 BB2
\ / \
BB3 BB4
then the new load instruction will be executed even if BB2 is going to branch to BB4, and in that case the load might trap.
As another example, what if BB3 looked like this:
BB3:
call @foo // this function never returns
%V = load i32, i32* %P // this load always traps
If you insert a load at the end of BB2 then it will trap //before// calling `@foo`, which changes the behaviour of the program.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127628/new/
https://reviews.llvm.org/D127628
More information about the llvm-commits
mailing list