[PATCH] D71164: [InstCombine] Fix infinite loop due to bitcast <-> phi transforms

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 01:43:18 PST 2020


lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

Did you verify that test-suite now passes?

(marking as reviewed, thanks)



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2325-2327
+        NewV = combineLoadToNewType(*LI, DestTy);
+        replaceInstUsesWith(*LI, UndefValue::get(LI->getType()));
+        eraseInstFromFunction(*LI);
----------------
I'm confused. Why are we replacing old `LI` with `undef` instead of `NewV`?
This should be explained in the comment.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:452
 /// point the \c InstCombiner currently is using.
-static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewTy,
-                                      const Twine &Suffix = "") {
+LoadInst *InstCombiner::combineLoadToNewType(LoadInst &LI, Type *NewTy,
+                                             const Twine &Suffix) {
----------------
Can you please precommit this?


================
Comment at: llvm/test/Transforms/InstCombine/pr44245.ll:1
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -instcombine -instcombine-infinite-loop-threshold=2 < %s | FileCheck %s
----------------
Precommit


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

https://reviews.llvm.org/D71164





More information about the llvm-commits mailing list