Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang can't build NaCl decoder with -O1 and ASan enabled #61

Closed
ramosian-glider opened this issue Aug 31, 2015 · 10 comments
Closed

Clang can't build NaCl decoder with -O1 and ASan enabled #61

ramosian-glider opened this issue Aug 31, 2015 · 10 comments

Comments

@ramosian-glider
Copy link
Member

Originally reported on Google Code with ID 61

The attached file (200+KLoc) is the autogenerated NaCl decoder for x86 assembly.


Here are build times for different compilers and options:
  gcc -O0 -- 12 seconds
  gcc -O2 -- 41 second
  clang -O0 -- 5 seconds
  clang -O0 -faddress-sanitizer -- 16 seconds
  clang -O2 -- 2 minutes 20 seconds

Clang with -faddress-sanitizer and one of {-O1,-O2} hangs on this program.

This is probably because our instrumentation prevents the compiler from putting most
of the values to the registers.

Reported by ramosian.glider on 2012-04-11 13:53:43


- _Attachment: [decoder-x86_64.c](https://storage.googleapis.com/google-code-attachments/address-sanitizer/issue-61/comment-0/decoder-x86_64.c)_
@ramosian-glider
Copy link
Member Author

validator-x86_64.c is slightly smaller, but still hangs Clang.

Reported by ramosian.glider on 2012-04-11 13:55:00


- _Attachment: [validator-x86_64.c](https://storage.googleapis.com/google-code-attachments/address-sanitizer/issue-61/comment-1/validator-x86_64.c)_

@ramosian-glider
Copy link
Member Author

Ok, this is something finite:

$ clang -O2 validator-x86_64.c -c
 -- 1m48s
$ clang -O2 validator-x86_64.c -c -faddress-sanitizer
 -- 3m42s


$ opt validator-x86_64-small.bc -O2 -o validator-x86_64-small.opt.bc -time-passes

===-------------------------------------------------------------------------===
                      ... Pass execution timing report ...
===-------------------------------------------------------------------------===
  Total Execution Time: 24.3300 seconds (24.3905 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name
---
  10.6000 ( 43.6%)   0.0000 (  0.0%)  10.6000 ( 43.6%)  10.6197 ( 43.5%)  Unroll loops
   3.9800 ( 16.4%)   0.0000 (  0.0%)   3.9800 ( 16.4%)   3.9862 ( 16.3%)  Global Value
Numbering
   1.8400 (  7.6%)   0.0000 (  0.0%)   1.8400 (  7.6%)   1.8852 (  7.7%)  Canonicalize
natural loops
   1.6100 (  6.6%)   0.0000 (  0.0%)   1.6100 (  6.6%)   1.5926 (  6.5%)  Canonicalize
natural loops
   0.7400 (  3.0%)   0.0000 (  0.0%)   0.7400 (  3.0%)   0.7582 (  3.1%)  Induction
Variable Simplification
   0.6500 (  2.7%)   0.0000 (  0.0%)   0.6500 (  2.7%)   0.6662 (  2.7%)  Loop Invariant
Code Motion
   0.4400 (  1.8%)   0.0000 (  0.0%)   0.4400 (  1.8%)   0.4495 (  1.8%)  Loop-Closed
SSA Form Pass
   0.4600 (  1.9%)   0.0000 (  0.0%)   0.4600 (  1.9%)   0.4438 (  1.8%)  Loop-Closed
SSA Form Pass
   0.4100 (  1.7%)   0.0000 (  0.0%)   0.4100 (  1.7%)   0.3971 (  1.6%)  Loop-Closed
SSA Form Pass
   0.3200 (  1.3%)   0.0000 (  0.0%)   0.3200 (  1.3%)   0.3234 (  1.3%)  Value Propagation
   0.3000 (  1.2%)   0.0000 (  0.0%)   0.3000 (  1.2%)   0.3124 (  1.3%)  Combine redundant
instructions
   0.3000 (  1.2%)   0.0000 (  0.0%)   0.3000 (  1.2%)   0.2993 (  1.2%)  Jump Threading
   0.2900 (  1.2%)   0.0000 (  0.0%)   0.2900 (  1.2%)   0.2875 (  1.2%)  Jump Threading
   0.2700 (  1.1%)   0.0000 (  0.0%)   0.2700 (  1.1%)   0.2656 (  1.1%)  Combine redundant
instructions
   0.2400 (  1.0%)   0.0000 (  0.0%)   0.2400 (  1.0%)   0.2425 (  1.0%)  Unswitch
loops
   0.2400 (  1.0%)   0.0000 (  0.0%)   0.2400 (  1.0%)   0.2378 (  1.0%)  Combine redundant
instructions
   0.2200 (  0.9%)   0.0100 (100.0%)   0.2300 (  0.9%)   0.2311 (  0.9%)  Value Propagation
   0.2200 (  0.9%)   0.0000 (  0.0%)   0.2200 (  0.9%)   0.2261 (  0.9%)  Natural Loop
Information
   0.2500 (  1.0%)   0.0000 (  0.0%)   0.2500 (  1.0%)   0.2191 (  0.9%)  Delete dead
loops
   0.1200 (  0.5%)   0.0000 (  0.0%)   0.1200 (  0.5%)   0.1197 (  0.5%)  Simplify
the CFG
   0.1100 (  0.5%)   0.0000 (  0.0%)   0.1100 (  0.5%)   0.1085 (  0.4%)  Combine redundant
instructions
   0.1000 (  0.4%)   0.0000 (  0.0%)   0.1000 (  0.4%)   0.1073 (  0.4%)  Combine redundant
instructions
   0.0900 (  0.4%)   0.0000 (  0.0%)   0.0900 (  0.4%)   0.0875 (  0.4%)  Scalar Replacement
of Aggregates (DT)
   0.0600 (  0.2%)   0.0000 (  0.0%)   0.0600 (  0.2%)   0.0606 (  0.2%)  Interprocedural
Sparse Conditional Constant Propagation
   0.0600 (  0.2%)   0.0000 (  0.0%)   0.0600 (  0.2%)   0.0492 (  0.2%)  Bitcode Writer
   0.0400 (  0.2%)   0.0000 (  0.0%)   0.0400 (  0.2%)   0.0408 (  0.2%)  Simplify
the CFG
   0.0400 (  0.2%)   0.0000 (  0.0%)   0.0400 (  0.2%)   0.0381 (  0.2%)  Sparse Conditional
Constant Propagation
   0.0300 (  0.1%)   0.0000 (  0.0%)   0.0300 (  0.1%)   0.0311 (  0.1%)  Early CSE
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0269 (  0.1%)  Dominator
Tree Construction
   0.0300 (  0.1%)   0.0000 (  0.0%)   0.0300 (  0.1%)   0.0256 (  0.1%)  Simplify
the CFG
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0251 (  0.1%)  Simplify
the CFG
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0193 (  0.1%)  Lazy Value
Information Analysis
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0192 (  0.1%)  Simplify
the CFG
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0185 (  0.1%)  Early CSE
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0178 (  0.1%)  Module Verifier
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0175 (  0.1%)  Dominator
Tree Construction
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0135 (  0.1%)  Module Verifier
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0130 (  0.1%)  Reassociate
expressions
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0121 (  0.0%)  Dominator
Tree Construction
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0118 (  0.0%)  Lazy Value
Information Analysis
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0116 (  0.0%)  Function
Integration/Inlining
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0112 (  0.0%)  Aggressive
Dead Code Elimination
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0110 (  0.0%)  Dominator
Tree Construction
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0092 (  0.0%)  Dominator
Tree Construction
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0088 (  0.0%)  Dominator
Tree Construction
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0073 (  0.0%)  Rotate Loops
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0072 (  0.0%)  Dead Store
Elimination
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0040 (  0.0%)  MemCpy Optimization
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0020 (  0.0%)  Lower 'expect'
Intrinsics
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0019 (  0.0%)  Scalar Evolution
Analysis
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0016 (  0.0%)  Remove unused
exception handling info
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0016 (  0.0%)  Memory Dependence
Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0013 (  0.0%)  Simplify
well-known library calls
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0011 (  0.0%)  Basic CallGraph
Construction
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0010 (  0.0%)  Tail Call
Elimination
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0006 (  0.0%)  No Alias
Analysis (always returns 'may' alias)
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0006 (  0.0%)  Preliminary
module verification
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0005 (  0.0%)  Recognize
loop idioms
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0005 (  0.0%)  Basic Alias
Analysis (stateless AA impl)
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0004 (  0.0%)  Dead Argument
Elimination
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0003 (  0.0%)  Scalar Replacement
of Aggregates (SSAUp)
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0001 (  0.0%)  Preliminary
module verification
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0001 (  0.0%)  Global Variable
Optimizer
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0001 (  0.0%)  Deduce function
attributes
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0001 (  0.0%)  Memory Dependence
Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Merge Duplicate
Global Constants
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Memory Dependence
Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  No Alias
Analysis (always returns 'may' alias)
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Target Library
Information
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Strip Unused
Function Prototypes
  24.3200 (100.0%)   0.0100 (100.0%)  24.3300 (100.0%)  24.3905 (100.0%)  Total

$ opt validator-x86_64-small.bc -O2 -o validator-x86_64-small.opt-asan.bc -time-passes
-asan
===-------------------------------------------------------------------------===
                      ... Pass execution timing report ...
===-------------------------------------------------------------------------===
  Total Execution Time: 29.3900 seconds (29.4672 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name
---
  12.2700 ( 41.8%)   0.0000 (  0.0%)  12.2700 ( 41.7%)  12.3613 ( 41.9%)  Unroll loops
   3.8800 ( 13.2%)   0.0100 ( 33.3%)   3.8900 ( 13.2%)   3.8982 ( 13.2%)  Global Value
Numbering
   2.3000 (  7.8%)   0.0000 (  0.0%)   2.3000 (  7.8%)   2.3084 (  7.8%)  Scalar Replacement
of Aggregates (SSAUp)
   1.7800 (  6.1%)   0.0000 (  0.0%)   1.7800 (  6.1%)   1.7717 (  6.0%)  Canonicalize
natural loops
   1.5000 (  5.1%)   0.0000 (  0.0%)   1.5000 (  5.1%)   1.4919 (  5.1%)  Canonicalize
natural loops
   1.4200 (  4.8%)   0.0000 (  0.0%)   1.4200 (  4.8%)   1.4289 (  4.8%)  Value Propagation
   0.8800 (  3.0%)   0.0000 (  0.0%)   0.8800 (  3.0%)   0.8443 (  2.9%)  Induction
Variable Simplification
   0.8000 (  2.7%)   0.0000 (  0.0%)   0.8000 (  2.7%)   0.7976 (  2.7%)  Jump Threading
   0.6400 (  2.2%)   0.0000 (  0.0%)   0.6400 (  2.2%)   0.6263 (  2.1%)  Loop Invariant
Code Motion
   0.4200 (  1.4%)   0.0000 (  0.0%)   0.4200 (  1.4%)   0.4368 (  1.5%)  Loop-Closed
SSA Form Pass
   0.4200 (  1.4%)   0.0000 (  0.0%)   0.4200 (  1.4%)   0.4319 (  1.5%)  Loop-Closed
SSA Form Pass
   0.3700 (  1.3%)   0.0000 (  0.0%)   0.3700 (  1.3%)   0.3927 (  1.3%)  Loop-Closed
SSA Form Pass
   0.3700 (  1.3%)   0.0000 (  0.0%)   0.3700 (  1.3%)   0.3711 (  1.3%)  Combine redundant
instructions
   0.2900 (  1.0%)   0.0000 (  0.0%)   0.2900 (  1.0%)   0.2854 (  1.0%)  Combine redundant
instructions
   0.2600 (  0.9%)   0.0000 (  0.0%)   0.2600 (  0.9%)   0.2577 (  0.9%)  Jump Threading
   0.2300 (  0.8%)   0.0000 (  0.0%)   0.2300 (  0.8%)   0.2251 (  0.8%)  Unswitch
loops
   0.2200 (  0.7%)   0.0000 (  0.0%)   0.2200 (  0.7%)   0.2212 (  0.8%)  Combine redundant
instructions
   0.2100 (  0.7%)   0.0100 ( 33.3%)   0.2200 (  0.7%)   0.2175 (  0.7%)  Natural Loop
Information
   0.2100 (  0.7%)   0.0000 (  0.0%)   0.2100 (  0.7%)   0.2164 (  0.7%)  Value Propagation
   0.2000 (  0.7%)   0.0000 (  0.0%)   0.2000 (  0.7%)   0.2044 (  0.7%)  Delete dead
loops
   0.1600 (  0.5%)   0.0000 (  0.0%)   0.1600 (  0.5%)   0.1555 (  0.5%)  Combine redundant
instructions
   0.1000 (  0.3%)   0.0000 (  0.0%)   0.1000 (  0.3%)   0.0979 (  0.3%)  Combine redundant
instructions
   0.0500 (  0.2%)   0.0000 (  0.0%)   0.0500 (  0.2%)   0.0529 (  0.2%)  Simplify
the CFG
   0.0400 (  0.1%)   0.0000 (  0.0%)   0.0400 (  0.1%)   0.0409 (  0.1%)  Simplify
the CFG
   0.0400 (  0.1%)   0.0000 (  0.0%)   0.0400 (  0.1%)   0.0396 (  0.1%)  Bitcode Writer
   0.0300 (  0.1%)   0.0000 (  0.0%)   0.0300 (  0.1%)   0.0359 (  0.1%)  Sparse Conditional
Constant Propagation
   0.0200 (  0.1%)   0.0100 ( 33.3%)   0.0300 (  0.1%)   0.0334 (  0.1%)  Interprocedural
Sparse Conditional Constant Propagation
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0248 (  0.1%)  Early CSE
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0230 (  0.1%)  Simplify
the CFG
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0195 (  0.1%)  Simplify
the CFG
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0162 (  0.1%)  Module Verifier
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0152 (  0.1%)  Lazy Value
Information Analysis
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0149 (  0.1%)  Dominator
Tree Construction
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0137 (  0.0%)  Function
Integration/Inlining
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0128 (  0.0%)  Reassociate
expressions
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0127 (  0.0%)  Lazy Value
Information Analysis
   0.0200 (  0.1%)   0.0000 (  0.0%)   0.0200 (  0.1%)   0.0117 (  0.0%)  Dominator
Tree Construction
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0104 (  0.0%)  Dominator
Tree Construction
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0093 (  0.0%)  Aggressive
Dead Code Elimination
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0090 (  0.0%)  Dominator
Tree Construction
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0071 (  0.0%)  Rotate Loops
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0062 (  0.0%)  Dead Store
Elimination
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0028 (  0.0%)  Remove unused
exception handling info
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0028 (  0.0%)  MemCpy Optimization
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0020 (  0.0%)  Simplify
well-known library calls
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0015 (  0.0%)  Basic CallGraph
Construction
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0015 (  0.0%)  Memory Dependence
Analysis
   0.0100 (  0.0%)   0.0000 (  0.0%)   0.0100 (  0.0%)   0.0014 (  0.0%)  Scalar Evolution
Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0011 (  0.0%)  Tail Call
Elimination
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0005 (  0.0%)  No Alias
Analysis (always returns 'may' alias)
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0005 (  0.0%)  Dead Argument
Elimination
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0005 (  0.0%)  Recognize
loop idioms
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0004 (  0.0%)  Basic Alias
Analysis (stateless AA impl)
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0002 (  0.0%)  AddressSanitizer
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0001 (  0.0%)  Global Variable
Optimizer
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0001 (  0.0%)  Preliminary
module verification
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0001 (  0.0%)  Deduce function
attributes
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0001 (  0.0%)  Memory Dependence
Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Merge Duplicate
Global Constants
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Memory Dependence
Analysis
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Target Library
Information
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)  Strip Unused
Function Prototypes
  29.3600 (100.0%)   0.0300 (100.0%)  29.3900 (100.0%)  29.4672 (100.0%)  Total



Quite strange that nothing differs in the optimization passes.
Kostya, do you know how to inject ASan pass to the very same place where it's invoked
by Clang?

Reported by ramosian.glider on 2012-04-11 15:06:26


- _Attachment: [validator-x86_64-small.c](https://storage.googleapis.com/google-code-attachments/address-sanitizer/issue-61/comment-2/validator-x86_64-small.c)_

@ramosian-glider
Copy link
Member Author

Per Kostya's request -- a profile:
$ perf record  clang -O2 t.c  -c  -faddress-sanitizer validator-x86_64-small.c
$ perf report

    18.84%            clang  clang                 [.] llvm::LiveInterval::extendIntervalEndTo(llvm::LiveRange*,
llvm::SlotIndex)
     8.96%            clang  clang                 [.] llvm::Use::getImpliedUser()
const
     7.57%            clang  clang                 [.] llvm::MachineRegisterInfo::getVRegDef(unsigned
int) const
     7.44%            clang  clang                 [.] llvm::SmallPtrSetImpl::FindBucketFor(void
const*) const
     5.83%            clang  clang                 [.] llvm::LiveInterval::extendIntervalStartTo(llvm::LiveRange*,
llvm::SlotIndex)
     5.21%            clang  clang                 [.] llvm::LiveInterval::addRangeFrom(llvm::LiveRange,
llvm::LiveRange*)
     5.07%            clang  clang                 [.] llvm::LiveVariables::VarInfo::isLiveIn(llvm::MachineBasicBlock
const&, unsigned int, llvm::MachineRegisterInfo&)
     4.34%            clang  clang                 [.] llvm::LoopBase<llvm::MachineBasicBlock,
llvm::MachineLoop>::getExitingBlocks(llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&)
const
     3.43%            clang  clang                 [.] llvm::SparseBitVector<128u>::FindLowerBound(unsigned
int)
     2.29%            clang  clang                 [.] llvm::Use::getUser() const
     2.11%            clang  clang                 [.] llvm::PredIterator<llvm::BasicBlock,
llvm::value_use_iterator<llvm::User> >::operator++()
     1.58%            clang  clang                 [.] llvm::PredIterator<llvm::BasicBlock,
llvm::value_use_iterator<llvm::User> >::operator*() const
     1.53%            clang  clang                 [.] llvm::ilist_sentinel_traits<llvm::SparseBitVectorElement<128u>
>::ensureHead(llvm::SparseBitVectorElement<128u>*&)
     1.48%            clang  clang                 [.] llvm::LiveVariables::VarInfo::findKill(llvm::MachineBasicBlock
const*) const
     1.40%            clang  clang                 [.] (anonymous namespace)::RegisterCoalescer::JoinIntervals(llvm::CoalescerPair&)
     1.35%            clang  clang                 [.] llvm::Loop::hasDedicatedExits()
const
     1.30%            clang  clang                 [.] llvm::LiveInterval::find(llvm::SlotIndex)
     1.02%            clang  clang                 [.] void std::__introsort_loop<llvm::MachineBasicBlock**,
long>(llvm::MachineBasicBlock**, llvm::MachineBasicBlock**, long)
     0.91%            clang  clang                 [.] llvm::LiveIntervals::shrinkToUses(llvm::LiveInterval*,
llvm::SmallVectorImpl<llvm::MachineInstr*>*)
     0.66%            clang  clang                 [.] llvm::ValueHandleBase::AddToUseList()
     0.53%            clang  clang                 [.] llvm::LiveVariables::addNewBlock(llvm::MachineBasicBlock*,
llvm::MachineBasicBlock*, llvm::MachineBasicBlock*)
     0.53%            clang  clang                 [.] llvm::VirtRegAuxInfo::CalculateWeightAndHint(llvm::LiveInterval&)
     0.51%            clang  clang                 [.] PushDefUseChildren(llvm::Instruction*,
llvm::SmallVectorImpl<llvm::Instruction*>&)
     0.50%            clang  clang                 [.] llvm::SpillPlacement::iterate()
     0.47%            clang  clang                 [.] llvm::SmallPtrSetImpl::insert_imp(void
const*)
     0.45%            clang  clang                 [.] (anonymous namespace)::LCSSA::runOnLoop(llvm::Loop*,
llvm::LPPassManager&)
     0.42%            clang  clang                 [.] llvm::LoopBase<llvm::BasicBlock,
llvm::Loop>::contains(llvm::BasicBlock const*) const
     0.42%            clang  clang                 [.] llvm::SparseBitVector<128u>::test(unsigned
int)
     0.41%            clang  clang                 [.] llvm::ScalarEvolution::forgetLoop(llvm::Loop
const*)
     0.40%            clang  clang                 [.] llvm::SpillPlacement::addLinks(llvm::ArrayRef<unsigned
int>)
     0.38%            clang  clang                 [.] llvm::LiveVariables::getVarInfo(unsigned
int)
     0.36%            clang  clang                 [.] llvm::LoopBase<llvm::BasicBlock,
llvm::Loop>::getExitBlocks(llvm::SmallVectorImpl<llvm::BasicBlock*>&) const
     0.35%            clang  clang                 [.] llvm::LoopInfoBase<llvm::MachineBasicBlock,
llvm::MachineLoop>::ConsiderForLoop(llvm::MachineBasicBlock*, llvm::DominatorTreeBase<llvm::MachineBasicBlock>&)
     0.32%            clang  clang                 [.] llvm::MemoryDependenceAnalysis::getNonLocalPointerDepFromBB(llvm::PHITransAddr
const&, llvm::AliasAnalysis::Location const&, bool, llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::NonLocalDepResult>&,
llvm::DenseMap<llvm::BasicBlock*, llvm::Value*, llvm::DenseMapInfo<llvm::BasicBlock*>
>&, bool)
     0.31%            clang  clang                 [.] llvm::BasicBlock::getTerminator()
     0.30%            clang  clang                 [.] llvm::LiveInterval::extendInBlock(llvm::SlotIndex,
llvm::SlotIndex)
     0.30%            clang  clang                 [.] llvm::SlotIndexes::getMBBFromIndex(llvm::SlotIndex)
const
     0.25%            clang  clang                 [.] llvm::MemoryDependenceAnalysis::GetNonLocalInfoForBlock(llvm::AliasAnalysis::Location
const&, bool, llvm::BasicBlock*, std::vector<llvm::NonLocalDepEntry, std::allocator<llvm::NonLocalDepEntry>
>*, unsigned int)
     0.24%            clang  clang                 [.] llvm::MachineBasicBlock::SplitCriticalEdge(llvm::MachineBasicBlock*,
llvm::Pass*)
     0.22%            clang  clang                 [.] (anonymous namespace)::CodePlacementOpt::MoveDiscontiguousLoopBlocks(llvm::MachineFunction&,
llvm::MachineLoop*)
     0.22%            clang  clang                 [.] ComputeUltimateVN(llvm::VNInfo*,
llvm::SmallVector<llvm::VNInfo*, 16u>&, llvm::DenseMap<llvm::VNInfo*, llvm::VNInfo*,
llvm::DenseMapInfo<llvm::VNInfo*> >&, llvm::DenseMap<llvm::VNInfo*, llvm::VNInfo*,
llvm::DenseMapInfo<llvm::VNInfo*> >&, llvm::SmallVector<int, 16u>&, llvm::SmallVector<int,
16u>&)
     0.21%            clang  clang                 [.] llvm::DenseMap<llvm::VNInfo*,
llvm::VNInfo*, llvm::DenseMapInfo<llvm::VNInfo*> >::operator[](llvm::VNInfo* const&)
     0.20%            clang  clang                 [.] llvm::BranchInst::getSuccessorV(unsigned
int) const
     0.20%            clang  clang                 [.] llvm::DenseMap<llvm::VNInfo*,
llvm::VNInfo*, llvm::DenseMapInfo<llvm::VNInfo*> >::grow(unsigned int)
     0.19%            clang  clang                 [.] llvm::SlotIndex::operator<=(llvm::SlotIndex)
const
     0.19%            clang  clang                 [.] llvm::InterferenceCache::Entry::update(unsigned
int)
     0.18%            clang  libc-2.11.1.so        [.] _int_malloc
     0.18%            clang  clang                 [.] llvm::IndexedMap<std::pair<llvm::TargetRegisterClass
const*, llvm::MachineOperand*>, llvm::VirtReg2IndexFunctor>::operator[](unsigned int)
const
     0.16%            clang  clang                 [.] llvm::X86InstrInfo::AnalyzeBranch(llvm::MachineBasicBlock&,
llvm::MachineBasicBlock*&, llvm::MachineBasicBlock*&, llvm::SmallVectorImpl<llvm::MachineOperand>&,
bool) const
     0.14%            clang  clang                 [.] llvm::ValueHandleBase::RemoveFromUseList()
     0.13%            clang  clang                 [.] llvm::LoopBase<llvm::MachineBasicBlock,
llvm::MachineLoop>::contains(llvm::MachineBasicBlock const*) const
     0.13%            clang  clang                 [.] (anonymous namespace)::RAGreedy::growRegion((anonymous
namespace)::RAGreedy::GlobalSplitCandidate&)
     0.11%            clang  clang                 [.] void std::__introsort_loop<llvm::BasicBlock**,
long>(llvm::BasicBlock**, llvm::BasicBlock**, long)
     0.11%            clang  clang                 [.] llvm::PredIteratorCache::GetPreds(llvm::BasicBlock*)
     0.10%            clang  clang                 [.] llvm::IntrinsicInst::classof(llvm::Value
const*)
     0.10%            clang  libc-2.11.1.so        [.] __GI_memset
     0.10%            clang  clang                 [.] llvm::SmallPtrSetImpl::Grow(unsigned
int)
     0.10%            clang  clang                 [.] llvm::SlotIndex::operator<(llvm::SlotIndex)
const

Reported by ramosian.glider on 2012-04-19 10:02:20

@ramosian-glider
Copy link
Member Author

On the original (large) file the profile looks like this (after ~10 minutes runs)
    61.05%            [.] llvm::LoopBase<llvm::MachineBasicBlock, llvm::MachineLoop>::getExitingBlocks(llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&)
const                                      
     8.17%            [.] void std::__introsort_loop<llvm::MachineBasicBlock**, long>(llvm::MachineBasicBlock**,
llvm::MachineBasicBlock**, long)                                                  

     4.04%            [.] llvm::Use::getUser() const                              


     2.69%            [.] (anonymous namespace)::LoopSimplify::ProcessLoop(llvm::Loop*,
llvm::LPPassManager&)                                                             

     2.19%            [.] void std::__final_insertion_sort<llvm::MachineBasicBlock**>(llvm::MachineBasicBlock**,
llvm::MachineBasicBlock**)                                                        

     2.01%            [.] llvm::LoopInfoBase<llvm::BasicBlock, llvm::Loop>::ConsiderForLoop(llvm::BasicBlock*,
llvm::DominatorTreeBase<llvm::BasicBlock>&)      

Looks like asan instrumentation triggers some non-linear algorithm in codegen. 

Reported by konstantin.s.serebryany on 2012-04-23 13:52:27

@ramosian-glider
Copy link
Member Author

Running 'llc z.ll' gives the same profile

Reported by konstantin.s.serebryany on 2012-04-23 14:06:00


- _Attachment: [z.ll.bz2](https://storage.googleapis.com/google-code-attachments/address-sanitizer/issue-61/comment-5/z.ll.bz2)_

@ramosian-glider
Copy link
Member Author

The compilation finishes in 1.5 hours, so this is not an infinite loop. 

Reported by kcc@chromium.org on 2012-04-24 12:14:50

@ramosian-glider
Copy link
Member Author

LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=12652

Reported by konstantin.s.serebryany on 2012-04-25 08:44:30

@ramosian-glider
Copy link
Member Author

A related problem was seen in issue 69

Reported by konstantin.s.serebryany on 2012-05-22 08:20:51

@ramosian-glider
Copy link
Member Author

Original test cases now build in reasonable time with asan at -O2.
(800 seconds for decoder-x86_64.c and 400 seconds for validator-x86_64.c)
There are other outstanding compile-time bugs (e.g. http://llvm.org/bugs/show_bug.cgi?id=12652)
but these reproducers seem unrelated. 
Closing. 

Reported by konstantin.s.serebryany on 2013-12-26 15:17:01

  • Status changed: Fixed

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:12:59

  • Labels added: ProjectAddressSanitizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant