[PATCH] D29404: [ValueTracking] emit a warning when we detect a conflicting assumption (PR31809)

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 11:45:05 PST 2017


davide added a subscriber: anemet.
davide added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:800-804
+
+    Q.CxtI->getContext().diagnose(DiagnosticInfoOptimizationFailure(
+        *Q.CxtI->getFunction(), Q.CxtI->getDebugLoc(),
+        "Detected conflicting code assumptions. Program has undefined behavior "
+        "or internal compiler error."));
----------------
I'm struggling here.  It's true we're emitting a diagnostic related to the fact we can't optimize, but it's also true we're not optimizing because the IR to which we lowered exhibits undefined behaviour (so, there's a correctness issue). 
Also, I thought we could use OptimizationRemarkEmitter for this kind of tasks? (+ Adam) @anemet 


================
Comment at: test/Transforms/InstSimplify/assume.ll:4-7
+; Verify that warnings are emitted for the 2nd and 3rd tests.
+
+; CHECK: warning: <unknown>:0:0: Detected conflicting code assumptions.
+; CHECK: warning: <unknown>:0:0: Detected conflicting code assumptions.
----------------
Can we actually get a test to make sure we emit the correct debuginfo/debugloc instead of `<unknown>` ?


https://reviews.llvm.org/D29404





More information about the llvm-commits mailing list