[llvm-dev] Disabling DCE pass from opt

Alex Susu via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 15 06:00:21 PST 2016


   Hello.
     Could you please tell me which passes in opt perform DCE for the following code (I am 
aware of the passes from the source file lib/Transforms/IPO/PassManagerBuilder.cpp):
         void foo(TYPE *A, TYPE *B, TYPE *C, TYPE N) {
           int tmpToBeDCE;

           for (TYPE i = 0; i < N; ++i) {
               C[i] = A[i] + B[i];
               tmpToBeDCE = 2;
           }

           tmpToBeDCE++;
         }

     I ask because when I give this code to clang -O3 (I require -O3 to perform 
vectorization), in the resulting .ll file there is no reference to the tmpToBeDCE variable 
- it was eliminated since it has no real use.
     I would like to still have this variable implemented in the output .ll file.

   Thank you,
     Alex


More information about the llvm-dev mailing list