[PATCH] [RewriteStatepointsForGC] Fix a relocation bug w.r.t values defined by invoke instructions

Sanjoy Das sanjoy at playingwithpointers.com
Thu Feb 26 17:36:09 PST 2015


Comments inline.


================
Comment at: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp:1570
@@ +1569,3 @@
+        assert(!cast<Instruction>(def)->isTerminator() &&
+               "The only TerminatorInst that can produce a value is\
+               InvokeInst which is handled above.");
----------------
Minor nit: currently the abort string will be "The only ... a value is < several spaces > InvokeInst which ...".  I think you can just split the string literal here:

        assert(!cast<Instruction>(def)->isTerminator() &&
               "The only TerminatorInst that can produce a value is "
               "InvokeInst which is handled above.");


================
Comment at: lib/Transforms/Scalar/RewriteStatepointsForGC.cpp:1572
@@ +1571,3 @@
+               InvokeInst which is handled above.");
+         store->insertAfter(cast<Instruction>(def));
+      }
----------------
You have an `isa<Instruction>(def)` followed by two `cast<Instruction>(def)`s.  It might just be better to `dyn_cast` to an `Instruction` in the condition like you've done for the `InvokeInst`.

http://reviews.llvm.org/D7923

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list