[PATCH] D44067: [LV] Improving "Control-Flow-Select" Vectorization remark.

Hideki Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 19 10:06:30 PDT 2018


hsaito added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:5679
       if (auto *C = dyn_cast<Constant>(Operand))
-        if (C->canTrap())
-          return false;
+        if (C->canTrap()) {
+          *SelectRemarkInstruction = &I;
----------------
Here, we can generate a very crisp message, right?   "Conditionally used constant can cause a trap. Try manually hoisting it above the condition(s)."

We could generate vector code like below (naive code for illustrative purpose, may not be good for branch prediction) and still be safe, but that could be for another patch.

if (mask is not all false) {
     splatvector = splat(C)
}
else {
    splatvector = splay(undef);
}



================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:5715
     }
-    if (I.mayThrow())
+    if (I.mayThrow()) {
+      *SelectRemarkInstruction = &I;	    
----------------
Here, we should generate a crisp message "Instruction may throw an exception. Try disabling exception handling."


https://reviews.llvm.org/D44067





More information about the llvm-commits mailing list