[PATCH] D143129: [GVN] Do not propagate equalities for noalias pointers

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 07:34:51 PST 2023


aqjune added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:2564
   // Remove it!
   patchAndReplaceAllUsesWith(I, Repl);
   if (MD && Repl->getType()->isPtrOrPtrVectorTy())
----------------
As @nikic suggested in the Discourse thread, do you want to fix `patchAndReplaceAllUsesWith` so that if it is a pointer it allows replacing uses at instructions that are unaware of provenance? I wonder how things will go.
Actually, we can count different assembly files rather than LLVM IR. If it is less than 10, then we can investigate the files more deeply. Actually, if there are diffs even after allowing this, I think it might be miscompilation bugs.


================
Comment at: llvm/test/Transforms/GVN/condprop.ll:593
   %phi1 = phi ptr [ %gep3, %loop.end ], [ %gep1, %entry ]
   br i1 undef, label %if1, label %then
 
----------------
Nit: could you avoid using `br i1 undef`? This is UB and there is this side project: https://llvm.org/OpenProjects.html#remove_ub_tests
You can add a function argument for this branch condition and use it instead.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143129/new/

https://reviews.llvm.org/D143129



More information about the llvm-commits mailing list